Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The option `nixpkgs.pkgs' is used but not defined. #45

Open
spikespaz opened this issue Oct 27, 2022 · 0 comments
Open

The option `nixpkgs.pkgs' is used but not defined. #45

spikespaz opened this issue Oct 27, 2022 · 0 comments

Comments

@spikespaz
Copy link

The full trace is included at the bottom. I am trying to use flake-compat as a shim to generate a configuration.nix for nixos-install since the installer seems to be broken in many weird ways.

I tried to debug the installer, but the issue is fundamentally with the output of the flake, and it doesn't seem to set up a new system correctly. For example, writing the ISO's fstab to /mnt/etc rather than the one generated by my flake's activation script.

I have some glue code (bash) around these lines:

cat <<- EOF > "$root_dir/etc/nixos/configuration.nix"
	(import (builtins.fetchTarball {
		url = "$FLAKE_COMPAT_TARBALL_URL";
		sha256 = "$FLAKE_COMPAT_TARBALL_HASH";
	}) {src = "$flake_path";}).defaultNix.nixosConfigurations.$host_name.config
EOF

Obviously $root_dir, $flake_path, and $host_name are handled elsewhere in the shell script. The flake is pre-built and sent over to the store at /mnt/nix/store before running nixos-install (on $root_dir which is /mnt).

I have attempted to follow the trace myself to determine if I can do something about it -- alas I am not experienced enough. I feel that it is worth note that I perform an explicit import of nixpkgs (that is a link to my flake.nix).

I would like to know if I am using the wrong attribute path (in configuration.nix) or something, and if the issue is that nixpkgs.pkgs is not being evaluated properly. If it is being evaluated correctly by flake-compat, I would like to know what wants nixpkgs.pkgs, I do not see any occurrence in my code.

Thanks.

When running nixos-install, I see the following:

error: The option `nixpkgs.pkgs' is used but not defined.

       … while evaluating the attribute 'mergedValue'

       at /mnt/nix/store/x20avpqcrk6my01n6h1blfslb6l4imw2-source/lib/modules.nix:747:5:

          746|     £ Type-check the remaining definitions, and merge them. Or throw if no definitions.
          747|     mergedValue =
             |     ^
          748|       if isDefined then

       … while evaluating the option `nixpkgs.pkgs':

       … while evaluating the attribute 'value'

       at /mnt/nix/store/x20avpqcrk6my01n6h1blfslb6l4imw2-source/lib/modules.nix:712:9:

          711|     in warnDeprecation opt //
          712|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          713|         inherit (res.defsFinal') highestPrio;

       … while evaluating anonymous lambda

       at /mnt/nix/store/x20avpqcrk6my01n6h1blfslb6l4imw2-source/lib/modules.nix:265:72:

          264|           £ For definitions that have an associated option
          265|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          266|

       … from call site

       at /mnt/nix/store/x20avpqcrk6my01n6h1blfslb6l4imw2-source/lib/attrsets.nix:401:20:

          400|               then recurse (path ++ [name]) value
          401|               else f (path ++ [name]) value;
             |                    ^
          402|         in mapAttrs g;

       … while evaluating 'g'

       at /mnt/nix/store/x20avpqcrk6my01n6h1blfslb6l4imw2-source/lib/attrsets.nix:398:19:

          397|           g =
          398|             name: value:
             |                   ^
          399|             if isAttrs value && cond value

       … from call site

       … while evaluating the attribute 'value'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:581:44:

          580|       defnsByName' = byName "config" (module: value:
          581|           [{ inherit (module) file; inherit value; }]
             |                                            ^
          582|         ) configs;

       … while evaluating 'dischargeProperties'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:832:25:

          831|   */
          832|   dischargeProperties = def:
             |                         ^
          833|     if def._type or "" == "merge" then

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:761:137:

          760|         defs' = concatMap (m:
          761|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          762|         ) defs;

       … while evaluating definitions from `/mnt/etc/nixos/configuration.nix':

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:760:28:

          759|         £ Process mkMerge and mkIf properties.
          760|         defs' = concatMap (m:
             |                            ^
          761|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:760:17:

          759|         £ Process mkMerge and mkIf properties.
          760|         defs' = concatMap (m:
             |                 ^
          761|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating the attribute 'values'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:873:7:

          872|     in {
          873|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
             |       ^
          874|       inherit highestPrio;

       … while evaluating the attribute 'values'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:774:9:

          773|       in {
          774|         values = defs''';
             |         ^
          775|         inherit (defs'') highestPrio;

       … while evaluating the attribute 'isDefined'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:790:5:

          789|
          790|     isDefined = defsFinal != [];
             |     ^
          791|

       … while evaluating the attribute 'pkgs.isDefined'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:750:22:

          749|         files = map (def: def.file) res.defsFinal;
          750|         inherit (res) isDefined;
             |                      ^
          751|         £ This allows options to be correctly displayed using `${options.path.to.it}`

       … while evaluating the attribute 'value'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:461:58:

          460|         £ Push down position info.
          461|         (map (def: mapAttrs (n: v: { inherit (def) file; value = v; }) def.value) defs);
             |                                                          ^
          462|       emptyValue = { value = {}; };

       … while evaluating 'dischargeProperties'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:832:25:

          831|   */
          832|   dischargeProperties = def:
             |                         ^
          833|     if def._type or "" == "merge" then

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:761:137:

          760|         defs' = concatMap (m:
          761|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          762|         ) defs;

       … while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/misc/nixpkgs.nix':

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:760:28:

          759|         £ Process mkMerge and mkIf properties.
          760|         defs' = concatMap (m:
             |                            ^
          761|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:760:17:

          759|         £ Process mkMerge and mkIf properties.
          760|         defs' = concatMap (m:
             |                 ^
          761|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating the attribute 'values'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:873:7:

          872|     in {
          873|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
             |       ^
          874|       inherit highestPrio;

       … while evaluating the attribute 'values'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:774:9:

          773|       in {
          774|         values = defs''';
             |         ^
          775|         inherit (defs'') highestPrio;

       … while evaluating the attribute 'optionalValue.value'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:792:5:

          791|
          792|     optionalValue =
             |     ^
          793|       if isDefined then { value = mergedValue; }

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:455:29:

          454|       merge = loc: defs:
          455|         zipAttrsWith (name: defs:
             |                             ^
          456|           let merged = mergeDefinitions (loc ++ [name]) elemType defs;

       … from call site

       … while evaluating the module argument `pkgs' in "/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/services/hardware/bluetooth.nix":

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:494:44:

          493|       context = name: ''while evaluating the module argument `${name}' in "${key}":'';
          494|       extraArgs = builtins.mapAttrs (name: _:
             |                                            ^
          495|         builtins.addErrorContext (context name)

       … from call site

       … while evaluating the attribute 'type.getSubModules'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/services/hardware/bluetooth.nix:71:9:

           70|       settings = mkOption {
           71|         type = cfgFmt.type;
             |         ^
           72|         default = { };

       … while evaluating 'fixupOptionType'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:893:26:

          892|   £ TODO: Merge this into mergeOptionDecls
          893|   fixupOptionType = loc: opt:
             |                          ^
          894|     if opt.type.getSubModules or null == null

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:609:23:

          608|           if length optionDecls == length decls then
          609|             let opt = fixupOptionType loc (mergeOptionDecls loc decls);
             |                       ^
          610|             in {

       … while evaluating 'warnIf'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/trivial.nix:350:18:

          349|   */
          350|   warnIf = cond: msg: if cond then warn msg else x: x;
             |                  ^
          351|

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:742:9:

          741|       warnDeprecation =
          742|         warnIf (opt.type.deprecationMessage != null)
             |         ^
          743|           "The type `types.${opt.type.name}' of option `${showOption loc}' defined in ${showFiles opt.declarations} is deprecated. ${opt.type.deprecationMessage}";

       … while evaluating 'evalOptionValue'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:717:31:

          716|      config value. */
          717|   evalOptionValue = loc: opt: defs:
             |                               ^
          718|     let

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:611:32:

          610|             in {
          611|               matchedOptions = evalOptionValue loc opt defns';
             |                                ^
          612|               unmatchedDefns = [];

       … while evaluating the attribute 'matchedOptions'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:611:15:

          610|             in {
          611|               matchedOptions = evalOptionValue loc opt defns';
             |               ^
          612|               unmatchedDefns = [];

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:642:37:

          641|
          642|       matchedOptions = mapAttrs (n: v: v.matchedOptions) resultsByName;
             |                                     ^
          643|

       … from call site

       … while evaluating 'attrByPath'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:24:35:

           23|   */
           24|   attrByPath = attrPath: default: e:
             |                                   ^
           25|     let attr = head attrPath;

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:29:12:

           28|       else if e ? ${attr}
           29|       then attrByPath (tail attrPath) default e.${attr}
             |            ^
           30|       else default;

       … while evaluating 'attrByPath'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:24:35:

           23|   */
           24|   attrByPath = attrPath: default: e:
             |                                   ^
           25|     let attr = head attrPath;

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:29:12:

           28|       else if e ? ${attr}
           29|       then attrByPath (tail attrPath) default e.${attr}
             |            ^
           30|       else default;

       … while evaluating 'attrByPath'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:24:35:

           23|   */
           24|   attrByPath = attrPath: default: e:
             |                                   ^
           25|     let attr = head attrPath;

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:29:12:

           28|       else if e ? ${attr}
           29|       then attrByPath (tail attrPath) default e.${attr}
             |            ^
           30|       else default;

       … while evaluating 'attrByPath'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:24:35:

           23|   */
           24|   attrByPath = attrPath: default: e:
             |                                   ^
           25|     let attr = head attrPath;

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:1160:26:

         1159|         (abort "Renaming error: option `${showOption to}' does not exist.");
         1160|       toType = let opt = attrByPath to {} options; in opt.type or (types.submodule {});
             |                          ^
         1161|     in

       … while evaluating 'optionalAttrs'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:453:25:

          452|   */
          453|   optionalAttrs = cond: as: if cond then as else {};
             |                         ^
          454|

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:1167:12:

         1166|         apply = x: use (toOf config);
         1167|       } // optionalAttrs (toType != null) {
             |            ^
         1168|         type = toType;

       … while evaluating 'atDepth'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:60:17:

           59|       len = length attrPath;
           60|       atDepth = n:
             |                 ^
           61|         if n == len

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:63:39:

           62|         then value
           63|         else { ${elemAt attrPath n} = atDepth (n + 1); };
             |                                       ^
           64|     in atDepth 0;

       … while evaluating the attribute 'options'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:573:38:

          572|       declsByName = byName "options" (module: option:
          573|           [{ inherit (module) _file; options = option; }]
             |                                      ^
          574|         ) options;

       … while evaluating 'isType'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:71:18:

           70| rec {
           71|   isType = type: x: (x._type or "") == type;
             |                  ^
           72|

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:606:36:

          605|           defns' = defnsByName'.${name} or [];
          606|           optionDecls = filter (m: isOption m.options) decls;
             |                                    ^
          607|         in

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:606:33:

          605|           defns' = defnsByName'.${name} or [];
          606|           optionDecls = filter (m: isOption m.options) decls;
             |                                 ^
          607|         in

       … from call site

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:600:39:

          599|
          600|       resultsByName = mapAttrs (name: decls:
             |                                       ^
          601|         £ We're descending into attribute ‘name’.

       … from call site

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:647:22:

          646|         £ Propagate all unmatched definitions from nested option sets
          647|         mapAttrs (n: v: v.unmatchedDefns) resultsByName
             |                      ^
          648|         £ Plus the definitions for the current prefix that don't have a matching option

       … from call site

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:661:46:

          660|         else
          661|           concatLists (mapAttrsToList (name: defs:
             |                                              ^
          662|             map (def: def // {

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:356:16:

          355|   mapAttrsToList = f: attrs:
          356|     map (name: f name attrs.${name}) (attrNames attrs);
             |                ^
          357|

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:356:10:

          355|   mapAttrsToList = f: attrs:
          356|     map (name: f name attrs.${name}) (attrNames attrs);
             |          ^
          357|

       … from call site

       … while evaluating the attribute 'unmatchedDefns'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:654:7:

          653|       £ Transforms unmatchedDefnsByName into a list of definitions
          654|       unmatchedDefns =
             |       ^
          655|         if configs == []

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:647:22:

          646|         £ Propagate all unmatched definitions from nested option sets
          647|         mapAttrs (n: v: v.unmatchedDefns) resultsByName
             |                      ^
          648|         £ Plus the definitions for the current prefix that don't have a matching option

       … from call site

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:661:46:

          660|         else
          661|           concatLists (mapAttrsToList (name: defs:
             |                                              ^
          662|             map (def: def // {

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:356:16:

          355|   mapAttrsToList = f: attrs:
          356|     map (name: f name attrs.${name}) (attrNames attrs);
             |                ^
          357|

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:356:10:

          355|   mapAttrsToList = f: attrs:
          356|     map (name: f name attrs.${name}) (attrNames attrs);
             |          ^
          357|

       … from call site

       … while evaluating the attribute 'unmatchedDefns'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:654:7:

          653|       £ Transforms unmatchedDefnsByName into a list of definitions
          654|       unmatchedDefns =
             |       ^
          655|         if configs == []

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:647:22:

          646|         £ Propagate all unmatched definitions from nested option sets
          647|         mapAttrs (n: v: v.unmatchedDefns) resultsByName
             |                      ^
          648|         £ Plus the definitions for the current prefix that don't have a matching option

       … from call site

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:661:46:

          660|         else
          661|           concatLists (mapAttrsToList (name: defs:
             |                                              ^
          662|             map (def: def // {

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:356:16:

          355|   mapAttrsToList = f: attrs:
          356|     map (name: f name attrs.${name}) (attrNames attrs);
             |                ^
          357|

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:356:10:

          355|   mapAttrsToList = f: attrs:
          356|     map (name: f name attrs.${name}) (attrNames attrs);
             |          ^
          357|

       … from call site

       … while evaluating the attribute 'unmatchedDefns'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:654:7:

          653|       £ Transforms unmatchedDefnsByName into a list of definitions
          654|       unmatchedDefns =
             |       ^
          655|         if configs == []

       … while evaluating the attribute 'config.system.build.toplevel'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:363:9:

          362|         options = checked options;
          363|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          364|         _module = checked (config._module);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant