Nixos-rebuild fails all the sudden on previously working builds

I currently have the following problem. When I run sudo nixos-rebuild build (or test or switch or anything similar) the rebuild fails with the following output

building Nix...
building the system configuration...
error:
       … while calling the 'head' builtin

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/attrsets.nix:960:11:

          959|         || pred here (elemAt values 1) (head values) then
          960|           head values
             |           ^
          961|         else

       … while evaluating the attribute 'value'

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:809:9:

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

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: Trying to retrieve system-dependent attributes for input nixpkgs, but this input is not a flake. Perhaps flake = false was added to the input declarations by mistake, or you meant to use a different input, or you meant to use plain old inputs, not inputs'.

Now the build was running just fine yesterday. I have tried every trick in the book that I know (which admittedly aren’t that many yet but all fail) Here is what I have tried so far

  • rolling back the channel to a previous version and tried rebuilding
  • booting from a previous generation
  • stripping down my configuration file until there was basically nothing in it anymore
  • using nix store verify --all to see if there were any corrupt packages

Nothing seems to have an effect. I never saw something similar. I often had builds that were not running through with some iterations of the unstable channel but so far every time rolling back to previous versions of the channel worked just fine. Is there any output or logs I could provide to narrow down the problem? Thank you very much in advance for the help.

Erm, are you using flakes or channels?

Can we see your flake.nix inputs and sudo nix-channel --list?

It’s just regular channels. Theres no flake.nix in my /etc/nixos folder and

sudo nix-channel --list

only returns

nixos nixos-unstable release nixos-24.05pre582649.d934204a0f8d

My current configuration.nix looks like this. I also disabled all imports as well as basically commenting everything else as well to rule out that the error lies there but the result remains the same

{ config, pkgs, ... }:
{
  imports =
    [ 
      ./hardware-configuration.nix

      ./appearance/_.nix
      ./hardware/_.nix
      ./home-manager/_.nix
      ./services/_.nix
      ./shell/_.nix
      ./user/_.nix

      ./file-systems.nix
      ./grub.nix
      ./kernel.nix
      ./networking.nix

    ];

  time.timeZone = "Europe/Berlin";

  i18n.defaultLocale = "de_DE.UTF-8";

  i18n.extraLocaleSettings = {
    LC_ADDRESS = "de_DE.UTF-8";
    LC_IDENTIFICATION = "de_DE.UTF-8";
    LC_MEASUREMENT = "de_DE.UTF-8";
    LC_MONETARY = "de_DE.UTF-8";
    LC_NAME = "de_DE.UTF-8";
    LC_NUMERIC = "de_DE.UTF-8";
    LC_PAPER = "de_DE.UTF-8";
    LC_TELEPHONE = "de_DE.UTF-8";
    LC_TIME = "de_DE.UTF-8";
  };

  services.xserver.enable = true;

  services.xserver.displayManager.sddm.enable = true;
  services.xserver.desktopManager.plasma5.enable = true;

  services.xserver = {
    layout = "de";
    xkbVariant = "";
  };

  console.keyMap = "de";

  services.printing.enable = true;

  security.rtkit.enable = true;

  users.users.${config.mainUser} = {
    isNormalUser = true;
    description = "${config.mainUser}";
    extraGroups = [ "wheel" ];
  };

  nixpkgs.config.allowUnfree = true;

  hardware.bluetooth.enable = true;
  environment.systemPackages = with pkgs; [
  ];

  
  system.stateVersion = "23.05"; # Did you read the comment?

  nix.settings.experimental-features = [ "nix-command" "flakes" ];
}

Maybe one thing that stood out in the trace of the build is this. It seems to point to something to the home-manager. A suspect that I had early on as the fetch from github to master could change from build to build.
However I do get the same output even when I remove home-manager completely from the configuration which seems odd.

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `home-manager.users.relief-melone.home.activation.installPackages.data':

       … while calling anonymous lambda

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:824:28:

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

       … while evaluating definitions from `/nix/store/db7dfj545xf35q6ia29gky48vk487s8q-source/modules/home-environment.nix':

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:825:137:

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

       … while calling 'dischargeProperties'

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:896:25:

          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … while evaluating derivation 'home-manager-path'
         whose name attribute is located at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'passAsFile' of derivation 'home-manager-path'

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/pkgs/build-support/trivial-builders/default.nix:88:7:

           87|       inherit buildCommand name;
           88|       passAsFile = [ "buildCommand" ]
             |       ^
           89|         ++ (derivationArgs.passAsFile or []);

       … while calling 'g'

anyone? I am completely stuck. I don’t understand why I keep getting this error even with a configuration file that has no reference to the home manager at all. Is there a way I can purge and force a complete rebuild?

By now I also tried rolling back home-manager. (see Home Manager Manual) but this also did not alter anything.

nix store repair also tells me that it could not find a flake.nix file even though I don’t use flakes in my configuration.

Here is the complete trace of the build. (always the same no matter how I alter configuration.nix)

building Nix...
building the system configuration...
error:
       … while calling anonymous lambda

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/attrsets.nix:956:24:

          955|     let f = attrPath:
          956|       zipAttrsWith (n: values:
             |                        ^
          957|         let here = attrPath ++ [n]; in

       … while calling 'g'

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/attrsets.nix:739:19:

          738|           g =
          739|             name: value:
             |                   ^
          740|             if isAttrs value && cond value

       … from call site

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/attrsets.nix:742:20:

          741|               then recurse (path ++ [name]) value
          742|               else f (path ++ [name]) value;
             |                    ^
          743|         in mapAttrs g;

       … while calling anonymous lambda

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

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

       … while calling anonymous lambda

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/modules.nix:824:28:

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

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

       … from call site

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/modules.nix:825:137:

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

       … while calling 'dischargeProperties'

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/modules.nix:896:25:

          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … from call site

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/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/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/lists.nix:53:20:

           52|   */
           53|   foldr = op: nul: list:
             |                    ^
           54|     let

       … from call site

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/lists.nix:60:8:

           59|         else op (elemAt list n) (fold' (n + 1));
           60|     in fold' 0;
             |        ^
           61|

       … while calling 'fold''

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/lists.nix:56:15:

           55|       len = length list;
           56|       fold' = n:
             |               ^
           57|         if n == len

       … from call site

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/nixos/modules/system/activation/top-level.nix:68:10:

           67|     then throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}"
           68|     else showWarnings config.warnings baseSystem;
             |          ^
           69|

       … while calling 'showWarnings'

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/trivial.nix:424:28:

          423|
          424|   showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings;
             |                            ^
          425|

       … from call site

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/trivial.nix:424:33:

          423|
          424|   showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings;
             |                                 ^
          425|

       … while calling 'foldr'

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/lists.nix:53:20:

           52|   */
           53|   foldr = op: nul: list:
             |                    ^
           54|     let

       … from call site

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/lists.nix:60:8:

           59|         else op (elemAt list n) (fold' (n + 1));
           60|     in fold' 0;
             |        ^
           61|

       … while calling 'fold''

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/lists.nix:56:15:

           55|       len = length list;
           56|       fold' = n:
             |               ^
           57|         if n == len

       … while calling 'g'

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/attrsets.nix:739:19:

          738|           g =
          739|             name: value:
             |                   ^
          740|             if isAttrs value && cond value

       … from call site

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/attrsets.nix:742:20:

          741|               then recurse (path ++ [name]) value
          742|               else f (path ++ [name]) value;
             |                    ^
          743|         in mapAttrs g;

       … while calling anonymous lambda

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `warnings':

       … while calling anonymous lambda

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/modules.nix:824:28:

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

       … while evaluating definitions from `/nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/nixos/modules/system/boot/systemd.nix':

       … from call site

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/modules.nix:825:137:

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

       … while calling 'dischargeProperties'

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/modules.nix:896:25:

          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … while calling anonymous lambda

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/attrsets.nix:653:10:

          652|     attrs:
          653|     map (name: f name attrs.${name}) (attrNames attrs);
             |          ^
          654|

       … from call site

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/attrsets.nix:653:16:

          652|     attrs:
          653|     map (name: f name attrs.${name}) (attrNames attrs);
             |                ^
          654|

       … while calling anonymous lambda

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/nixos/modules/system/boot/systemd.nix:433:16:

          432|       mapAttrsToList
          433|         (name: service:
             |                ^
          434|           let

       … from call site

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/nixos/modules/system/boot/systemd.nix:440:16:

          439|             concatLists [
          440|               (optional (type == "oneshot" && (restart == "always" || restart == "on-success"))
             |                ^
          441|                 "Service '${name}.service' with 'Type=oneshot' cannot have 'Restart=always' or 'Restart=on-success'"

       … while calling 'optional'

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/lists.nix:359:20:

          358|   */
          359|   optional = cond: elem: if cond then [elem] else [];
             |                    ^
          360|

       … while calling 'g'

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/attrsets.nix:739:19:

          738|           g =
          739|             name: value:
             |                   ^
          740|             if isAttrs value && cond value

       … from call site

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/attrsets.nix:742:20:

          741|               then recurse (path ++ [name]) value
          742|               else f (path ++ [name]) value;
             |                    ^
          743|         in mapAttrs g;

       … while calling anonymous lambda

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `systemd.services."home-manager-relief\\x2dmelone".serviceConfig':

       … from call site

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/modules.nix:846:59:

          845|       if isDefined then
          846|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |                                                           ^
          847|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       … while calling 'merge'

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/types.nix:567:20:

          566|       check = isAttrs;
          567|       merge = loc: defs:
             |                    ^
          568|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:

       … from call site

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/types.nix:568:35:

          567|       merge = loc: defs:
          568|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                   ^
          569|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … while calling 'filterAttrs'

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/attrsets.nix:419:5:

          418|     # The attribute set to filter
          419|     set:
             |     ^
          420|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));

       … while calling anonymous lambda

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/attrsets.nix:420:29:

          419|     set:
          420|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                             ^
          421|

       … from call site

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/attrsets.nix:420:62:

          419|     set:
          420|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                                                              ^
          421|

       … while calling anonymous lambda

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/types.nix:568:51:

          567|       merge = loc: defs:
          568|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                                   ^
          569|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … while calling anonymous lambda

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/types.nix:568:86:

          567|       merge = loc: defs:
          568|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                                                                      ^
          569|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … while calling anonymous lambda

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/modules.nix:824:28:

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

       … while evaluating definitions from `/etc/nixos/home-manager/_.nix':

       … from call site

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/modules.nix:825:137:

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

       … while calling 'dischargeProperties'

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/modules.nix:896:25:

          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … while evaluating derivation 'home-manager-generation'
         whose name attribute is located at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/pkgs/stdenv/generic/make-derivation.nix:351:7

       … while evaluating attribute 'buildCommand' of derivation 'home-manager-generation'

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/pkgs/build-support/trivial-builders/default.nix:98:16:

           97|         enableParallelBuilding = true;
           98|         inherit buildCommand name;
             |                ^
           99|         passAsFile = [ "buildCommand" ]

       … while evaluating derivation 'activation-script'
         whose name attribute is located at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/pkgs/stdenv/generic/make-derivation.nix:351:7

       … while evaluating attribute 'text' of derivation 'activation-script'

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/pkgs/build-support/trivial-builders/default.nix:161:16:

          160|       {
          161|         inherit text executable checkPhase allowSubstitutes preferLocalBuild;
             |                ^
          162|         passAsFile = [ "text" ];

       … while calling 'mkCmd'

         at /nix/store/z28070c27gx6yf5r3jj5gfkjyml9xirr-source/modules/home-environment.nix:646:17:

          645|       let
          646|         mkCmd = res: ''
             |                 ^
          647|             _iNote "Activating %s" "${res.name}"

       … while calling 'g'

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/attrsets.nix:739:19:

          738|           g =
          739|             name: value:
             |                   ^
          740|             if isAttrs value && cond value

       … from call site

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/attrsets.nix:742:20:

          741|               then recurse (path ++ [name]) value
          742|               else f (path ++ [name]) value;
             |                    ^
          743|         in mapAttrs g;

       … while calling anonymous lambda

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `home-manager.users.relief-melone.home.activation.installPackages.data':

       … while calling anonymous lambda

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/modules.nix:824:28:

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

       … while evaluating definitions from `/nix/store/z28070c27gx6yf5r3jj5gfkjyml9xirr-source/modules/home-environment.nix':

       … from call site

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/modules.nix:825:137:

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

       … while calling 'dischargeProperties'

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/modules.nix:896:25:

          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … while evaluating derivation 'home-manager-path'
         whose name attribute is located at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/pkgs/stdenv/generic/make-derivation.nix:351:7

       … while evaluating attribute 'passAsFile' of derivation 'home-manager-path'

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/pkgs/build-support/trivial-builders/default.nix:99:9:

           98|         inherit buildCommand name;
           99|         passAsFile = [ "buildCommand" ]
             |         ^
          100|           ++ (derivationArgs.passAsFile or [ ]);

       … while calling 'g'

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/attrsets.nix:739:19:

          738|           g =
          739|             name: value:
             |                   ^
          740|             if isAttrs value && cond value

       … from call site

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/attrsets.nix:742:20:

          741|               then recurse (path ++ [name]) value
          742|               else f (path ++ [name]) value;
             |                    ^
          743|         in mapAttrs g;

       … while calling anonymous lambda

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `home-manager.users.relief-melone.home.packages':

       … from call site

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/modules.nix:846:59:

          845|       if isDefined then
          846|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |                                                           ^
          847|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       … while calling 'merge'

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/types.nix:537:20:

          536|       check = isList;
          537|       merge = loc: defs:
             |                    ^
          538|         map (x: x.value) (filter (x: x ? value) (concatLists (imap1 (n: def:

       … while calling anonymous lambda

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/types.nix:538:35:

          537|       merge = loc: defs:
          538|         map (x: x.value) (filter (x: x ? value) (concatLists (imap1 (n: def:
             |                                   ^
          539|           imap1 (m: def':

       … while calling anonymous lambda

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/lists.nix:165:29:

          164|   */
          165|   imap1 = f: list: genList (n: f (n + 1) (elemAt list n)) (length list);
             |                             ^
          166|

       … from call site

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/lists.nix:165:32:

          164|   */
          165|   imap1 = f: list: genList (n: f (n + 1) (elemAt list n)) (length list);
             |                                ^
          166|

       … while calling anonymous lambda

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/types.nix:539:21:

          538|         map (x: x.value) (filter (x: x ? value) (concatLists (imap1 (n: def:
          539|           imap1 (m: def':
             |                     ^
          540|             (mergeDefinitions

       … while calling anonymous lambda

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/modules.nix:824:28:

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

       … while evaluating definitions from `/etc/nixos/home-manager/vim.nix':

       … from call site

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/modules.nix:825:137:

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

       … while calling 'dischargeProperties'

         at /nix/store/8sk1p3f5q05wxi8n1g2c7jdiw48x83r3-nixos/nixos/lib/modules.nix:896:25:

          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … while calling anonymous lambda

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/types.nix:592:29:

          591|       merge = loc: defs:
          592|         zipAttrsWith (name: defs:
             |                             ^
          593|           let merged = mergeDefinitions (loc ++ [name]) elemType defs;

       … while calling anonymous lambda

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/modules.nix:824:28:

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

       … while evaluating definitions from `/nix/store/7d6xpsla7gw94hsbwsa79lkpnab269v4-source/modules/transposition.nix':

       … from call site

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/modules.nix:825:137:

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

       … while calling 'dischargeProperties'

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/modules.nix:896:25:

          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … while calling anonymous lambda

         at /nix/store/7d6xpsla7gw94hsbwsa79lkpnab269v4-source/modules/transposition.nix:104:22:

          103|           mapAttrs
          104|             (system: v: v.${attrName} or (
             |                      ^
          105|               abort ''

       … while calling 'g'

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/attrsets.nix:739:19:

          738|           g =
          739|             name: value:
             |                   ^
          740|             if isAttrs value && cond value

       … from call site

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/attrsets.nix:742:20:

          741|               then recurse (path ++ [name]) value
          742|               else f (path ++ [name]) value;
             |                    ^
          743|         in mapAttrs g;

       … while calling anonymous lambda

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `perSystem.x86_64-linux.packages':

       … while calling anonymous lambda

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/modules.nix:824:28:

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

       … while evaluating definitions from `/nix/store/r2162kr39vf55q401skq0vklmgq3l2cv-source/flake-modules/packages.nix, via option perSystem':

       … from call site

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/modules.nix:825:137:

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

       … while calling 'dischargeProperties'

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/modules.nix:896:25:

          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … from call site

         at /nix/store/r2162kr39vf55q401skq0vklmgq3l2cv-source/flake-modules/packages.nix:8:16:

            7|   }: {
            8|     packages = import ../docs {
             |                ^
            9|       inherit modules pkgs;

       … while calling anonymous lambda

         at /nix/store/r2162kr39vf55q401skq0vklmgq3l2cv-source/docs/default.nix:1:1:

            1| {
             | ^
            2|   lib,

       … while calling anonymous lambda

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/modules.nix:506:44:

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

       … while evaluating the module argument `pkgs' in ":anon-15:anon-1":

       … while calling anonymous lambda

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/types.nix:592:29:

          591|       merge = loc: defs:
          592|         zipAttrsWith (name: defs:
             |                             ^
          593|           let merged = mergeDefinitions (loc ++ [name]) elemType defs;

       … while calling anonymous lambda

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/modules.nix:834:19:

          833|           # Avoid sorting if we don't have to.
          834|           if any (def: def.value._type or "" == "order") defs''.values
             |                   ^
          835|           then sortProperties defs''.values

       … while calling anonymous lambda

         at /nix/store/7d6xpsla7gw94hsbwsa79lkpnab269v4-source/modules/perSystem.nix:100:27:

           99|             mapAttrs
          100|               (inputName: input:
             |                           ^
          101|                 builtins.addErrorContext "while retrieving system-dependent attributes for input ${escapeNixIdentifier inputName}" (

       … while retrieving system-dependent attributes for input nixpkgs

       error: Trying to retrieve system-dependent attributes for input nixpkgs, but this input is not a flake. Perhaps flake = false was added to the input declarations by mistake, or you meant to use a different input, or you meant to use plain old inputs, not inputs'.

Yeah, this is incredibly fishy. Are you certain you’re building the config you think you are? The fact that this is talking about flakes suggests that you’re not at all doing what you say (and think) you are.

The nix store should be completely irrelevant at this point, you’re not getting past basic evaluation, none of this should involve the nix store (though in fairness your files look to be evaluated in the nix store, which is a flake feature, again suggesting you’re using flakes despite believing you’re not).

Rollbacks also shouldn’t help, this is an issue with your evaluated configuration, you changed something about your configuration that makes it not evaluate. You can stop desperately throwing tools at this, we need to find out what you changed.

Is that literal and/or did you actually name files _.nix?

If you think this is a wildcard (like *), then to my knowledge that’s not a thing, which again suggests you’re not actually building the configuration you think you are.

If you’re just naming your entrypoints that, note the actual name for entrypoints in the nix world is default.nix


At this point, either you’ve found some world-destroying bug that persists itself on a machine once triggered or something, or you’re just not building the right project.

What is in $NIX_PATH? What directory are these files you’re sharing in? How did you install home-manager (rollback for it should only be a standalone thing, which again points to what you’re saying and doing not matching).

Ah, no your actual config is not in the nix store. And I guess you do use _.nix to name your entrypoints.

But you’re definitely still importing your home-manager config. What’s in that file and how are you importing it?

And specifically, what’s in here?

not really this is the vim.nix. I think one mistake on my side when evaluating was I was under the impression when using
nixos-rebuild -I /another/path/configuration.yaml build to test stuff before /etc/nixos all the imports would also be referenced from that location. But I think that assumption is false and all the imports are still from /etc/nixos then. Anyways what that lead me to is to strip down the /etc/nixos/configuration.nix again and remove home-manager and everything related to it. Now at least that would build so the issue seems to be releated to home-manager.

Here’s the vim.nix

{ pkgs, config, lib, ... }:
let
  nixvim = import (builtins.fetchGit {
    url = "https://github.com/nix-community/nixvim";
  });
in
{
 
  home-manager.users.${config.mainUser} = {
    programs.nixvim.enable = true;

    imports = [
      # For home-manager
      nixvim.homeManagerModules.nixvim
    ];
  };
}

I also tried to strip out all of the imports from the root home-manager config file. However no luck. It seems that as soon as I am importing home-manager.
My whole nixos configuration repo is also public. If you want you can take a look here

Looking from what I found even if I remove all dependencies to home-manager but leave home-manager in the build fails. The build runs again if I remove the first line in imports from the home manager root config file (import "${home-manager}/nixos")

{ config, pkgs, lib, ... }:
let
  release = "23.05";
  home-manager = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/master.tar.gz";
    # home-manager = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/release-${release}.tar.gz";

in
{
  imports = [
    # (import "${home-manager}/nixos")
    # ./git.nix
    # ./vscode.nix
    # ./thunderbird.nix
    # ./spotify.nix
    # ./vim.nix
  ];
  
  # home-manager.useGlobalPkgs = true;

  # home-manager.users.${config.mainUser} = {
  #   home.stateVersion = "${release}";
  # };

}

Wait a second. I think you were right with the vim import. I don’t know what I did wrong but while trying to narrow it down and trying different older commits of home-manager I found that here commenting out the vim.nix import did in fact solve the issue. After then switching back to the current main of home-manager it still held so I might just have made a mistake before and that is in fact the issue. However that triggered another build error that I also saw another using reporting on discord this morning.

Thank you very much at this point for helping out though. I at least now have a configuration with an older home-manager commit now. That’s already worth alot

This is the trace with the current home-manager commit

building Nix...
building the system configuration...
error:
       … while calling anonymous lambda

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/attrsets.nix:956:24:

          955|     let f = attrPath:
          956|       zipAttrsWith (n: values:
             |                        ^
          957|         let here = attrPath ++ [n]; in

       … while calling 'g'

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/attrsets.nix:739:19:

          738|           g =
          739|             name: value:
             |                   ^
          740|             if isAttrs value && cond value

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/attrsets.nix:742:20:

          741|               then recurse (path ++ [name]) value
          742|               else f (path ++ [name]) value;
             |                    ^
          743|         in mapAttrs g;

       … while calling anonymous lambda

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

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

       … while calling anonymous lambda

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:824:28:

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

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

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:825:137:

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

       … while calling 'dischargeProperties'

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:896:25:

          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/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/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/lists.nix:53:20:

           52|   */
           53|   foldr = op: nul: list:
             |                    ^
           54|     let

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/lists.nix:60:8:

           59|         else op (elemAt list n) (fold' (n + 1));
           60|     in fold' 0;
             |        ^
           61|

       … while calling 'fold''

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/lists.nix:56:15:

           55|       len = length list;
           56|       fold' = n:
             |               ^
           57|         if n == len

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/nixos/modules/system/activation/top-level.nix:68:10:

           67|     then throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}"
           68|     else showWarnings config.warnings baseSystem;
             |          ^
           69|

       … while calling 'showWarnings'

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/trivial.nix:424:28:

          423|
          424|   showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings;
             |                            ^
          425|

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/trivial.nix:424:33:

          423|
          424|   showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings;
             |                                 ^
          425|

       … while calling 'foldr'

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/lists.nix:53:20:

           52|   */
           53|   foldr = op: nul: list:
             |                    ^
           54|     let

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/lists.nix:60:8:

           59|         else op (elemAt list n) (fold' (n + 1));
           60|     in fold' 0;
             |        ^
           61|

       … while calling 'fold''

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/lists.nix:56:15:

           55|       len = length list;
           56|       fold' = n:
             |               ^
           57|         if n == len

       … while calling 'g'

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/attrsets.nix:739:19:

          738|           g =
          739|             name: value:
             |                   ^
          740|             if isAttrs value && cond value

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/attrsets.nix:742:20:

          741|               then recurse (path ++ [name]) value
          742|               else f (path ++ [name]) value;
             |                    ^
          743|         in mapAttrs g;

       … while calling anonymous lambda

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `warnings':

       … while calling anonymous lambda

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:824:28:

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

       … while evaluating definitions from `/nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/nixos/modules/system/boot/systemd.nix':

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:825:137:

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

       … while calling 'dischargeProperties'

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:896:25:

          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … while calling anonymous lambda

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/attrsets.nix:653:10:

          652|     attrs:
          653|     map (name: f name attrs.${name}) (attrNames attrs);
             |          ^
          654|

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/attrsets.nix:653:16:

          652|     attrs:
          653|     map (name: f name attrs.${name}) (attrNames attrs);
             |                ^
          654|

       … while calling anonymous lambda

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/nixos/modules/system/boot/systemd.nix:433:16:

          432|       mapAttrsToList
          433|         (name: service:
             |                ^
          434|           let

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/nixos/modules/system/boot/systemd.nix:440:16:

          439|             concatLists [
          440|               (optional (type == "oneshot" && (restart == "always" || restart == "on-success"))
             |                ^
          441|                 "Service '${name}.service' with 'Type=oneshot' cannot have 'Restart=always' or 'Restart=on-success'"

       … while calling 'optional'

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/lists.nix:359:20:

          358|   */
          359|   optional = cond: elem: if cond then [elem] else [];
             |                    ^
          360|

       … while calling 'g'

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/attrsets.nix:739:19:

          738|           g =
          739|             name: value:
             |                   ^
          740|             if isAttrs value && cond value

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/attrsets.nix:742:20:

          741|               then recurse (path ++ [name]) value
          742|               else f (path ++ [name]) value;
             |                    ^
          743|         in mapAttrs g;

       … while calling anonymous lambda

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `systemd.services."home-manager-relief\\x2dmelone".serviceConfig':

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:846:59:

          845|       if isDefined then
          846|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |                                                           ^
          847|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       … while calling 'merge'

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/types.nix:567:20:

          566|       check = isAttrs;
          567|       merge = loc: defs:
             |                    ^
          568|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/types.nix:568:35:

          567|       merge = loc: defs:
          568|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                   ^
          569|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … while calling 'filterAttrs'

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/attrsets.nix:419:5:

          418|     # The attribute set to filter
          419|     set:
             |     ^
          420|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));

       … while calling anonymous lambda

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/attrsets.nix:420:29:

          419|     set:
          420|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                             ^
          421|

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/attrsets.nix:420:62:

          419|     set:
          420|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                                                              ^
          421|

       … while calling anonymous lambda

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/types.nix:568:51:

          567|       merge = loc: defs:
          568|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                                   ^
          569|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … while calling anonymous lambda

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/types.nix:568:86:

          567|       merge = loc: defs:
          568|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                                                                      ^
          569|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … while calling anonymous lambda

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:824:28:

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

       … while evaluating definitions from `/etc/nixos/home-manager/_.nix':

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:825:137:

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

       … while calling 'dischargeProperties'

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:896:25:

          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … while evaluating derivation 'home-manager-generation'
         whose name attribute is located at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'buildCommand' of derivation 'home-manager-generation'

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/pkgs/build-support/trivial-builders/default.nix:87:14:

           86|       enableParallelBuilding = true;
           87|       inherit buildCommand name;
             |              ^
           88|       passAsFile = [ "buildCommand" ]

       … while evaluating derivation 'activation-script'
         whose name attribute is located at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'text' of derivation 'activation-script'

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/pkgs/build-support/trivial-builders/default.nix:148:16:

          147|     runCommand name
          148|       { inherit text executable checkPhase allowSubstitutes preferLocalBuild;
             |                ^
          149|         passAsFile = [ "text" ];

       … while calling 'mkCmd'

         at /nix/store/sz197mqr3sag0aaz2q7kwcb5lgxdfd6x-source/modules/home-environment.nix:646:17:

          645|       let
          646|         mkCmd = res: ''
             |                 ^
          647|             _iNote "Activating %s" "${res.name}"

       … while calling 'g'

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/attrsets.nix:739:19:

          738|           g =
          739|             name: value:
             |                   ^
          740|             if isAttrs value && cond value

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/attrsets.nix:742:20:

          741|               then recurse (path ++ [name]) value
          742|               else f (path ++ [name]) value;
             |                    ^
          743|         in mapAttrs g;

       … while calling anonymous lambda

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `home-manager.users.relief-melone.home.activation.installPackages.data':

       … while calling anonymous lambda

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:824:28:

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

       … while evaluating definitions from `/nix/store/sz197mqr3sag0aaz2q7kwcb5lgxdfd6x-source/modules/home-environment.nix':

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:825:137:

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

       … while calling 'dischargeProperties'

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:896:25:

          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … while evaluating derivation 'home-manager-path'
         whose name attribute is located at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'passAsFile' of derivation 'home-manager-path'

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/pkgs/build-support/trivial-builders/default.nix:88:7:

           87|       inherit buildCommand name;
           88|       passAsFile = [ "buildCommand" ]
             |       ^
           89|         ++ (derivationArgs.passAsFile or []);

       … while calling 'g'

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/attrsets.nix:739:19:

          738|           g =
          739|             name: value:
             |                   ^
          740|             if isAttrs value && cond value

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/attrsets.nix:742:20:

          741|               then recurse (path ++ [name]) value
          742|               else f (path ++ [name]) value;
             |                    ^
          743|         in mapAttrs g;

       … while calling anonymous lambda

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `home-manager.users.relief-melone.home.packages':

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:846:59:

          845|       if isDefined then
          846|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |                                                           ^
          847|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       … while calling 'merge'

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/types.nix:537:20:

          536|       check = isList;
          537|       merge = loc: defs:
             |                    ^
          538|         map (x: x.value) (filter (x: x ? value) (concatLists (imap1 (n: def:

       … while calling anonymous lambda

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/types.nix:538:35:

          537|       merge = loc: defs:
          538|         map (x: x.value) (filter (x: x ? value) (concatLists (imap1 (n: def:
             |                                   ^
          539|           imap1 (m: def':

       … while calling anonymous lambda

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/lists.nix:165:29:

          164|   */
          165|   imap1 = f: list: genList (n: f (n + 1) (elemAt list n)) (length list);
             |                             ^
          166|

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/lists.nix:165:32:

          164|   */
          165|   imap1 = f: list: genList (n: f (n + 1) (elemAt list n)) (length list);
             |                                ^
          166|

       … while calling anonymous lambda

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/types.nix:539:21:

          538|         map (x: x.value) (filter (x: x ? value) (concatLists (imap1 (n: def:
          539|           imap1 (m: def':
             |                     ^
          540|             (mergeDefinitions

       … while calling anonymous lambda

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:824:28:

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

       … while evaluating definitions from `/etc/nixos/home-manager/vim.nix':

       … from call site

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:825:137:

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

       … while calling 'dischargeProperties'

         at /nix/store/7x7rag223pkfcj2y5bqivhch88gkpivq-nixos/nixos/lib/modules.nix:896:25:

          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … while calling anonymous lambda

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/types.nix:592:29:

          591|       merge = loc: defs:
          592|         zipAttrsWith (name: defs:
             |                             ^
          593|           let merged = mergeDefinitions (loc ++ [name]) elemType defs;

       … while calling anonymous lambda

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/modules.nix:824:28:

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

       … while evaluating definitions from `/nix/store/7d6xpsla7gw94hsbwsa79lkpnab269v4-source/modules/transposition.nix':

       … from call site

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/modules.nix:825:137:

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

       … while calling 'dischargeProperties'

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/modules.nix:896:25:

          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … while calling anonymous lambda

         at /nix/store/7d6xpsla7gw94hsbwsa79lkpnab269v4-source/modules/transposition.nix:104:22:

          103|           mapAttrs
          104|             (system: v: v.${attrName} or (
             |                      ^
          105|               abort ''

       … while calling 'g'

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/attrsets.nix:739:19:

          738|           g =
          739|             name: value:
             |                   ^
          740|             if isAttrs value && cond value

       … from call site

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/attrsets.nix:742:20:

          741|               then recurse (path ++ [name]) value
          742|               else f (path ++ [name]) value;
             |                    ^
          743|         in mapAttrs g;

       … while calling anonymous lambda

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `perSystem.x86_64-linux.packages':

       … while calling anonymous lambda

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/modules.nix:824:28:

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

       … while evaluating definitions from `/nix/store/r2162kr39vf55q401skq0vklmgq3l2cv-source/flake-modules/packages.nix, via option perSystem':

       … from call site

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/modules.nix:825:137:

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

       … while calling 'dischargeProperties'

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/modules.nix:896:25:

          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … from call site

         at /nix/store/r2162kr39vf55q401skq0vklmgq3l2cv-source/flake-modules/packages.nix:8:16:

            7|   }: {
            8|     packages = import ../docs {
             |                ^
            9|       inherit modules pkgs;

       … while calling anonymous lambda

         at /nix/store/r2162kr39vf55q401skq0vklmgq3l2cv-source/docs/default.nix:1:1:

            1| {
             | ^
            2|   lib,

       … while calling anonymous lambda

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/modules.nix:506:44:

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

       … while evaluating the module argument `pkgs' in ":anon-15:anon-1":

       … while calling anonymous lambda

         at /nix/store/0g53xyh39z3y90p4d8r341wbqyjy1zhl-source/lib/types.nix:592:29:

          591|       merge = loc: defs:
          592|         zipAttrsWith (name: defs:
             |                             ^
          593|           let merged = mergeDefinitions (loc ++ [name]) elemType defs;

       … while calling anonymous lambda
       
       #..... ommited because of max lenght for this post

       … while retrieving system-dependent attributes for input nixpkgs

       error: Trying to retrieve system-dependent attributes for input nixpkgs, but this input is not a flake. Perhaps flake = false was added to the input declarations by mistake, or you meant to use a different input, or you meant to use plain old inputs, not inputs'.

This will be the culprit. Nixvim is a flake, made compatible with non-flake nix via flake-compat.

Looks like you’re not the only one with this issue, probably an upstream thing: Eval on none flake configuration is broken · Issue #938 · nix-community/nixvim · GitHub

Don’t know what causes it specifically in this instance. I don’t use nixvim and haven’t mixed non-flakes with flakes before.

Have you tried bumping the commit of nixvim you use, just in case that’s outdated compared to your nixpkgs? Oh, no, you’re fetching it without a hash, so you’re just gabbing new commits and reevaluating your config with new inputs every two hours. No wonder things are breaking randomly. Maybe use an actual hash for that, that just sounds painful.

niv might be a helpful tool for you, or flakes if you’re willing to migrate.

Man, flakes solve so many obvious footguns, hope we see them land one day.

Your assumption is correct for relative paths (e.g. ./) if you have absolute paths in there for some reason of course they will be read from the absolute location.

This is why absolute imports are prohibited in pure evaluation, by the way, yet another footgun flakes prevent.

Oh, actually, no, your path declaration is just wrong, you need:

nixos-rebuild -I nixos-config=/another/path/configuration.yaml build

Flakes also prevent this because how you specify which configuration to build makes sense with the new CLI.

Will definitely do. For now I just disabled it which is not a big deal for me at the moment. I still have to work out the other build issue but since others have that issue too I have to see if there maybe is an issue on github already to track it.
Yeah flakes seem pretty cool. Did not get into it but the reproducability lacks with channels as well as just pulling home-manager from master as both of those just change constantly. I think with home-manager I will stick to the commit download rather than the branch. Found this article that goes into building the configuration with flakes.

But I guess flakes are definately not the norm than for the configuration. Probably not the best thing for a still somewhat inexperienced user then?

I don’t know. On the one hand, the actual official docs will sometimes leave you hanging when you use flakes, as they’re written exclusively for traditional nix.

On the other hand, traditional nix has so many footguns (case in point, all the issues in this thread) that flakes just don’t, that I think an inexperienced user would benefit from using them. If you can deal with learning NixOS, flakes aren’t much of a step up in complexity, especially since that unofficial documentation you found exists.

In exchange you get better UX and a clearer mental model of how your configuration actually works.

I personally don’t think organizations that expect any stability should rely on flakes until the concept stabilizes (which I think is going to take another 2 years or so at least), but for personal system configuration where missing an update isn’t the end of the world they’re probably fine, if not beneficial.

Honestly, given the benefits to new users, organizations may still want to jump the gun and just help pushing flakes to stabilization, now there’s a plan and all that might actually be feasible.

Even if you decide to hold off on flakes, I recommend replacing your fetchTarballs with niv, or at least setting the hash so nix stops downloading new commits from underneath your feet.

2 Likes