Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 68 additions & 3 deletions pkgs/by-name/qd/qdiskinfo/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,36 @@
stdenv,
smartmontools,
fetchFromGitHub,
fetchzip,
cmake,
qt6,
qdiskinfo,
themeBundle ? null,
}:

let
isThemed = themeBundle != null && themeBundle != { };
themeBundle' =
if isThemed then
{
rightCharacter = false;
}
// themeBundle
else
{ rightCharacter = false; };
in

# check theme bundle
assert
isThemed
-> (
themeBundle' ? src
&& themeBundle' ? paths.bgDark
&& themeBundle' ? paths.bgLight
&& themeBundle' ? paths.status
&& themeBundle' ? rightCharacter
);

stdenv.mkDerivation (finalAttrs: {
pname = "qdiskinfo";
version = "0.3";
Expand All @@ -31,15 +57,54 @@ stdenv.mkDerivation (finalAttrs: {

cmakeBuildType = "MinSizeRel";

cmakeFlags = [
"-DQT_VERSION_MAJOR=6"
];
cmakeFlags =
[
"-DQT_VERSION_MAJOR=6"
]
++ lib.optionals isThemed [ "-DINCLUDE_OPTIONAL_RESOURCES=ON" ]
++ (
if themeBundle'.rightCharacter then
[ "-DCHARACTER_IS_RIGHT=ON" ]
else
[ "-DCHARACTER_IS_RIGHT=OFF" ]
);

postUnpack = ''
cp -r $sourceRoot $TMPDIR/src
sourceRoot=$TMPDIR/src
'';
patchPhase = lib.optionalString isThemed ''
export SRCPATH=${themeBundle'.src}/CdiResource/themes/
export DESTPATH=$sourceRoot/dist/theme/
mkdir -p $DESTPATH
if [ -n "${themeBundle'.paths.bgDark}" ]; then
cp $SRCPATH/${themeBundle'.paths.bgDark} $DESTPATH/bg_dark.png
fi
if [ -n "${themeBundle'.paths.bgLight}" ]; then
cp $SRCPATH/${themeBundle'.paths.bgLight} $DESTPATH/bg_light.png
fi
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
'';
postInstall = ''
wrapProgram $out/bin/QDiskInfo \
--suffix PATH : ${smartmontools}/bin
'';

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}"; }
);
};

meta = {
description = "CrystalDiskInfo alternative for Linux";
homepage = "https://github.com/edisionnano/QDiskInfo";
Expand Down
18 changes: 18 additions & 0 deletions pkgs/by-name/qd/qdiskinfo/sources.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{ fetchzip }:
{
aoi = fetchzip {
url = "https://pilotfiber.dl.sourceforge.net/project/crystaldiskinfo/9.3.2/CrystalDiskInfo9_3_2Aoi.zip?viasf=1#cdi.zip";
hash = "sha256-yldOX/aQYK1Fsd+BpD0SdcyfnHxtwB5rmZHU1nY7Ov8=";
stripRoot = false;
};
kureikei = fetchzip {
url = "https://pilotfiber.dl.sourceforge.net/project/crystaldiskinfo/9.3.2/CrystalDiskInfo9_3_2KureiKei.zip?viasf=1#cdi.zip";
hash = "sha256-mzV3wHKczsh5NOsUxA3kGYSBZyVNJZUWkZdjiJA8+Po=";
stripRoot = false;
};
shizuku = fetchzip {
url = "https://pilotfiber.dl.sourceforge.net/project/crystaldiskinfo/9.3.2/CrystalDiskInfo9_3_2Shizuku.zip?viasf=1#cdi.zip";
hash = "sha256-4dVeOHXWUVjfSssJKpcSBQ7OTMaYmgF15M4ROD3SBDA=";
stripRoot = false;
};
}
Loading