stylix icon indicating copy to clipboard operation
stylix copied to clipboard

base16Scheme expected a set but found a string error

Open niksingh710 opened this issue 1 year ago • 6 comments

using the config

{ pkgs, config, ... }: {
  stylix = {
    enable = true;
    autoEnable = true;
    # image = ../../wall.png;
    # base16Scheme = "${pkgs.base16-schemes}/share/themes/decaf.yaml";
    image = config.lib.stylix.pixel "base0A";
    base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-latte.yaml";
    polarity = "dark";
    opacity = {
      terminal = 0.8;
      popups = 0.8;
    };
  };
}

throws error for base16Scheme saying

error: expected a set but found a string with context: "/nix/store/n8mxqgc5g4np5whkr8nvkmzz0pfvdaac-base16-schemes-unstable-2024-06-21/share/themes/catppuccin-latte.yaml"

niksingh710 avatar Aug 10 '24 18:08 niksingh710

    base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-latte.yaml";

[...]

throws error for base16Scheme saying

error: expected a set but found a string with context: "/nix/store/n8mxqgc5g4np5whkr8nvkmzz0pfvdaac-base16-schemes-unstable-2024-06-21/share/themes/catppuccin-latte.yaml"

That's weird because the testbeds use the same value:

https://github.com/danth/stylix/blob/5853f1a8bd072f2ebabfc3de3973084353cf6f1e/stylix/testbed.nix#L91

Maybe the base16Scheme type definition is wrong:

https://github.com/danth/stylix/blob/5853f1a8bd072f2ebabfc3de3973084353cf6f1e/stylix/palette.nix#L103-L117

For reference, the documentation uses the following dummy values:

https://github.com/danth/stylix/blob/5853f1a8bd072f2ebabfc3de3973084353cf6f1e/docs/settings.nix#L7-L24

trueNAHO avatar Aug 10 '24 19:08 trueNAHO

base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-latte.yaml"; this returns a yaml string

system: "base16"
name: "Decaf"
author: "Alex Mirrington (https://github.com/alexmirrington)"
variant: "dark"
palette:
  base00: "2d2d2d"
  base01: "393939"
  base02: "515151"
  base03: "777777"
  base04: "b4b7b4"
  base05: "cccccc"
  base06: "e0e0e0"
  base07: "ffffff"
  base08: "ff7f7b"
  base09: "ffbf70"
  base0A: "ffd67c"
  base0B: "beda78"
  base0C: "bed6ff"
  base0D: "90bee1"
  base0E: "efb3f7"
  base0F: "ff93b3"

Either base16Scheme needs to accept this from its type definition, or it should extract the palette and convert it to a nix attribute.

In both the cases, stylix should also change the tips and tricks doc. I guess a simple solution would be yaml -> nix attribute

niksingh710 avatar Aug 10 '24 19:08 niksingh710

@trueNAHO for the mean time the solution m using is

let
      schemeAttr = file:
        (builtins.fromJSON (builtins.readFile (pkgs.runCommand "json" { } ''
          ${lib.getExe pkgs.yj} < "${file}" > $out
        '').outPath)).palette;
    in
		...
        base16Scheme = schemeAttr "${pkgs.base16-schemes}/share/themes/decaf.yaml";
		...

niksingh710 avatar Aug 23 '24 08:08 niksingh710

Cc: @danth

trueNAHO avatar Aug 23 '24 14:08 trueNAHO

https://github.com/Misterio77/nix-colors/blob/b01f024090d2c4fc3152cd0cf12027a7b8453ba1/lib/core/schemeFromYAML.nix#L24

also here is a pure nix fn for the same

niksingh710 avatar Aug 23 '24 15:08 niksingh710

@niksingh710 Hi, please could you build your configuration again with --show-trace and paste the output here? Hopefully that will help us find the source of the error message

danth avatar Aug 23 '24 19:08 danth

fetching path input 'path:/home/niksingh710/flake-bak'
building the system configuration...
fetching path input 'path:/home/niksingh710/flake-bak'
error:
       … while calling anonymous lambda
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:1571:24:
         1570|     let f = attrPath:
         1571|       zipAttrsWith (n: values:
             |                        ^
         1572|         let here = attrPath ++ [n]; in

       … while calling the 'head' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:1575:11:
         1574|         || pred here (elemAt values 1) (head values) then
         1575|           head values
             |           ^
         1576|         else

       … while calling anonymous lambda
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:1205:18:
         1204|         mapAttrs
         1205|           (name: value:
             |                  ^
         1206|             if isAttrs value && cond value

       … from call site
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:1208:18:
         1207|             then recurse (path ++ [ name ]) value
         1208|             else f (path ++ [ name ]) value);
             |                  ^
         1209|     in

       … while calling anonymous lambda
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:254:72:
          253|           # For definitions that have an associated option
          254|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          255|

       … while evaluating the attribute 'value'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:821:9:
          820|     in warnDeprecation opt //
          821|       { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          822|         inherit (res.defsFinal') highestPrio;

       … while calling the 'addErrorContext' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:821:17:
          820|     in warnDeprecation opt //
          821|       { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |                 ^
          822|         inherit (res.defsFinal') highestPrio;

       … while evaluating the option `system.build.toplevel':

       … while evaluating the attribute 'mergedValue'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:856:5:
          855|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
          856|     mergedValue =
             |     ^
          857|       if isDefined then

       … while evaluating a branch condition
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:857:7:
          856|     mergedValue =
          857|       if isDefined then
             |       ^
          858|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal

       … while evaluating the attribute 'values'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:850:9:
          849|       in {
          850|         values = defs''';
             |         ^
          851|         inherit (defs'') highestPrio;

       … while evaluating a branch condition
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:846:11:
          845|           # Avoid sorting if we don't have to.
          846|           if any (def: def.value._type or "" == "order") defs''.values
             |           ^
          847|           then sortProperties defs''.values

       … while calling the 'any' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:846:14:
          845|           # Avoid sorting if we don't have to.
          846|           if any (def: def.value._type or "" == "order") defs''.values
             |              ^
          847|           then sortProperties defs''.values

       … while evaluating the attribute 'values'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:949:7:
          948|     in {
          949|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
             |       ^
          950|       inherit highestPrio;

       … while calling the 'concatMap' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:949:16:
          948|     in {
          949|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
             |                ^
          950|       inherit highestPrio;

       … while calling the 'concatMap' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:836:17:
          835|         # Process mkMerge and mkIf properties.
          836|         defs' = concatMap (m:
             |                 ^
          837|           map (value: { inherit (m) file; inherit value; }) (addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while calling anonymous lambda
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:836:28:
          835|         # Process mkMerge and mkIf properties.
          836|         defs' = concatMap (m:
             |                            ^
          837|           map (value: { inherit (m) file; inherit value; }) (addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while calling the 'map' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:837:11:
          836|         defs' = concatMap (m:
          837|           map (value: { inherit (m) file; inherit value; }) (addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |           ^
          838|         ) defs;

       … while calling the 'addErrorContext' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:837:62:
          836|         defs' = concatMap (m:
          837|           map (value: { inherit (m) file; inherit value; }) (addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                              ^
          838|         ) defs;

       … while evaluating definitions from `/nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/nixos/modules/system/activation/top-level.nix':

       … from call site
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:837:128:
          836|         defs' = concatMap (m:
          837|           map (value: { inherit (m) file; inherit value; }) (addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                ^
          838|         ) defs;

       … while calling 'dischargeProperties'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:908:25:
          907|   */
          908|   dischargeProperties = def:
             |                         ^
          909|     if def._type or "" == "merge" then

       … while evaluating a branch condition
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:909:5:
          908|   dischargeProperties = def:
          909|     if def._type or "" == "merge" then
             |     ^
          910|       concatMap dischargeProperties def.contents

       … while evaluating the attribute 'value'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:619:53:
          618|                 (n: value:
          619|                   [{ inherit (module) file; inherit value; }]
             |                                                     ^
          620|                 )

       … from call site
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/nixos/modules/system/activation/top-level.nix:71:12:
           70|   # Replace runtime dependencies
           71|   system = foldr ({ oldDependency, newDependency }: drv:
             |            ^
           72|       pkgs.replaceDependency { inherit oldDependency newDependency drv; }

       … while calling 'foldr'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/lists.nix:121:20:
          120|   */
          121|   foldr = op: nul: list:
             |                    ^
          122|     let

       … from call site
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/lists.nix:128:8:
          127|         else op (elemAt list n) (fold' (n + 1));
          128|     in fold' 0;
             |        ^
          129|

       … while calling 'fold''
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/lists.nix:124:15:
          123|       len = length list;
          124|       fold' = n:
             |               ^
          125|         if n == len

       … while evaluating a branch condition
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/nixos/modules/system/activation/top-level.nix:66:26:
           65|
           66|   baseSystemAssertWarn = if failedAssertions != []
             |                          ^
           67|     then throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}"

       … while calling the 'map' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/nixos/modules/system/activation/top-level.nix:64:22:
           63|
           64|   failedAssertions = map (x: x.message) (filter (x: !x.assertion) config.assertions);
             |                      ^
           65|

       … while calling the 'filter' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/nixos/modules/system/activation/top-level.nix:64:42:
           63|
           64|   failedAssertions = map (x: x.message) (filter (x: !x.assertion) config.assertions);
             |                                          ^
           65|

       … while calling anonymous lambda
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/nixos/modules/system/activation/top-level.nix:64:50:
           63|
           64|   failedAssertions = map (x: x.message) (filter (x: !x.assertion) config.assertions);
             |                                                  ^
           65|

       … in the argument of the not operator
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/nixos/modules/system/activation/top-level.nix:64:54:
           63|
           64|   failedAssertions = map (x: x.message) (filter (x: !x.assertion) config.assertions);
             |                                                      ^
           65|

       … while evaluating the attribute 'assertion'
         at /nix/store/cllqwnqqr2nci1l1b3fpr9f28vd4arfq-source/nixos/common.nix:112:31:
          111|         flip map config.assertions (assertion: {
          112|           inherit (assertion) assertion;
             |                               ^
          113|           message = "${user} profile: ${assertion.message}";

       … while evaluating the attribute 'assertion'
         at /nix/store/cllqwnqqr2nci1l1b3fpr9f28vd4arfq-source/modules/files.nix:51:9:
           50|       in {
           51|         assertion = dups == [];
             |         ^
           52|         message = ''

       … while calling the 'attrNames' builtin
         at /nix/store/cllqwnqqr2nci1l1b3fpr9f28vd4arfq-source/modules/files.nix:45:11:
           44|         dups =
           45|           attrNames
             |           ^
           46|             (filterAttrs (n: v: v > 1)

       … from call site
         at /nix/store/cllqwnqqr2nci1l1b3fpr9f28vd4arfq-source/modules/files.nix:46:14:
           45|           attrNames
           46|             (filterAttrs (n: v: v > 1)
             |              ^
           47|             (foldAttrs (acc: v: acc + v) 0

       … while calling 'filterAttrs'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:646:5:
          645|     pred:
          646|     set:
             |     ^
          647|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));

       … while calling the 'listToAttrs' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:647:5:
          646|     set:
          647|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |     ^
          648|

       … while calling the 'concatMap' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:647:18:
          646|     set:
          647|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                  ^
          648|

       … while calling the 'attrNames' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:647:114:
          646|     set:
          647|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                                                                                                                  ^
          648|

       … from call site
         at /nix/store/cllqwnqqr2nci1l1b3fpr9f28vd4arfq-source/modules/files.nix:47:14:
           46|             (filterAttrs (n: v: v > 1)
           47|             (foldAttrs (acc: v: acc + v) 0
             |              ^
           48|             (mapAttrsToList (n: v: { ${v.target} = 1; }) cfg)));

       … while calling 'foldAttrs'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:820:5:
          819|     nul:
          820|     list_of_attrs:
             |     ^
          821|     foldr (n: a:

       … from call site
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:821:5:
          820|     list_of_attrs:
          821|     foldr (n: a:
             |     ^
          822|         foldr (name: o:

       … while calling 'foldr'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/lists.nix:121:20:
          120|   */
          121|   foldr = op: nul: list:
             |                    ^
          122|     let

       … from call site
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/lists.nix:128:8:
          127|         else op (elemAt list n) (fold' (n + 1));
          128|     in fold' 0;
             |        ^
          129|

       … while calling 'fold''
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/lists.nix:124:15:
          123|       len = length list;
          124|       fold' = n:
             |               ^
          125|         if n == len

       … while evaluating a branch condition
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/lists.nix:125:9:
          124|       fold' = n:
          125|         if n == len
             |         ^
          126|         then nul

       … while calling the 'length' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/lists.nix:123:13:
          122|     let
          123|       len = length list;
             |             ^
          124|       fold' = n:

       … from call site
         at /nix/store/cllqwnqqr2nci1l1b3fpr9f28vd4arfq-source/modules/files.nix:48:14:
           47|             (foldAttrs (acc: v: acc + v) 0
           48|             (mapAttrsToList (n: v: { ${v.target} = 1; }) cfg)));
             |              ^
           49|         dupsStr = concatStringsSep ", " dups;

       … while calling 'mapAttrsToList'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:1095:5:
         1094|     f:
         1095|     attrs:
             |     ^
         1096|     map (name: f name attrs.${name}) (attrNames attrs);

       … while calling the 'map' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:1096:5:
         1095|     attrs:
         1096|     map (name: f name attrs.${name}) (attrNames attrs);
             |     ^
         1097|

       … while calling the 'attrNames' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:1096:39:
         1095|     attrs:
         1096|     map (name: f name attrs.${name}) (attrNames attrs);
             |                                       ^
         1097|

       … from call site
         at /nix/store/cllqwnqqr2nci1l1b3fpr9f28vd4arfq-source/modules/files.nix:7:9:
            6|
            7|   cfg = filterAttrs (n: f: f.enable) config.home.file;
             |         ^
            8|

       … while calling 'filterAttrs'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:646:5:
          645|     pred:
          646|     set:
             |     ^
          647|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));

       … while calling the 'listToAttrs' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:647:5:
          646|     set:
          647|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |     ^
          648|

       … while calling the 'concatMap' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:647:18:
          646|     set:
          647|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                  ^
          648|

       … while calling the 'attrNames' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:647:114:
          646|     set:
          647|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                                                                                                                  ^
          648|

       … from call site
         at /nix/store/cllqwnqqr2nci1l1b3fpr9f28vd4arfq-source/modules/files.nix:7:38:
            6|
            7|   cfg = filterAttrs (n: f: f.enable) config.home.file;
             |                                      ^
            8|

       … while calling anonymous lambda
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:1205:18:
         1204|         mapAttrs
         1205|           (name: value:
             |                  ^
         1206|             if isAttrs value && cond value

       … from call site
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:1208:18:
         1207|             then recurse (path ++ [ name ]) value
         1208|             else f (path ++ [ name ]) value);
             |                  ^
         1209|     in

       … while calling anonymous lambda
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:254:72:
          253|           # For definitions that have an associated option
          254|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          255|

       … while evaluating the attribute 'value'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:821:9:
          820|     in warnDeprecation opt //
          821|       { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          822|         inherit (res.defsFinal') highestPrio;

       … while calling the 'addErrorContext' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:821:17:
          820|     in warnDeprecation opt //
          821|       { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |                 ^
          822|         inherit (res.defsFinal') highestPrio;

       … while evaluating the option `home-manager.users.niksingh710.home.file':

       (11 duplicate frames omitted)

       … while evaluating definitions from `/nix/store/cllqwnqqr2nci1l1b3fpr9f28vd4arfq-source/modules/misc/xdg.nix':

       … from call site
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:837:128:
          836|         defs' = concatMap (m:
          837|           map (value: { inherit (m) file; inherit value; }) (addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                ^
          838|         ) defs;

       … while calling 'dischargeProperties'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:908:25:
          907|   */
          908|   dischargeProperties = def:
             |                         ^
          909|     if def._type or "" == "merge" then

       … while calling the 'concatMap' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:910:7:
          909|     if def._type or "" == "merge" then
          910|       concatMap dischargeProperties def.contents
             |       ^
          911|     else if def._type or "" == "if" then

       … while calling 'dischargeProperties'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:908:25:
          907|   */
          908|   dischargeProperties = def:
             |                         ^
          909|     if def._type or "" == "merge" then

       … while evaluating a branch condition
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:909:5:
          908|   dischargeProperties = def:
          909|     if def._type or "" == "merge" then
             |     ^
          910|       concatMap dischargeProperties def.contents

       … from call site
         at /nix/store/cllqwnqqr2nci1l1b3fpr9f28vd4arfq-source/modules/misc/xdg.nix:121:10:
          120|       home.file = mkMerge [
          121|         (mapAttrs' (name: file: nameValuePair "${cfg.configHome}/${name}" file)
             |          ^
          122|           cfg.configFile)

       … while calling 'mapAttrs''
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:1057:5:
         1056|     f:
         1057|     set:
             |     ^
         1058|     listToAttrs (map (attr: f attr set.${attr}) (attrNames set));

       … while calling the 'listToAttrs' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:1058:5:
         1057|     set:
         1058|     listToAttrs (map (attr: f attr set.${attr}) (attrNames set));
             |     ^
         1059|

       … while calling the 'map' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:1058:18:
         1057|     set:
         1058|     listToAttrs (map (attr: f attr set.${attr}) (attrNames set));
             |                  ^
         1059|

       … while calling the 'attrNames' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:1058:50:
         1057|     set:
         1058|     listToAttrs (map (attr: f attr set.${attr}) (attrNames set));
             |                                                  ^
         1059|

       … from call site
         at /nix/store/cllqwnqqr2nci1l1b3fpr9f28vd4arfq-source/modules/misc/xdg.nix:122:11:
          121|         (mapAttrs' (name: file: nameValuePair "${cfg.configHome}/${name}" file)
          122|           cfg.configFile)
             |           ^
          123|         (mapAttrs' (name: file: nameValuePair "${cfg.dataHome}/${name}" file)

       … while calling anonymous lambda
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:1205:18:
         1204|         mapAttrs
         1205|           (name: value:
             |                  ^
         1206|             if isAttrs value && cond value

       … from call site
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:1208:18:
         1207|             then recurse (path ++ [ name ]) value
         1208|             else f (path ++ [ name ]) value);
             |                  ^
         1209|     in

       … while calling anonymous lambda
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:254:72:
          253|           # For definitions that have an associated option
          254|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          255|

       … while evaluating the attribute 'value'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:821:9:
          820|     in warnDeprecation opt //
          821|       { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          822|         inherit (res.defsFinal') highestPrio;

       … while calling the 'addErrorContext' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:821:17:
          820|     in warnDeprecation opt //
          821|       { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |                 ^
          822|         inherit (res.defsFinal') highestPrio;

       … while evaluating the option `home-manager.users.niksingh710.xdg.configFile':

       … while evaluating the attribute 'mergedValue'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:856:5:
          855|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
          856|     mergedValue =
             |     ^
          857|       if isDefined then

       … from call site
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:858:59:
          857|       if isDefined then
          858|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |                                                           ^
          859|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       … while calling 'merge'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/types.nix:582:20:
          581|       check = isAttrs;
          582|       merge = loc: defs:
             |                    ^
          583|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:

       … while calling the 'mapAttrs' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/types.nix:583:9:
          582|       merge = loc: defs:
          583|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |         ^
          584|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … from call site
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/types.nix:583:35:
          582|       merge = loc: defs:
          583|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                   ^
          584|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … while calling 'filterAttrs'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:646:5:
          645|     pred:
          646|     set:
             |     ^
          647|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));

       … while calling the 'listToAttrs' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:647:5:
          646|     set:
          647|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |     ^
          648|

       … while calling the 'concatMap' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:647:18:
          646|     set:
          647|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                  ^
          648|

       … while calling anonymous lambda
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:647:29:
          646|     set:
          647|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                             ^
          648|

       … while evaluating a branch condition
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:647:59:
          646|     set:
          647|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                                                           ^
          648|

       … from call site
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:647:62:
          646|     set:
          647|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                                                              ^
          648|

       … while calling anonymous lambda
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/types.nix:583:51:
          582|       merge = loc: defs:
          583|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                                   ^
          584|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … from call site
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:647:43:
          646|     set:
          647|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                                           ^
          648|

       … while calling anonymous lambda
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/types.nix:583:86:
          582|       merge = loc: defs:
          583|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                                                                      ^
          584|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … while evaluating the attribute 'optionalValue'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:868:5:
          867|
          868|     optionalValue =
             |     ^
          869|       if isDefined then { value = mergedValue; }

       … while evaluating a branch condition
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:869:7:
          868|     optionalValue =
          869|       if isDefined then { value = mergedValue; }
             |       ^
          870|       else {};

       (9 duplicate frames omitted)

       … while evaluating definitions from `/nix/store/cllqwnqqr2nci1l1b3fpr9f28vd4arfq-source/modules/programs/waybar.nix':

       … from call site
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:837:128:
          836|         defs' = concatMap (m:
          837|           map (value: { inherit (m) file; inherit value; }) (addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                ^
          838|         ) defs;

       … while calling 'dischargeProperties'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:908:25:
          907|   */
          908|   dischargeProperties = def:
             |                         ^
          909|     if def._type or "" == "merge" then

       … while evaluating a branch condition
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:912:7:
          911|     else if def._type or "" == "if" then
          912|       if isBool def.condition then
             |       ^
          913|         if def.condition then

       … while calling the 'isBool' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:912:10:
          911|     else if def._type or "" == "if" then
          912|       if isBool def.condition then
             |          ^
          913|         if def.condition then

       … while evaluating the attribute 'condition'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:1013:15:
         1012|     { _type = "if";
         1013|       inherit condition content;
             |               ^
         1014|     };

       … from call site
         at /nix/store/cllqwnqqr2nci1l1b3fpr9f28vd4arfq-source/modules/programs/waybar.nix:294:49:
          293|
          294|       xdg.configFile."waybar/style.css" = mkIf (cfg.style != null) {
             |                                                 ^
          295|         source = if builtins.isPath cfg.style || isStorePath cfg.style then

       … while calling anonymous lambda
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:1205:18:
         1204|         mapAttrs
         1205|           (name: value:
             |                  ^
         1206|             if isAttrs value && cond value

       … from call site
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/attrsets.nix:1208:18:
         1207|             then recurse (path ++ [ name ]) value
         1208|             else f (path ++ [ name ]) value);
             |                  ^
         1209|     in

       … while calling anonymous lambda
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:254:72:
          253|           # For definitions that have an associated option
          254|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          255|

       … while evaluating the attribute 'value'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:821:9:
          820|     in warnDeprecation opt //
          821|       { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          822|         inherit (res.defsFinal') highestPrio;

       … while calling the 'addErrorContext' builtin
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:821:17:
          820|     in warnDeprecation opt //
          821|       { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |                 ^
          822|         inherit (res.defsFinal') highestPrio;

       … while evaluating the option `home-manager.users.niksingh710.programs.waybar.style':

       (11 duplicate frames omitted)

       … while evaluating definitions from `/nix/store/wdj51jdv80ap1d8c1p8ixv72g3r49qkj-source/modules/home/hyprland/waybar/style.nix':

       … from call site
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:837:128:
          836|         defs' = concatMap (m:
          837|           map (value: { inherit (m) file; inherit value; }) (addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                ^
          838|         ) defs;

       … while calling 'dischargeProperties'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:908:25:
          907|   */
          908|   dischargeProperties = def:
             |                         ^
          909|     if def._type or "" == "merge" then

       … while evaluating a branch condition
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:909:5:
          908|   dischargeProperties = def:
          909|     if def._type or "" == "merge" then
             |     ^
          910|       concatMap dischargeProperties def.contents

       … while evaluating the attribute 'value'
         at /nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source/lib/modules.nix:619:53:
          618|                 (n: value:
          619|                   [{ inherit (module) file; inherit value; }]
             |                                                     ^
          620|                 )

       … while selecting an attribute
         at /nix/store/wdj51jdv80ap1d8c1p8ixv72g3r49qkj-source/modules/home/hyprland/waybar/style.nix:4:33:
            3|   colors = ''
            4|     @define-color background #${config.stylix.base16Scheme.base00};
             |                                 ^
            5|     @define-color foreground #${config.stylix.base16Scheme.base0F};

       error: expected a set but found a string with context: "/nix/store/6fqpbpfd6vcw11df391d9lf7rjqs38lp-base16-schemes-unstable-2024-06-21/share/themes/decaf.yaml"

@danth

niksingh710 avatar Aug 25 '24 08:08 niksingh710

umm it seems like me using ${config.stylix.base16Scheme.<color>} is throwing the error. coz if colors are generated from an image then they are nix attrs and if taken from yaml then base16Scheme is a String path to the yaml file.

niksingh710 avatar Aug 25 '24 08:08 niksingh710

It's my bad i was using the wrong way to access the colors.

The correct way is mentioned in this discussion.

Ig the documentation should add this.

niksingh710 avatar Aug 25 '24 09:08 niksingh710

Yes, config.lib.stylix.colors is the correct way to access colors from the current scheme, and should always work.

danth avatar Aug 25 '24 10:08 danth