stylix: remove `cfg.enable` from `mkEnableTarget` default
The individual modules are already gated by stylix.enable, so there is no need for it to also affect the value of stylix.targets.«name».enable.
This should not produce any noticeable change in behavior.
Note: I have not tested this yet.
That's unusual. Could be caused by some of the recent changes, but I suspect it's not this one. Can you share your config?
Hey I would like to comment that removing the target toggles would cause regressions for edge-case uses such as those in my own NixOS configuration:
- For Tmux, I use the dracula plugin because I like that it has powerline support and has preconfigured status line that I can control what status is displayed for Tmux. If I had the stylix tmux version enabled, it actually conflicts with the Dracula plugin (it completely overrides it actually!).
- For KDE (Plasma 6 specifically), I still have the KDE target on but I actually manually configure KDE with plasma-manager, since Stylix hasn't been updated to be more compatible with Plasma 6 yet (i.e. the Look and Feel module is still broken).
Having these toggles make it easier for me to fine tune what exactly I want to use; especially since there's currently no way to change the smaller details of how stylix applies colors (basically what PR #270 proposes with having 'swatches' for different applications).
I think you've misunderstood the change here - the individual target enable options won't be removed.
Instead, it's just removing the behaviour where the default for each individual enable option changes to false when stylix.enable is false. We already say that "stylix will do nothing unless stylix.enable is true", and that will still be the case, so the default swapping just adds extra confusion for no real benefit.
I think you've misunderstood the change here - the individual target enable options won't be removed.
Instead, it's just removing the behaviour where the default for each individual enable option changes to
falsewhenstylix.enableisfalse. We already say that "stylix will do nothing unlessstylix.enableistrue", and that will still be the case, so the default swapping just adds extra confusion for no real benefit.
Ah, you're right! I did completely misinterpret the change. Thank you for the clarification! 😅
Could be caused by some of the recent changes, but I suspect it's not this one.
Can you share your config?
My standalone Home Manager setup 3 is fairly complex.
The relevant minimal working example is:
nix build .#checks.x86_64-linux.standalone-homeManager-programs-mpv-enable-false
The minimal working example (MWE) is generated based on my MPV module 1, which imports my Stylix module 2. In this MWE, all .enable options are set to false.
Upon applying the following patch, the previous MWE fails:
From e3b838a88fe463828de19c7a22eb1a7823a0d1ee Mon Sep 17 00:00:00 2001
From: NAHO <[email protected]>
Date: Tue, 11 Jun 2024 01:27:43 +0200
Subject: [PATCH] chore!: 2024-06-11 01:27:43 +0200
---
flake.lock | 7 ++++---
flake.nix | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/flake.lock b/flake.lock
index ad971932..0ef77b0e 100644
--- a/flake.lock
+++ b/flake.lock
@@ -548,15 +548,16 @@
]
},
"locked": {
- "lastModified": 1718013167,
- "narHash": "sha256-L+IzjhovTTqOzqLXjrfGFsDPVuCLWZTah+rt7wRkGJ8=",
+ "lastModified": 1718047991,
+ "narHash": "sha256-S/6sxMs6aWlHqveNRTyQq4sQEMICtmmem61P0Vq2Lfo=",
"owner": "danth",
"repo": "stylix",
- "rev": "7682713f6af1d32a33f8c4e3d3d141af5ad1761a",
+ "rev": "11166aa5a2b92437f03cf0b57fd51ef490dee635",
"type": "github"
},
"original": {
"owner": "danth",
+ "ref": "remove-default-cfg-enable",
"repo": "stylix",
"type": "github"
}
diff --git a/flake.nix b/flake.nix
index c83e2c25..4a8f1519 100644
--- a/flake.nix
+++ b/flake.nix
@@ -89,7 +89,7 @@
nixpkgs.follows = "nixpkgs";
};
- url = "github:danth/stylix";
+ url = "github:danth/stylix/remove-default-cfg-enable";
};
# This input ensures consistent versioning across inputs.
--
2.44.0
Note that the following complementary MWE, setting all .enable options to true, still succeeds before and after the previously mentioned patch:
nix build .#checks.x86_64-linux.standalone-homeManager-programs-mpv-enable-true
Unless you see what the problem is, I can try to build a simple static MWE that does not rely on my complex generation process.
Also, the GitHub Actions currently fail due to timeout. Everything works as expected.
That's unusual.
I suspect the problem stems from the fact that something is not properly guarded. Either on my end or in Stylix.
Unless you see what the problem is, I can try to build a simple static MWE that does not rely on my complex generation process.
Potentially related: https://github.com/danth/stylix/issues/421
what is the status of this PR?
It seems there was an issue with some modules not being guarded properly with stylix.enable && stylix.targets.«target».enable rather than just stylix.targets.«target».enable. This may or may not have been fixed in the meantime.
Note that this PR may also cause changes in behaviour for anyone who uses the value of a stylix.targets.«target».enable option to affect something in their own code, unless they are guarding it against both options, as above.
@trueNAHO could you test this again now that it's been updated to the latest code?
@trueNAHO could you test this again now that it's been updated to the latest code?
My
nix build .#checks.x86_64-linux.standalone-inputs-home-manager-programs-mpv-enable-false
MPV test still fails, but this time with another error:
error:
… while calling the 'derivationStrict' builtin
at <nix/derivation-internal.nix>:34:12:
33|
34| strict = derivationStrict drvAttrs;
| ^
35|
… while evaluating derivation 'home-manager-generation'
whose name attribute is located at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/pkgs/stdenv/generic/make-derivation.nix:375:7
… while evaluating attribute 'buildCommand' of derivation 'home-manager-generation'
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/pkgs/build-support/trivial-builders/default.nix:63:17:
62| enableParallelBuilding = true;
63| inherit buildCommand name;
| ^
64| passAsFile = [ "buildCommand" ]
… while evaluating the option `home.file.".themes/adw-gtk3".source':
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: cannot coerce null to a string: null
The same error appears in my LibreWolf module:
nix build .#checks.x86_64-linux.standalone-inputs-home-manager-programs-librewolf-enable-false
For reference, this test creates a minimal standalone Home Manager configuration that imports my LibreWolf module while disabling all enable options.
Here are my related (unedited) modules:
-
# /modules/inputs/home-manager/programs/librewolf/default.nix { config, inputs, lib, ... }: { imports = ["${inputs.self}/modules/inputs/stylix"]; options.dotfiles.inputs.home-manager.programs.librewolf.enable = lib.dotfiles.mkEnableOption; config = lib.mkIf config.dotfiles.inputs.home-manager.programs.librewolf.enable ( lib.mkMerge [ ( let # The profile name of the firefox derivatives is a leaky # encapsulation as mentioned in [1]. # # [1]: https://github.com/danth/stylix/pull/702#issuecomment-2569747876 profile = "stylix"; in { dotfiles.inputs.stylix.enable = true; programs.librewolf.profiles.${profile} = { extensions.force = true; name = profile; }; stylix.targets.librewolf = { colorTheme.enable = true; firefoxGnomeTheme.enable = true; profileNames = [profile]; }; } ) {programs.librewolf.enable = true;} ] ); } -
# /modules/inputs/stylix/default.nix { config, inputs, lib, pkgs, ... }: { imports = [inputs.stylix.homeManagerModules.stylix]; options.dotfiles.inputs.stylix.enable = lib.dotfiles.mkEnableOption; config = lib.mkIf config.dotfiles.inputs.stylix.enable { home.activation = lib.dotfiles.home.activation.systemRequirement "dotfiles.inputs.stylix" "programs.dconf.enable = true;" null; stylix = { cursor = { name = "Bibata-Modern-Amber"; package = pkgs.bibata-cursors; size = 22; }; enable = true; fonts = { emoji = { package = pkgs.noto-fonts-emoji; name = "Noto Color Emoji"; }; monospace = { package = pkgs.nerd-fonts.fira-code; name = "FiraCodeNerdFont"; }; sansSerif = { package = pkgs.ibm-plex; name = "IBMPlexSans"; }; serif = { package = pkgs.crimson; name = "Crimson"; }; sizes.terminal = 7; }; image = pkgs.fetchurl { url = "https://www.pixelstalk.net/wp-content/uploads/2016/05/Epic-Anime-Awesome-Wallpapers.jpg"; sha256 = "enQo3wqhgf0FEPHj2coOCvo7DuZv+x5rL/WIo4qPI50="; }; polarity = "dark"; # TODO: Remove this override, which is necessary since commit [1] ("qt: # autoenable hm module only on NixOS (#942)"), once [2] ("qt: puts NixOS # systemd on non-NixOS distro path") is resolved. # # [1]: https://github.com/danth/stylix/commit/2c20aed3b39a87b8ab7c0d1fef44987f8a69b2d3 # [2]: https://github.com/danth/stylix/issues/933 targets.qt.enable = true; }; }; }
Since my failing tests disable their modules, they should simplify to the following:
-
# /modules/inputs/home-manager/programs/librewolf/default.nix { inputs, lib, ...}: { imports = ["${inputs.self}/modules/inputs/stylix"]; options.dotfiles.inputs.home-manager.programs.librewolf.enable = lib.dotfiles.mkEnableOption; config = lib.mkIf false {}; } -
# /modules/inputs/stylix/default.nix { inputs, lib, ... }: { imports = [inputs.stylix.homeManagerModules.stylix]; options.dotfiles.inputs.stylix.enable = lib.dotfiles.mkEnableOption; config = lib.mkIf false {}; }
In that case, the problem seems to be caused by merely importing Stylix itself:
imports = [inputs.stylix.homeManagerModules.stylix];
Importing Stylix itself and enabling it, resolves the error. However, forcefully enabling Stylix is obviously not the intended behaviour.
It is possible, that this is some bug in my setup. But without further debugging, I will just blindly assume that this is a Stylix issue, since everything works fine before this PR :)
For reference, here are the full error logs:
error:
… while calling the 'derivationStrict' builtin
at <nix/derivation-internal.nix>:34:12:
33|
34| strict = derivationStrict drvAttrs;
| ^
35|
… while evaluating derivation 'home-manager-generation'
whose name attribute is located at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/pkgs/stdenv/generic/make-derivation.nix:375:7
… while evaluating attribute 'buildCommand' of derivation 'home-manager-generation'
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/pkgs/build-support/trivial-builders/default.nix:63:17:
62| enableParallelBuilding = true;
63| inherit buildCommand name;
| ^
64| passAsFile = [ "buildCommand" ]
… while calling the 'getAttr' builtin
at <nix/derivation-internal.nix>:44:19:
43| value = commonAttrs // {
44| outPath = builtins.getAttr outputName strict;
| ^
45| drvPath = strict.drvPath;
… while calling the 'derivationStrict' builtin
at <nix/derivation-internal.nix>:34:12:
33|
34| strict = derivationStrict drvAttrs;
| ^
35|
… while evaluating derivation 'home-manager-files'
whose name attribute is located at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/pkgs/stdenv/generic/make-derivation.nix:375:7
… while evaluating attribute 'buildCommand' of derivation 'home-manager-files'
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/pkgs/build-support/trivial-builders/default.nix:63:17:
62| enableParallelBuilding = true;
63| inherit buildCommand name;
| ^
64| passAsFile = [ "buildCommand" ]
… while calling the 'concatStringsSep' builtin
at /nix/store/h90slbsn95vmjcbh1cp1cxlprnd2dblh-source/modules/files.nix:325:12:
324| }
325| '' + lib.concatStrings (
| ^
326| lib.mapAttrsToList (n: v: ''
… while calling anonymous lambda
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/attrsets.nix:1095:10:
1094| attrs:
1095| map (name: f name attrs.${name}) (attrNames attrs);
| ^
1096|
… from call site
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/attrsets.nix:1095:16:
1094| attrs:
1095| map (name: f name attrs.${name}) (attrNames attrs);
| ^
1096|
… while calling anonymous lambda
at /nix/store/h90slbsn95vmjcbh1cp1cxlprnd2dblh-source/modules/files.nix:326:32:
325| '' + lib.concatStrings (
326| lib.mapAttrsToList (n: v: ''
| ^
327| insertFile ${
… from call site
at /nix/store/h90slbsn95vmjcbh1cp1cxlprnd2dblh-source/modules/files.nix:328:13:
327| insertFile ${
328| lib.escapeShellArgs [
| ^
329| (sourceStorePath v)
… while calling 'concatMapStringsSep'
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/strings.nix:232:5:
231| f:
232| list: concatStringsSep sep (map f list);
| ^
233|
… while calling the 'concatStringsSep' builtin
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/strings.nix:232:11:
231| f:
232| list: concatStringsSep sep (map f list);
| ^
233|
… while calling 'escapeShellArg'
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/strings.nix:1093:20:
1092| */
1093| escapeShellArg = arg:
| ^
1094| let
… while evaluating a branch condition
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/strings.nix:1097:7:
1096| in
1097| if match "[[:alnum:],._+:@%/-]+" string == null
| ^
1098| then "'${replaceStrings ["'"] ["'\\''"] string}'"
… while calling the 'match' builtin
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/strings.nix:1097:10:
1096| in
1097| if match "[[:alnum:],._+:@%/-]+" string == null
| ^
1098| then "'${replaceStrings ["'"] ["'\\''"] string}'"
… while evaluating the second argument passed to builtins.match
… while calling the 'toString' builtin
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/strings.nix:1095:16:
1094| let
1095| string = toString arg;
| ^
1096| in
… from call site
at /nix/store/h90slbsn95vmjcbh1cp1cxlprnd2dblh-source/modules/files.nix:329:16:
328| lib.escapeShellArgs [
329| (sourceStorePath v)
| ^
330| v.target
… while calling 'sourceStorePath'
at /nix/store/h90slbsn95vmjcbh1cp1cxlprnd2dblh-source/modules/files.nix:13:21:
12|
13| sourceStorePath = file:
| ^
14| let
… while evaluating a branch condition
at /nix/store/h90slbsn95vmjcbh1cp1cxlprnd2dblh-source/modules/files.nix:18:7:
17| in
18| if builtins.hasContext sourcePath
| ^
19| then file.source
… while calling the 'hasContext' builtin
at /nix/store/h90slbsn95vmjcbh1cp1cxlprnd2dblh-source/modules/files.nix:18:10:
17| in
18| if builtins.hasContext sourcePath
| ^
19| then file.source
… while evaluating the argument passed to builtins.hasContext
… while calling the 'toString' builtin
at /nix/store/h90slbsn95vmjcbh1cp1cxlprnd2dblh-source/modules/files.nix:15:20:
14| let
15| sourcePath = toString file.source;
| ^
16| sourceName = config.lib.strings.storeFileName (baseNameOf sourcePath);
… from call site
at /nix/store/h90slbsn95vmjcbh1cp1cxlprnd2dblh-source/modules/files.nix:15:29:
14| let
15| sourcePath = toString file.source;
| ^
16| sourceName = config.lib.strings.storeFileName (baseNameOf sourcePath);
… while calling anonymous lambda
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/attrsets.nix:1204:18:
1203| mapAttrs
1204| (name: value:
| ^
1205| if isAttrs value && cond value
… from call site
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/attrsets.nix:1207:18:
1206| then recurse (path ++ [ name ]) value
1207| else f (path ++ [ name ]) value);
| ^
1208| in
… while calling anonymous lambda
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/modules.nix:256:72:
255| # For definitions that have an associated option
256| declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
| ^
257|
… while evaluating the attribute 'value'
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/modules.nix:927:9:
926| in warnDeprecation opt //
927| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
928| inherit (res.defsFinal') highestPrio;
… while evaluating the option `home.file.".themes/adw-gtk3".source':
… while evaluating the attribute 'mergedValue'
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/modules.nix:962:5:
961| # Type-check the remaining definitions, and merge them. Or throw if no definitions.
962| mergedValue =
| ^
963| if isDefined then
… while evaluating a branch condition
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/modules.nix:964:9:
963| if isDefined then
964| if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
| ^
965| else let allInvalid = filter (def: ! type.check def.value) defsFinal;
… while calling the 'all' builtin
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/modules.nix:964:12:
963| if isDefined then
964| if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
| ^
965| else let allInvalid = filter (def: ! type.check def.value) defsFinal;
… while calling anonymous lambda
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/modules.nix:964:17:
963| if isDefined then
964| if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
| ^
965| else let allInvalid = filter (def: ! type.check def.value) defsFinal;
… from call site
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/modules.nix:964:22:
963| if isDefined then
964| if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
| ^
965| else let allInvalid = filter (def: ! type.check def.value) defsFinal;
… while calling 'check'
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/types.nix:606:17:
605|
606| check = x:
| ^
607| let
… in the right operand of the AND (&&) operator
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/types.nix:617:73:
616| in
617| isExpectedType && (inStore == null || inStore == isInStore) && (absolute == null || absolute == isAbsolute);
| ^
618| };
… in the right operand of the OR (||) operator
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/types.nix:617:94:
616| in
617| isExpectedType && (inStore == null || inStore == isInStore) && (absolute == null || absolute == isAbsolute);
| ^
618| };
… while calling the 'substring' builtin
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/types.nix:609:26:
608| isInStore = builtins.match "${builtins.storeDir}/[^.].*" (toString x) != null;
609| isAbsolute = builtins.substring 0 1 (toString x) == "/";
| ^
610| isExpectedType = (
… while calling the 'toString' builtin
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/types.nix:609:50:
608| isInStore = builtins.match "${builtins.storeDir}/[^.].*" (toString x) != null;
609| isAbsolute = builtins.substring 0 1 (toString x) == "/";
| ^
610| isExpectedType = (
… while calling the 'getAttr' builtin
at <nix/derivation-internal.nix>:44:19:
43| value = commonAttrs // {
44| outPath = builtins.getAttr outputName strict;
| ^
45| drvPath = strict.drvPath;
… while calling the 'derivationStrict' builtin
at <nix/derivation-internal.nix>:34:12:
33|
34| strict = derivationStrict drvAttrs;
| ^
35|
… while evaluating derivation 'flattenedGtkTheme'
whose name attribute is located at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/pkgs/stdenv/generic/make-derivation.nix:375:7
… while evaluating attribute 'installPhase' of derivation 'flattenedGtkTheme'
at /nix/store/49vbxq3y7l96lc2w2ks8y5x5zvqm71pk-source/modules/gtk/hm.nix:73:19:
72|
73| installPhase = ''
| ^
74| cp --recursive . $out
… while calling the 'getAttr' builtin
at <nix/derivation-internal.nix>:44:19:
43| value = commonAttrs // {
44| outPath = builtins.getAttr outputName strict;
| ^
45| drvPath = strict.drvPath;
… while calling the 'derivationStrict' builtin
at <nix/derivation-internal.nix>:34:12:
33|
34| strict = derivationStrict drvAttrs;
| ^
35|
… while evaluating derivation 'gtk.css'
whose name attribute is located at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/pkgs/stdenv/generic/make-derivation.nix:375:7
… while evaluating attribute 'buildCommand' of derivation 'gtk.css'
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/pkgs/build-support/trivial-builders/default.nix:63:17:
62| enableParallelBuilding = true;
63| inherit buildCommand name;
| ^
64| passAsFile = [ "buildCommand" ]
… while evaluating the attribute 'lib.stylix.colors'
at /nix/store/49vbxq3y7l96lc2w2ks8y5x5zvqm71pk-source/stylix/palette.nix:167:5:
166| # https://github.com/SenchoPens/base16.nix/blob/b390e87cd404e65ab4d786666351f1292e89162a/README.md#theme-step-22
167| lib.stylix.colors = (cfg.base16.mkSchemeAttrs cfg.base16Scheme).override cfg.override;
| ^
168|
… from call site
at /nix/store/49vbxq3y7l96lc2w2ks8y5x5zvqm71pk-source/stylix/palette.nix:167:26:
166| # https://github.com/SenchoPens/base16.nix/blob/b390e87cd404e65ab4d786666351f1292e89162a/README.md#theme-step-22
167| lib.stylix.colors = (cfg.base16.mkSchemeAttrs cfg.base16Scheme).override cfg.override;
| ^
168|
… while calling 'mkSchemeAttrs'
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/mk-scheme-attrs.nix:110:5:
109| # (see https://github.com/base16-project/home/blob/main/builder.md#schemes-repository).
110| scheme:
| ^
111| let
… in the left operand of the update (//) operator
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/mk-scheme-attrs.nix:121:24:
120| populatedColors = colors inputAttrs;
121| in populatedColors // allMeta // {
| ^
122| withHashtag = populatedColors.withHashtag // allMeta;
… from call site
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/mk-scheme-attrs.nix:120:25:
119| allMeta = inputMeta // builderMeta // coercionMeta // checkMeta // overrideMeta;
120| populatedColors = colors inputAttrs;
| ^
121| in populatedColors // allMeta // {
… while calling 'colors'
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/colors.nix:62:12:
61| */
62| colors = scheme:
| ^
63| let
… in the left operand of the update (//) operator
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/colors.nix:123:14:
122|
123| in based // { inherit toList withHashtag; };
| ^
124|
… in the left operand of the update (//) operator
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/colors.nix:113:24:
112|
113| based = base-hex // base-hex-rgb // base-rgb-rgb
| ^
114| // base-dec-rgb // base-hex-bgr // base-short
… from call site
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/colors.nix:89:18:
88|
89| base-hex = lib.mapAttrs' (k: v: lib.nameValuePair "${k}-hex" v) base;
| ^
90| base-short = lib.mapAttrs' (k: v: lib.nameValuePair "${k}" v) base;
… while calling 'mapAttrs''
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/attrsets.nix:1056:5:
1055| f:
1056| set:
| ^
1057| listToAttrs (map (attr: f attr set.${attr}) (attrNames set));
… while calling the 'listToAttrs' builtin
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/attrsets.nix:1057:5:
1056| set:
1057| listToAttrs (map (attr: f attr set.${attr}) (attrNames set));
| ^
1058|
… while calling the 'map' builtin
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/attrsets.nix:1057:18:
1056| set:
1057| listToAttrs (map (attr: f attr set.${attr}) (attrNames set));
| ^
1058|
… while calling the 'attrNames' builtin
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/attrsets.nix:1057:50:
1056| set:
1057| listToAttrs (map (attr: f attr set.${attr}) (attrNames set));
| ^
1058|
… from call site
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/colors.nix:65:15:
64| # normalize-colors will already be checked or is not in danger anyhow
65| base = (normalize-colors "" scheme).value;
| ^
66| # define local helper functions:
… while calling 'normalize-colors'
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:70:31:
69| */
70| normalize-colors = err-msg: raw:
| ^
71| let
… while calling a functor (an attribute set with a '__functor' attribute)
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:74:8:
73| check-color = color: builtins.isString color && builtins.stringLength (lib.removePrefix "#" color) == 6;
74| in success-monad baseXXs {
| ^
75| f = baseXXs:
… from call site
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:7:9:
6| inherit success value;
7| __functor = self: { f, err-msg ? "" }:
| ^
8| let
… while calling '__functor'
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:7:27:
6| inherit success value;
7| __functor = self: { f, err-msg ? "" }:
| ^
8| let
… from call site
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:14:14:
13| else trace-err { success = false; inherit (self) value; };
14| in res new;
| ^
15| };
… while evaluating a branch condition
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:12:19:
11| trace-err = if err-msg == "" then (x: x) else builtins.trace err-msg;
12| new = if evaled'.success then evaled'
| ^
13| else trace-err { success = false; inherit (self) value; };
… while evaluating the attribute 'success'
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:79:11:
78| in {
79| success = builtins.length are-colors >= 1 && builtins.all (x: x) are-colors;
| ^
80| value = builtins.mapAttrs (_: value: lib.toLower (lib.removePrefix "#" value)) baseXXs;
… in the left operand of the AND (&&) operator
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:79:53:
78| in {
79| success = builtins.length are-colors >= 1 && builtins.all (x: x) are-colors;
| ^
80| value = builtins.mapAttrs (_: value: lib.toLower (lib.removePrefix "#" value)) baseXXs;
… in the argument of the not operator
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:79:48:
78| in {
79| success = builtins.length are-colors >= 1 && builtins.all (x: x) are-colors;
| ^
80| value = builtins.mapAttrs (_: value: lib.toLower (lib.removePrefix "#" value)) baseXXs;
… while calling the 'lessThan' builtin
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:79:48:
78| in {
79| success = builtins.length are-colors >= 1 && builtins.all (x: x) are-colors;
| ^
80| value = builtins.mapAttrs (_: value: lib.toLower (lib.removePrefix "#" value)) baseXXs;
… while calling the 'length' builtin
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:79:21:
78| in {
79| success = builtins.length are-colors >= 1 && builtins.all (x: x) are-colors;
| ^
80| value = builtins.mapAttrs (_: value: lib.toLower (lib.removePrefix "#" value)) baseXXs;
… while calling the 'attrValues' builtin
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:77:24:
76| let
77| are-colors = builtins.attrValues (builtins.mapAttrs (_: check-color) baseXXs);
| ^
78| in {
… while calling the 'mapAttrs' builtin
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:77:45:
76| let
77| are-colors = builtins.attrValues (builtins.mapAttrs (_: check-color) baseXXs);
| ^
78| in {
… from call site
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:72:17:
71| let
72| baseXXs = lib.filterAttrs (name: _: lib.hasPrefix "base" name && builtins.stringLength name == 6) raw;
| ^
73| check-color = color: builtins.isString color && builtins.stringLength (lib.removePrefix "#" color) == 6;
… while calling 'filterAttrs'
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/attrsets.nix:646:5:
645| pred:
646| set:
| ^
647| removeAttrs set (filter (name: ! pred name set.${name}) (attrNames set));
… while calling the 'removeAttrs' builtin
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/attrsets.nix:647:5:
646| set:
647| removeAttrs set (filter (name: ! pred name set.${name}) (attrNames set));
| ^
648|
… from call site
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/mk-scheme-attrs.nix:113:20:
112| inherit (yaml-scheme2attrs scheme) parsedInput check;
113| inputAttrs = mkBase24 parsedInput;
| ^
114| inputMeta = input-meta inputAttrs;
… while calling 'mkBase24'
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/colors.nix:25:14:
24| */
25| mkBase24 = scheme: scheme // {
| ^
26| base10 = scheme.base10 or scheme.base00;
… in the left operand of the update (//) operator
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/colors.nix:25:29:
24| */
25| mkBase24 = scheme: scheme // {
| ^
26| base10 = scheme.base10 or scheme.base00;
… while evaluating the attribute 'parsedInput'
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/mk-scheme-attrs.nix:47:24:
46| parsedInput = if is-not-parsed then parsedInput' else { inherit (parsed) slug; } // parsedInput';
47| in { inherit check parsedInput; };
| ^
48|
… in the right operand of the update (//) operator
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/mk-scheme-attrs.nix:46:88:
45| else pkgs.emptyDirectory;
46| parsedInput = if is-not-parsed then parsedInput' else { inherit (parsed) slug; } // parsedInput';
| ^
47| in { inherit check parsedInput; };
… while evaluating a branch condition
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/mk-scheme-attrs.nix:35:12:
34| checked = normalize-colors msg.scheme-check-failed unchecked;
35| in if checked.success then unchecked else throw ''
| ^
36| ${msg.bad-mkSchemeAttrs-input}
… from call site
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/mk-scheme-attrs.nix:34:21:
33| unchecked = convert-scheme-to-common-format raw;
34| checked = normalize-colors msg.scheme-check-failed unchecked;
| ^
35| in if checked.success then unchecked else throw ''
(16 duplicate frames omitted)
… from call site
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/mk-scheme-attrs.nix:33:23:
32| raw = if is-not-parsed then scheme else parsed.scheme;
33| unchecked = convert-scheme-to-common-format raw;
| ^
34| checked = normalize-colors msg.scheme-check-failed unchecked;
… while calling 'convert-scheme-to-common-format'
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:57:37:
56| */
57| convert-scheme-to-common-format = raw:
| ^
58| (raw.palette or {})
… in the left operand of the update (//) operator
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:59:5:
58| (raw.palette or {})
59| // {
| ^
60| scheme = raw.name or "untitled";
… while evaluating the attribute 'scheme'
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/mk-scheme-attrs.nix:14:5:
13| ));
14| scheme = yaml2attrs yaml2attrs-args;
| ^
15| };
… from call site
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/mk-scheme-attrs.nix:14:14:
13| ));
14| scheme = yaml2attrs yaml2attrs-args;
| ^
15| };
… while calling 'yaml2attrs'
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:87:16:
86| */
87| yaml2attrs = {
| ^
88| # The file to parse.
… while evaluating a branch condition
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:104:9:
103| else if use-ifd == "never" then
104| if (check without-ifd).success then without-ifd
| ^
105| else builtins.trace msg.no-ifd-failed without-ifd
… from call site
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:104:13:
103| else if use-ifd == "never" then
104| if (check without-ifd).success then without-ifd
| ^
105| else builtins.trace msg.no-ifd-failed without-ifd
… while calling anonymous lambda
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:96:14:
95| # The default checks as if we are trying to parse a scheme.
96| check ? (raw: normalize-colors msg.scheme-check-failed (convert-scheme-to-common-format raw)),
| ^
97| }:
… from call site
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:96:19:
95| # The default checks as if we are trying to parse a scheme.
96| check ? (raw: normalize-colors msg.scheme-check-failed (convert-scheme-to-common-format raw)),
| ^
97| }:
(16 duplicate frames omitted)
… from call site
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:96:61:
95| # The default checks as if we are trying to parse a scheme.
96| check ? (raw: normalize-colors msg.scheme-check-failed (convert-scheme-to-common-format raw)),
| ^
97| }:
… while calling 'convert-scheme-to-common-format'
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:57:37:
56| */
57| convert-scheme-to-common-format = raw:
| ^
58| (raw.palette or {})
… in the left operand of the update (//) operator
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:59:5:
58| (raw.palette or {})
59| // {
| ^
60| scheme = raw.name or "untitled";
… from call site
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:99:21:
98| let
99| without-ifd = fromYaml (builtins.readFile yaml);
| ^
100| with-ifd = builtins.fromJSON (builtins.readFile (yaml2json yaml));
… while calling 'parse'
at /nix/store/kbjvsxnz3w9j29m2lmxv6psbcgn4mkdr-source/fromYaml.nix:34:11:
33|
34| parse = text: let
| ^
35| lines = l.splitString "\n" text;
… from call site
at /nix/store/kbjvsxnz3w9j29m2lmxv6psbcgn4mkdr-source/fromYaml.nix:182:5:
181| in
182| make filtered (-1);
| ^
183| in
… while calling 'make'
at /nix/store/kbjvsxnz3w9j29m2lmxv6psbcgn4mkdr-source/fromYaml.nix:108:19:
107| */
108| make = lines: i: let
| ^
109| mNext = l.elemAt matched (i + 1);
… from call site
at /nix/store/kbjvsxnz3w9j29m2lmxv6psbcgn4mkdr-source/fromYaml.nix:143:9:
142| childrenMerged =
143| l.foldl
| ^
144| (all: cObj: (
… while calling 'foldl'
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/lists.nix:179:20:
178| */
179| foldl = op: nul: list:
| ^
180| let
… from call site
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/lists.nix:185:8:
184| else op (foldl' (n - 1)) (elemAt list n);
185| in foldl' (length list - 1);
| ^
186|
… while calling 'foldl''
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/lists.nix:181:16:
180| let
181| foldl' = n:
| ^
182| if n == -1
… while evaluating a branch condition
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/lists.nix:182:9:
181| foldl' = n:
182| if n == -1
| ^
183| then nul
… while calling the 'sub' builtin
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/lists.nix:185:28:
184| else op (foldl' (n - 1)) (elemAt list n);
185| in foldl' (length list - 1);
| ^
186|
… while calling the 'length' builtin
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/lists.nix:185:16:
184| else op (foldl' (n - 1)) (elemAt list n);
185| in foldl' (length list - 1);
| ^
186|
… while calling the 'map' builtin
at /nix/store/kbjvsxnz3w9j29m2lmxv6psbcgn4mkdr-source/fromYaml.nix:138:9:
137| childObjects =
138| l.map
| ^
139| (sIdx: make lines sIdx)
… while evaluating a branch condition
at /nix/store/kbjvsxnz3w9j29m2lmxv6psbcgn4mkdr-source/fromYaml.nix:135:9:
134| childIdxs =
135| if childIndent == null then [] else findChildIdxs (i+1);
| ^
136|
… while evaluating a branch condition
at /nix/store/kbjvsxnz3w9j29m2lmxv6psbcgn4mkdr-source/fromYaml.nix:130:9:
129| childIndent =
130| if mNext.indent > currIndent
| ^
131| then mNext.indent
… while calling the 'lessThan' builtin
at /nix/store/kbjvsxnz3w9j29m2lmxv6psbcgn4mkdr-source/fromYaml.nix:130:25:
129| childIndent =
130| if mNext.indent > currIndent
| ^
131| then mNext.indent
… while calling the 'elemAt' builtin
at /nix/store/kbjvsxnz3w9j29m2lmxv6psbcgn4mkdr-source/fromYaml.nix:109:15:
108| make = lines: i: let
109| mNext = l.elemAt matched (i + 1);
| ^
110| m = l.elemAt matched i;
… while calling the 'map' builtin
at /nix/store/kbjvsxnz3w9j29m2lmxv6psbcgn4mkdr-source/fromYaml.nix:49:15:
48| # extract indent, key, value, isListEntry for each line
49| matched = l.map (line: matchLine line) filtered;
| ^
50|
… while calling the 'filter' builtin
at /nix/store/kbjvsxnz3w9j29m2lmxv6psbcgn4mkdr-source/fromYaml.nix:41:7:
40| filtered =
41| l.filter
| ^
42| (line:
… from call site
at /nix/store/kbjvsxnz3w9j29m2lmxv6psbcgn4mkdr-source/fromYaml.nix:35:13:
34| parse = text: let
35| lines = l.splitString "\n" text;
| ^
36|
… while calling 'splitString'
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/strings.nix:1547:22:
1546| */
1547| splitString = sep: s:
| ^
1548| let
… while calling the 'map' builtin
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/strings.nix:1551:7:
1550| in
1551| map (addContextFrom s) splits;
| ^
1552|
… while calling the 'filter' builtin
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/strings.nix:1549:16:
1548| let
1549| splits = builtins.filter builtins.isString (builtins.split (escapeRegex (toString sep)) (toString s));
| ^
1550| in
… while calling the 'split' builtin
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/strings.nix:1549:51:
1548| let
1549| splits = builtins.filter builtins.isString (builtins.split (escapeRegex (toString sep)) (toString s));
| ^
1550| in
… while evaluating the second argument passed to builtins.split
… while calling the 'toString' builtin
at /nix/store/jk6xpbfh10gz6q5cqw8b2f7xk0pl7hkv-source/lib/strings.nix:1549:96:
1548| let
1549| splits = builtins.filter builtins.isString (builtins.split (escapeRegex (toString sep)) (toString s));
| ^
1550| in
… while calling the 'readFile' builtin
at /nix/store/pncxap12rhn5liciqk7c6farm5gizc1q-source/lib/util.nix:99:31:
98| let
99| without-ifd = fromYaml (builtins.readFile yaml);
| ^
100| with-ifd = builtins.fromJSON (builtins.readFile (yaml2json yaml));
… while realising the context of a path
error: cannot coerce null to a string: null
On a different note, I noticed that the proposal itself has not been discussed yet:
The individual modules are already gated by
stylix.enable, so there is no need for it to also affect the value ofstylix.targets.«name».enable.This should not produce any noticeable change in behavior.
Note: I have not tested this yet.
Following the reasoning from https://github.com/danth/stylix/discussions/1009 to abstract and simplify module declarations, it would be better to replace
config = lib.mkIf (config.stylix.enable && config.stylix.targets."<TARGET>".enable) {
with
config = lib.mkIf config.stylix.targets."<TARGET>".enable {
I have thought about this simplification for a while now, and in fact it would probably fix my standalone test because the
https://github.com/danth/stylix/blob/ce45f19e8acb43e5f02888d873d451e2f994546b/modules/gtk/hm.nix#L41
declaration forgot the config.stylix.enable guard.
Adding the config.stylix.enable guard to every module is a leaky abstraction, introduces boilerplate, and is extremely easy to forget. Consequently, I am in favor of closing this PR and keeping the config.stylix.enable guard in the option declaration. This would also bring us one step closer to resolving https://github.com/danth/stylix/issues/400.