Help wanted for NixOS config with Flakes and home-manager

Here’s my configuration.

Every time I add a new file to my configuration, I get this error when rebuilding the configuration under a configured system:

command: cd ~/.nix && sudo nixos-rebuild switch --flake '.#sakura'

result:

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

         at /nix/store/3j9garb3574mxikwbi6zn594j8mjd19s-source/lib/attrsets.nix:784:11:

          783|         || pred here (elemAt values 1) (head values) then
          784|           head values
             |           ^
          785|         else

       … while evaluating the attribute 'value'

         at /nix/store/3j9garb3574mxikwbi6zn594j8mjd19s-source/lib/modules.nix:768:9:

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

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

       error: getting status of '/nix/store/icnm9r8vjdm0lir9c5ljib7zrlm338gp-source/modules/programs/lf.nix': No such file or directory

This time is I added configuration of lf.

Also, I can build it under a not configured system.

I’m rather new to Nix, so forgive me.

However, I do not see a file named “lf.nix” in your repo https://github.com/vollowx/.nix/tree/main/modules/programs

If you’re adding files while testing on an existing system, you first need to add (stage) the files in git using a command like git add . (or git add <filename>), otherwise, they won’t be visible to the flake. This also applies when moving and renaming files/folders. Having done that, the flake should then be able to “see” them.

Note: It is not required to commit or push the changes, for the sole purpose of testing them in your local flake.

Thanks a lot! It’s solved now!
I used to do Git commits by git commit -a -m 'commit messages...' since I found this shortcut feature but I didn’t know it won’t include new files :thinking: