Rebuild fails "error: cannot look up '<nixos-wsl/modules>' in pure evaluation mode" with flakes enabled #374
Answered
by
nzbr
JackTheMico
asked this question in
Q&A
-
Hi, I can run {
description = "A very basic flake";
outputs = { self, nixpkgs }: {
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
];
};
};
} so as my # Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
# NixOS-WSL specific options are documented on the NixOS-WSL repository:
# https://github.com/nix-community/NixOS-WSL
{ config, lib, pkgs, ... }:
{
imports = [
# include NixOS-WSL modules
<nixos-wsl/modules>
];
wsl.enable = true;
wsl.defaultUser = "nixos";
nix.settings.experimental-features = [ "nix-command" "flakes" ];
environment.systemPackages = with pkgs; [
git
neovim
wget
# helix.packages."${pkgs}".helix
];
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It's perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
} The full error output are: [nixos@nixos:~]$ sudo nixos-rebuild switch --option eval-cache false --show-trace
error:
… while calling the 'seq' builtin
at /nix/store/jnk1mfi594y0dsmzla4nmkbr4rnrqa71-source/lib/modules.nix:322:18:
321| options = checked options;
322| config = checked (removeAttrs config [ "_module" ]);
| ^
323| _module = checked (config._module);
… while evaluating a branch condition
at /nix/store/jnk1mfi594y0dsmzla4nmkbr4rnrqa71-source/lib/modules.nix:261:9:
260| checkUnmatched =
261| if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
| ^
262| let
… in the left operand of the AND (&&) operator
at /nix/store/jnk1mfi594y0dsmzla4nmkbr4rnrqa71-source/lib/modules.nix:261:72:
260| checkUnmatched =
261| if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
| ^
262| let
… in the left operand of the AND (&&) operator
at /nix/store/jnk1mfi594y0dsmzla4nmkbr4rnrqa71-source/lib/modules.nix:261:33:
260| checkUnmatched =
261| if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
| ^
262| let
… while evaluating a branch condition
at /nix/store/jnk1mfi594y0dsmzla4nmkbr4rnrqa71-source/lib/modules.nix:254:12:
253|
254| in if declaredConfig._module.freeformType == null then declaredConfig
| ^
255| # Because all definitions that had an associated option ended in
… from call site
at /nix/store/jnk1mfi594y0dsmzla4nmkbr4rnrqa71-source/lib/modules.nix:242:28:
241| # For definitions that have an associated option
242| declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
| ^
243|
… while calling 'mapAttrsRecursiveCond'
at /nix/store/jnk1mfi594y0dsmzla4nmkbr4rnrqa71-source/lib/attrsets.nix:734:5:
733| # Attribute set to recursively map over.
734| set:
| ^
735| let
… from call site
at /nix/store/jnk1mfi594y0dsmzla4nmkbr4rnrqa71-source/lib/modules.nix:234:33:
233| ({ inherit lib options config specialArgs; } // specialArgs);
234| in mergeModules prefix (reverseList collected);
| ^
235|
… while calling 'reverseList'
at /nix/store/jnk1mfi594y0dsmzla4nmkbr4rnrqa71-source/lib/lists.nix:510:17:
509| */
510| reverseList = xs:
| ^
511| let l = length xs; in genList (n: elemAt xs (l - n - 1)) l;
… from call site
at /nix/store/jnk1mfi594y0dsmzla4nmkbr4rnrqa71-source/lib/modules.nix:229:25:
228| merged =
229| let collected = collectModules
| ^
230| class
… while calling anonymous lambda
at /nix/store/jnk1mfi594y0dsmzla4nmkbr4rnrqa71-source/lib/modules.nix:445:37:
444|
445| in modulesPath: initialModules: args:
| ^
446| filterModules modulesPath (collectStructuredModules unknownModule "" initialModules args);
… from call site
at /nix/store/jnk1mfi594y0dsmzla4nmkbr4rnrqa71-source/lib/modules.nix:446:7:
445| in modulesPath: initialModules: args:
446| filterModules modulesPath (collectStructuredModules unknownModule "" initialModules args);
| ^
447|
… while calling 'filterModules'
at /nix/store/jnk1mfi594y0dsmzla4nmkbr4rnrqa71-source/lib/modules.nix:413:36:
412| # modules recursively. It returns the final list of unique-by-key modules
413| filterModules = modulesPath: { disabled, modules }:
| ^
414| let
… while calling anonymous lambda
at /nix/store/jnk1mfi594y0dsmzla4nmkbr4rnrqa71-source/lib/modules.nix:439:31:
438| disabledKeys = concatMap ({ file, disabled }: map (moduleKey file) disabled) disabled;
439| keyFilter = filter (attrs: ! elem attrs.key disabledKeys);
| ^
440| in map (attrs: attrs.module) (builtins.genericClosure {
… from call site
at /nix/store/jnk1mfi594y0dsmzla4nmkbr4rnrqa71-source/lib/modules.nix:400:22:
399| let
400| module = checkModule (loadModule args parentFile "${parentKey}:anon-${toString n}" x);
| ^
401| collectedImports = collectStructuredModules module._file module.key module.imports args;
… while calling anonymous lambda
at /nix/store/jnk1mfi594y0dsmzla4nmkbr4rnrqa71-source/lib/modules.nix:359:11:
358| then
359| m:
| ^
360| if m._class != null -> m._class == class
… from call site
at /nix/store/jnk1mfi594y0dsmzla4nmkbr4rnrqa71-source/lib/modules.nix:400:35:
399| let
400| module = checkModule (loadModule args parentFile "${parentKey}:anon-${toString n}" x);
| ^
401| collectedImports = collectStructuredModules module._file module.key module.imports args;
… while calling 'loadModule'
at /nix/store/jnk1mfi594y0dsmzla4nmkbr4rnrqa71-source/lib/modules.nix:336:53:
335| # Like unifyModuleSyntax, but also imports paths and calls functions if necessary
336| loadModule = args: fallbackFile: fallbackKey: m:
| ^
337| if isFunction m then
… from call site
at /nix/store/jnk1mfi594y0dsmzla4nmkbr4rnrqa71-source/lib/modules.nix:337:12:
336| loadModule = args: fallbackFile: fallbackKey: m:
337| if isFunction m then
| ^
338| unifyModuleSyntax fallbackFile fallbackKey (applyModuleArgs fallbackKey m args)
… while calling 'isFunction'
at /nix/store/jnk1mfi594y0dsmzla4nmkbr4rnrqa71-source/lib/trivial.nix:458:16:
457| */
458| isFunction = f: builtins.isFunction f ||
| ^
459| (f ? __functor && isFunction (f.__functor f));
error: cannot look up '<nixos-wsl/modules>' in pure evaluation mode (use '--impure' to override)
at «none»:0: (source not available) I couldn't find out what's going wrong. Anyone please take a look and help me out. |
Beta Was this translation helpful? Give feedback.
Answered by
nzbr
Jan 10, 2024
Replies: 1 comment 6 replies
-
You want to use a flake input instead of the channel. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems like you haven't added a nixos-wsl input to your flake. Channels do not work with flakes, because the flake inputs replace them. Your source files need to look like this:
flake.nix:
configuration.nix: