diff --git a/pkgs/by-name/qd/qdiskinfo/package.nix b/pkgs/by-name/qd/qdiskinfo/package.nix index 736a6e09c1b2..6a3c238692d1 100644 --- a/pkgs/by-name/qd/qdiskinfo/package.nix +++ b/pkgs/by-name/qd/qdiskinfo/package.nix @@ -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"; @@ -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"; diff --git a/pkgs/by-name/qd/qdiskinfo/sources.nix b/pkgs/by-name/qd/qdiskinfo/sources.nix new file mode 100644 index 000000000000..aa28afcf7514 --- /dev/null +++ b/pkgs/by-name/qd/qdiskinfo/sources.nix @@ -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; + }; +} diff --git a/pkgs/by-name/qd/qdiskinfo/themes.nix b/pkgs/by-name/qd/qdiskinfo/themes.nix new file mode 100644 index 000000000000..f02f4ce2887b --- /dev/null +++ b/pkgs/by-name/qd/qdiskinfo/themes.nix @@ -0,0 +1,390 @@ +{ themeSources }: + +{ + aoi = { + src = themeSources.aoi; + paths = { + bgDark = "AoiNight/AoiBackground-300.png"; + bgLight = "Aoi/AoiBackground-300.png"; + status = "Aoi"; + }; + rightCharacter = true; + }; + kureikei = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKei/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + kureikeiBikini = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKeiBikini/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + kureikeiHomebuiltComputer = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKeiHomebuiltComputer~Kronotokage/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + kureikeiPresent = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKeiPresent/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + kureikeiRecoding = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKeiRecoding/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + kureikeiRecodingKimiya = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKeiRecoding~KIMIYA/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + kureikeiSummerKimono = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKeiSummerKimono/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + kureikeiUniform = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKeiUniform/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + kureikeiAsyuihira = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKei~AsYuihira/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + kureikeiHasumikaoru = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKei~hasumikaoru/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + kureikeiKohakumuro = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKei~kohakumuro/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + kureikeiKosake = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKei~kosake/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + kureikeiKunimi = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKei~kunimi/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + kureikeiMaru = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKei~maru/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + kureikeiMugya = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKei~mugya/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + kureikeiNanatunatu = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKei~nanatunatu/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + kureikeiNekopan = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKei~nekopan/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + kureikeiNyamco = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKei~nyamco/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + kureikeiPoyoyonchihiro = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKei~poyoyonchihiro/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + kureikeiShitimiNanami = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKei~ShitimiNanami/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + kureikeiTakiOuno = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKei~TakiOuno/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + kureikeiTori = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKei~tori/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + kureikeiYoite = { + src = themeSources.kureikei; + paths = { + bgDark = ""; + bgLight = "KureiKei~yoite/KureiKeiBackground-300.png"; + status = "KureiKei"; + }; + }; + shizuku = { + src = themeSources.shizuku; + paths = { + bgDark = ""; + bgLight = "Shizuku/ShizukuBackground-300.png"; + status = "Shizuku"; + }; + }; + shizuku5thAnniversary = { + src = themeSources.shizuku; + paths = { + bgDark = ""; + bgLight = "Shizuku5thAnniversary/ShizukuBackground-300.png"; + status = "Shizuku5thAnniversary"; + }; + }; + shizuku7thAnniversary = { + src = themeSources.shizuku; + paths = { + bgDark = ""; + bgLight = "Shizuku7thAnniversary/ShizukuBackground-300.png"; + status = "Shizuku"; + }; + }; + shizukuDate = { + src = themeSources.shizuku; + paths = { + bgDark = ""; + bgLight = "ShizukuDate/ShizukuBackground-300.png"; + status = "ShizukuDate"; + }; + }; + shizukuHanabi = { + src = themeSources.shizuku; + paths = { + bgDark = "ShizukuHanabi/ShizukuBackground-300.png"; + bgLight = ""; + status = "ShizukuHanabi"; + }; + }; + shizukuHaregi = { + src = themeSources.shizuku; + paths = { + bgDark = ""; + bgLight = "ShizukuHaregi/ShizukuBackground-300.png"; + status = "ShizukuHaregi"; + }; + }; + shizukuHeianKomachi = { + src = themeSources.shizuku; + paths = { + bgDark = ""; + bgLight = "ShizukuHeianKomachi/ShizukuBackground-300.png"; + status = "ShizukuHeianKomachi"; + }; + }; + shizukuHotaru = { + src = themeSources.shizuku; + paths = { + bgDark = "ShizukuHotaru/ShizukuBackground-300.png"; + bgLight = ""; + status = "Shizuku"; + }; + }; + shizukuIdol = { + src = themeSources.shizuku; + paths = { + bgDark = ""; + bgLight = "ShizukuIdol/ShizukuBackground-300.png"; + status = "ShizukuIdol"; + }; + }; + shizukuKotatsu = { + src = themeSources.shizuku; + paths = { + bgDark = ""; + bgLight = "ShizukuKotatsu/ShizukuBackground-300.png"; + status = "ShizukuKotatsu"; + }; + }; + shizukuKotatsuNight = { + src = themeSources.shizuku; + paths = { + bgDark = ""; + bgLight = "ShizukuKotatsuNight/ShizukuBackground-300.png"; + status = "ShizukuKotatsu"; + }; + }; + shizukuLiteratureGirl = { + src = themeSources.shizuku; + paths = { + bgDark = ""; + bgLight = "ShizukuLiteratureGirl/ShizukuBackground-300.png"; + status = "ShizukuLiteratureGirl"; + }; + }; + shizukuLiteratureGirlWithGlasses = { + src = themeSources.shizuku; + paths = { + bgDark = ""; + bgLight = "ShizukuLiteratureGirlwithGlasses/ShizukuBackground-300.png"; + status = "ShizukuLiteratureGirlwithGlasses"; + }; + }; + shizukuMaidCool = { + src = themeSources.shizuku; + paths = { + bgDark = ""; + bgLight = "ShizukuMaidCool/ShizukuBackground-300.png"; + status = "ShizukuMaidCool"; + }; + }; + shizukuMaidCute = { + src = themeSources.shizuku; + paths = { + bgDark = ""; + bgLight = "ShizukuMaidCute/ShizukuBackground-300.png"; + status = "ShizukuMaidCute"; + }; + }; + shizukuMeijiMizugi = { + src = themeSources.shizuku; + paths = { + bgDark = ""; + bgLight = "ShizukuMeijiMizugi/ShizukuBackground-300.png"; + status = "ShizukuMeijiMizugi"; + }; + }; + shizukuMermaid = { + src = themeSources.shizuku; + paths = { + bgDark = ""; + bgLight = "ShizukuMermaid/ShizukuBackground-300.png"; + status = "ShizukuMermaid"; + }; + }; + shizukuMiko = { + src = themeSources.shizuku; + paths = { + bgDark = "ShizukuMikoNight/ShizukuBackground-300.png"; + bgLight = "ShizukuMiko/ShizukuBackground-300.png"; + status = "ShizukuMiko"; + }; + }; + shizukuOffice = { + src = themeSources.shizuku; + paths = { + bgDark = ""; + bgLight = "ShizukuOffice/ShizukuBackground-300.png"; + status = "Shizuku"; + }; + }; + shizukuSakura = { + src = themeSources.shizuku; + paths = { + bgDark = "ShizukuSakuraNight/ShizukuBackground-300.png"; + bgLight = "ShizukuSakura/ShizukuBackground-300.png"; + status = "ShizukuSakura"; + }; + }; + shizukuTaishoRoman = { + src = themeSources.shizuku; + paths = { + bgDark = ""; + bgLight = "ShizukuTaishoRoman/ShizukuBackground-300.png"; + status = "ShizukuTaishoRoman"; + }; + }; + shizukuTeaBreak = { + src = themeSources.shizuku; + paths = { + bgDark = ""; + bgLight = "ShizukuTeaBreak/ShizukuBackground-300.png"; + status = "Shizuku"; + }; + rightCharacter = true; + }; + shizukuWebRadio = { + src = themeSources.shizuku; + paths = { + bgDark = ""; + bgLight = "ShizukuWebRadio/ShizukuBackground-300.png"; + status = "ShizukuWebRadio"; + }; + }; + shizukuWinterLamp = { + src = themeSources.shizuku; + paths = { + bgDark = ""; + bgLight = "ShizukuWinterLamp/ShizukuBackground-300.png"; + status = "ShizukuWinterLamp"; + }; + }; +}