Conversation
|
Merge conflict resolved |
e0112fa to
f7101bd
Compare
|
please rebase rather than merge from master |
f7101bd to
8761a97
Compare
|
Done |
|
This one took me a bit of time to understand, but the moment i renamed The usage pattern thus becomes qdiskinfo.override { themeBundle = qdiskinfo.themeBundles.aoi; }I ran the tests: I'm leaning towards wanting to inline My proposed patchdiff --git a/pkgs/by-name/qd/qdiskinfo/package.nix b/pkgs/by-name/qd/qdiskinfo/package.nix
index 907d5c087362..343503f24082 100644
--- a/pkgs/by-name/qd/qdiskinfo/package.nix
+++ b/pkgs/by-name/qd/qdiskinfo/package.nix
@@ -6,36 +6,28 @@
fetchzip,
cmake,
qt6,
- theme ? "",
- customBgDark ? "",
- customBgLight ? "",
- customStatusPath ? "",
- customSrc ? "",
- customRightCharacter ? false,
+ qdiskinfo,
+ themeBundle ? null,
}:
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
- ;
- };
+ isThemed = themeBundle != null && themeBundle != { };
+ themeBundle' = {
+ rightCharacter = false;
+ } // themeBundle;
in
-assert !isTheme || lib.attrsets.hasAttrByPath [ theme ] themes;
+
+# 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";
@@ -64,33 +56,50 @@ stdenv.mkDerivation (finalAttrs: {
[
"-DQT_VERSION_MAJOR=6"
]
- ++ lib.optionals isTheme [ "-DINCLUDE_OPTIONAL_RESOURCES=ON" ]
- ++ (if rightCharacter then [ "-DCHARACTER_IS_RIGHT=ON" ] else [ "-DCHARACTER_IS_RIGHT=OFF" ]);
+ ++ 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 isTheme ''
- export SRCPATH=${themes."${theme}".src}/CdiResource/themes/
+ patchPhase = lib.optionalString isThemed ''
+ export SRCPATH=${themeBundle'.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
+ if [ -n "${themeBundle'.paths.bgDark}" ]; then
+ cp $SRCPATH/${themeBundle'.paths.bgDark} $DESTPATH/bg_dark.png
fi
- if [ -n "${themes."${theme}".paths.bgLight}" ]; then
- cp $SRCPATH/${themes."${theme}".paths.bgLight} $DESTPATH/bg_light.png
+ if [ -n "${themeBundle'.paths.bgLight}" ]; then
+ cp $SRCPATH/${themeBundle'.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
+ 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/themes.nix b/pkgs/by-name/qd/qdiskinfo/themes.nix
index 6cec442206d0..f02f4ce2887b 100644
--- a/pkgs/by-name/qd/qdiskinfo/themes.nix
+++ b/pkgs/by-name/qd/qdiskinfo/themes.nix
@@ -1,11 +1,4 @@
-{
- customBgDark,
- customBgLight,
- customSrc,
- customStatusPath,
- lib,
- themeSources,
-}:
+{ themeSources }:
{
aoi = {
@@ -15,14 +8,7 @@
bgLight = "Aoi/AoiBackground-300.png";
status = "Aoi";
};
- };
- custom = {
- src = themeSources."${customSrc}";
- paths = {
- bgDark = customBgDark;
- bgLight = customBgLight;
- status = customStatusPath;
- };
+ rightCharacter = true;
};
kureikei = {
src = themeSources.kureikei;
@@ -383,6 +369,7 @@
bgLight = "ShizukuTeaBreak/ShizukuBackground-300.png";
status = "Shizuku";
};
+ rightCharacter = true;
};
shizukuWebRadio = {
src = themeSources.shizuku;How to apply (pick one): a. |
|
Thanks for the help! However, it seems that ofborg does not like the new changes, and the package fails to build. The source of the error appears to be from the definition of "cmakeFlags", but I can't see what the problem is. |
86ed6f1 to
3d2546b
Compare
|
Well, the error no longer occurs. Not sure why it was happening in the first place, but it seems to be working now. Package builds with no issues I can find. |
Description of changes
Adds support for the CrystalDiskInfo themes that QDiskInfo supports.
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.