nixpkgs/pkgs/by-name/qd/qdiskinfo/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

117 lines
2.9 KiB
Nix
Raw Normal View History

2024-07-31 09:10:22 -04:00
{
lib,
stdenv,
smartmontools,
fetchFromGitHub,
2024-08-20 04:24:10 -04:00
fetchzip,
2024-07-31 09:10:22 -04:00
cmake,
qt6,
2024-10-07 12:43:33 -04:00
qdiskinfo,
themeBundle ? null,
2024-07-31 09:10:22 -04:00
}:
2024-08-20 04:24:10 -04:00
let
2024-10-07 12:43:33 -04:00
isThemed = themeBundle != null && themeBundle != { };
themeBundle' =
if isThemed then
{
rightCharacter = false;
}
// themeBundle
else
{ rightCharacter = false; };
2024-08-20 04:24:10 -04:00
in
2024-10-07 12:43:33 -04:00
# check theme bundle
assert
isThemed
-> (
themeBundle' ? src
&& themeBundle' ? paths.bgDark
&& themeBundle' ? paths.bgLight
&& themeBundle' ? paths.status
&& themeBundle' ? rightCharacter
);
2024-07-31 09:10:22 -04:00
stdenv.mkDerivation (finalAttrs: {
2024-08-20 08:02:03 -04:00
pname = "qdiskinfo";
version = "0.3";
2024-07-31 09:10:22 -04:00
src = fetchFromGitHub {
owner = "edisionnano";
repo = "QDiskInfo";
rev = "refs/tags/${finalAttrs.version}";
hash = "sha256-0zF3Nc5K8+K68HOSy30ieYvYP9/oSkTe0+cp0hVo9Gs=";
2024-07-31 09:10:22 -04:00
};
nativeBuildInputs = [
cmake
qt6.wrapQtAppsHook
];
buildInputs = [
qt6.qtbase
qt6.qtwayland
smartmontools
];
cmakeBuildType = "MinSizeRel";
2024-08-20 04:24:10 -04:00
cmakeFlags =
[
"-DQT_VERSION_MAJOR=6"
]
2024-10-07 12:43:33 -04:00
++ lib.optionals isThemed [ "-DINCLUDE_OPTIONAL_RESOURCES=ON" ]
++ (
if themeBundle'.rightCharacter then
[ "-DCHARACTER_IS_RIGHT=ON" ]
else
[ "-DCHARACTER_IS_RIGHT=OFF" ]
);
2024-07-31 09:10:22 -04:00
2024-08-20 04:24:10 -04:00
postUnpack = ''
cp -r $sourceRoot $TMPDIR/src
sourceRoot=$TMPDIR/src
'';
2024-10-07 12:43:33 -04:00
patchPhase = lib.optionalString isThemed ''
export SRCPATH=${themeBundle'.src}/CdiResource/themes/
2024-08-20 04:24:10 -04:00
export DESTPATH=$sourceRoot/dist/theme/
mkdir -p $DESTPATH
2024-10-07 12:43:33 -04:00
if [ -n "${themeBundle'.paths.bgDark}" ]; then
cp $SRCPATH/${themeBundle'.paths.bgDark} $DESTPATH/bg_dark.png
2024-08-20 04:24:10 -04:00
fi
2024-10-07 12:43:33 -04:00
if [ -n "${themeBundle'.paths.bgLight}" ]; then
cp $SRCPATH/${themeBundle'.paths.bgLight} $DESTPATH/bg_light.png
2024-08-20 04:24:10 -04:00
fi
2024-10-07 12:43:33 -04:00
cp $SRCPATH/${themeBundle'.paths.status}/SDdiskStatusBad-300.png $DESTPATH/bad.png
cp $SRCPATH/${themeBundle'.paths.status}/SDdiskStatusCaution-300.png $DESTPATH/caution.png
cp $SRCPATH/${themeBundle'.paths.status}/SDdiskStatusGood-300.png $DESTPATH/good.png
cp $SRCPATH/${themeBundle'.paths.status}/SDdiskStatusUnknown-300.png $DESTPATH/unknown.png
2024-08-20 04:24:10 -04:00
'';
2024-07-31 09:10:22 -04:00
postInstall = ''
wrapProgram $out/bin/QDiskInfo \
--suffix PATH : ${smartmontools}/bin
2024-07-31 09:10:22 -04:00
'';
2024-10-07 12:43:33 -04:00
passthru =
let
themeSources = import ./sources.nix { inherit fetchzip; };
in
rec {
themeBundles = import ./themes.nix { inherit themeSources; };
tests = lib.flip lib.mapAttrs themeBundles (
themeName: themeBundle:
(qdiskinfo.override { inherit themeBundle; }).overrideAttrs { pname = "qdiskinfo-${themeName}"; }
);
};
2024-07-31 09:10:22 -04:00
meta = {
description = "CrystalDiskInfo alternative for Linux";
homepage = "https://github.com/edisionnano/QDiskInfo";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ roydubnium ];
platforms = lib.platforms.linux;
mainProgram = "QDiskInfo";
};
})