diff --git a/pkgs/by-name/qd/qdiskinfo/package.nix b/pkgs/by-name/qd/qdiskinfo/package.nix index 736a6e09c1b2..907d5c087362 100644 --- a/pkgs/by-name/qd/qdiskinfo/package.nix +++ b/pkgs/by-name/qd/qdiskinfo/package.nix @@ -3,10 +3,39 @@ stdenv, smartmontools, fetchFromGitHub, + fetchzip, cmake, qt6, + theme ? "", + customBgDark ? "", + customBgLight ? "", + customStatusPath ? "", + customSrc ? "", + customRightCharacter ? false, }: +let + isTheme = theme != null && theme != ""; + + rightCharacter = + (builtins.elem theme [ + "aoi" + "shizukuTeaBreak" + ]) + || customRightCharacter; + themeSources = import ./sources.nix { inherit fetchzip; }; + themes = import ./themes.nix { + inherit + customBgDark + customBgLight + customSrc + customStatusPath + lib + themeSources + ; + }; +in +assert !isTheme || lib.attrsets.hasAttrByPath [ theme ] themes; stdenv.mkDerivation (finalAttrs: { pname = "qdiskinfo"; version = "0.3"; @@ -31,10 +60,32 @@ stdenv.mkDerivation (finalAttrs: { cmakeBuildType = "MinSizeRel"; - cmakeFlags = [ - "-DQT_VERSION_MAJOR=6" - ]; + cmakeFlags = + [ + "-DQT_VERSION_MAJOR=6" + ] + ++ lib.optionals isTheme [ "-DINCLUDE_OPTIONAL_RESOURCES=ON" ] + ++ (if rightCharacter then [ "-DCHARACTER_IS_RIGHT=ON" ] else [ "-DCHARACTER_IS_RIGHT=OFF" ]); + postUnpack = '' + cp -r $sourceRoot $TMPDIR/src + sourceRoot=$TMPDIR/src + ''; + patchPhase = lib.optionalString isTheme '' + export SRCPATH=${themes."${theme}".src}/CdiResource/themes/ + export DESTPATH=$sourceRoot/dist/theme/ + mkdir -p $DESTPATH + if [ -n "${themes."${theme}".paths.bgDark}" ]; then + cp $SRCPATH/${themes."${theme}".paths.bgDark} $DESTPATH/bg_dark.png + fi + if [ -n "${themes."${theme}".paths.bgLight}" ]; then + cp $SRCPATH/${themes."${theme}".paths.bgLight} $DESTPATH/bg_light.png + fi + cp $SRCPATH/${themes."${theme}".paths.status}/SDdiskStatusBad-300.png $DESTPATH/bad.png + cp $SRCPATH/${themes."${theme}".paths.status}/SDdiskStatusCaution-300.png $DESTPATH/caution.png + cp $SRCPATH/${themes."${theme}".paths.status}/SDdiskStatusGood-300.png $DESTPATH/good.png + cp $SRCPATH/${themes."${theme}".paths.status}/SDdiskStatusUnknown-300.png $DESTPATH/unknown.png + ''; postInstall = '' wrapProgram $out/bin/QDiskInfo \ --suffix PATH : ${smartmontools}/bin 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..6cec442206d0 --- /dev/null +++ b/pkgs/by-name/qd/qdiskinfo/themes.nix @@ -0,0 +1,403 @@ +{ + customBgDark, + customBgLight, + customSrc, + customStatusPath, + lib, + themeSources, +}: + +{ + aoi = { + src = themeSources.aoi; + paths = { + bgDark = "AoiNight/AoiBackground-300.png"; + bgLight = "Aoi/AoiBackground-300.png"; + status = "Aoi"; + }; + }; + custom = { + src = themeSources."${customSrc}"; + paths = { + bgDark = customBgDark; + bgLight = customBgLight; + status = customStatusPath; + }; + }; + 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"; + }; + }; + 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"; + }; + }; +}