Help configuring zsh in home-manager

Now that “everything is working”, and I have my agnoster theme and all, the system started looking in the wrong place for my config files.
My config files are in ~/nixos
but when I open a terminal there, and use the pre-set alias for rebuilding, I get like this:

shmuel@nixos  ~/nixos  update
[sudo] password for shmuel: 
warning: Nix search path entry '/etc/nixos/configuration.nix' does not exist, ignoring
error:
       … while evaluating the attribute 'config'

         at /nix/store/xqqx605vbpb48z074c3csa5nk7b9mxzh-nixos/nixos/lib/modules.nix:322:9:

          321|         options = checked options;
          322|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          323|         _module = checked (config._module);

       … while calling the 'seq' builtin

         at /nix/store/xqqx605vbpb48z074c3csa5nk7b9mxzh-nixos/nixos/lib/modules.nix:322:18:

          321|         options = checked options;
          322|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          323|         _module = checked (config._module);

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

       error: file 'nixos-config' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)
building Nix...
warning: Nix search path entry '/etc/nixos/configuration.nix' does not exist, ignoring
error:
       … while evaluating the attribute 'config'

         at /nix/store/xqqx605vbpb48z074c3csa5nk7b9mxzh-nixos/nixos/lib/modules.nix:322:9:

          321|         options = checked options;
          322|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          323|         _module = checked (config._module);

       … while calling the 'seq' builtin

         at /nix/store/xqqx605vbpb48z074c3csa5nk7b9mxzh-nixos/nixos/lib/modules.nix:322:18:

          321|         options = checked options;
          322|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          323|         _module = checked (config._module);

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

       error: file 'nixos-config' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)
building the system configuration...
warning: Nix search path entry '/etc/nixos/configuration.nix' does not exist, ignoring
error:
       … while evaluating the attribute 'config.system.build.toplevel'

         at /nix/store/xqqx605vbpb48z074c3csa5nk7b9mxzh-nixos/nixos/lib/modules.nix:322:9:

          321|         options = checked options;
          322|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          323|         _module = checked (config._module);

       … while calling the 'seq' builtin

         at /nix/store/xqqx605vbpb48z074c3csa5nk7b9mxzh-nixos/nixos/lib/modules.nix:322:18:

          321|         options = checked options;
          322|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          323|         _module = checked (config._module);

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

       error: file 'nixos-config' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)

if you maybe have any ideas, I will read them tomorrow morning…

You can either symlink your flake to /etc/nixos/flake.nix: sudo ln -s /home/shmuel/nixos/flake.nix /etc/nixos/flake.nix
Or rewrite the alias so that it points to your flake, probably something like but you have to test that sudo nixos-rebuild switch --flake ~/nixos#nixos

1 Like

Perfect. I don’t know why all of the sudden I need to state the path explicitly, but it works.

Because you most like weren’t in the nixos directory anymore when you ran the alias?

1 Like

As we do not know what your alias looks like, we can’t do more than guesses. If you were showing the alias definition we might be able to tell you why it worked before, did not work after and how to properly fix it.

1 Like

Fair enough. I tried again just now, and the command works as expected.