Hi everyone,
Thank you so much for your replies!
Here is the flake.nix file:
{
description = "A very basic system setup";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config ={
allowUnfree = true;
};
};
in
{
nixosConfigurations = {
myNixos = nixpkgs.lib.nixosSystem {
specialArgs = { inherit system; };
modules = [
./nixos/configuration.nix
];
};
};
#packages.x86_64-linux.hello = nixpkgs.legacyPackages.x86_64-linux.hello;
#packages.x86_64-linux.default = self.packages.x86_64-linux.hello;
};
}
Both my flake.nix and the entire nixos directory are under git version control, both with only a single commit. After I copied my configuration from /etc/nixos
, I removed its git commits. Keeping the configuration file under its own git commit is what I was previously doing, and still getting this error.
The file structure is:
./flake.nix
./flake.lock
./nixos/configuration.nix
./nixos/hardware-configuration.nix
./nixos/configuration.nix.bak
./nixos/vim.nix
All of this is in /home/user/.config/nix
folder (altered the location since my previous message, instead of nixos as folder in .config
, it is nix now, if that matters).
I don’t need vim.nix
, it just was copied with other files.
From looking at the contents of the folder that the error asks, flake.nix
and its lock file are created, but not the nixos directory.
Another thing that might be relevant is that part of the error I get is the warning “Git tree /home/user is dirty”, since it contains my home configuration. Files under this (~/.config/nix
) folder are under their own git version control, so not sure why that warning appears.
In case that is important, here is a full trace of the error:
warning: Git tree '/home/user' is dirty
error:
… while calling the 'seq' builtin
at /nix/store/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-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/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-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/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-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/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-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/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-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/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-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/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-source/lib/attrsets.nix:734:5:
733| # Attribute set to recursively map over.
734| set:
| ^
735| let
… from call site
at /nix/store/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-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/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-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/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-source/lib/modules.nix:229:25:
228| merged =
229| let collected = collectModules
| ^
230| class
… while calling anonymous lambda
at /nix/store/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-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/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-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/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-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/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-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/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-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/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-source/lib/modules.nix:359:11:
358| then
359| m:
| ^
360| if m._class != null -> m._class == class
… from call site
at /nix/store/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-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/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-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/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-source/lib/modules.nix:354:14:
353| throw "Module imports can't be nested lists. Perhaps you meant to remove one level of lists? Definitions: ${showDefs defs}"
354| else unifyModuleSyntax (toString m) (toString m) (applyModuleArgsIfFunction (toString m) (import m) args);
| ^
355|
… while calling 'unifyModuleSyntax'
at /nix/store/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-source/lib/modules.nix:454:34:
453| of ‘options’, ‘config’ and ‘imports’ attributes. */
454| unifyModuleSyntax = file: key: m:
| ^
455| let
… from call site
at /nix/store/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-source/lib/modules.nix:354:59:
353| throw "Module imports can't be nested lists. Perhaps you meant to remove one level of lists? Definitions: ${showDefs defs}"
354| else unifyModuleSyntax (toString m) (toString m) (applyModuleArgsIfFunction (toString m) (import m) args);
| ^
355|
… while calling 'applyModuleArgsIfFunction'
at /nix/store/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-source/lib/modules.nix:488:39:
487|
488| applyModuleArgsIfFunction = key: f: args@{ config, options, lib, ... }:
| ^
489| if isFunction f then applyModuleArgs key f args else f;
… from call site
at /nix/store/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-source/lib/modules.nix:489:8:
488| applyModuleArgsIfFunction = key: f: args@{ config, options, lib, ... }:
489| if isFunction f then applyModuleArgs key f args else f;
| ^
490|
… while calling 'isFunction'
at /nix/store/1gpgihsi21bni03hy6i5ccw9lfrhnbqi-source/lib/trivial.nix:458:16:
457| */
458| isFunction = f: builtins.isFunction f ||
| ^
459| (f ? __functor && isFunction (f.__functor f));
error: getting status of '/nix/store/92qf7qfqijg9yka9hhh2wwh97v5f16x2-source/.config/nix/nixos': No such file or directory
Thank you again for your help!