Nixos-config path in configuration.nix

How can I change nixos-config path in configuration.nix?

I added to configuratoin.nix:
nix.nixPath = [ "nixos-config=/home/mee/.config/home-manager/configuration.nix" ];
then rebuilded it and patch is still /etc/nixos

It looks like in this post someone got a similar config working:

They mention they moved their config before rebuilding. Maybe you can copy your config to expected location before rebuilding and see what happens?

1 Like

As a root I do have now 3 default patchs and 1 as user, just like in that linked topic. I can rebuild it while being in that directory where is config with: sudo nixos-rebuild switch --flake .
Outside that directory as root or user it’s displaying error:

warning: Nix search path entry ‘/nix/var/nix/profiles/per-user/root/channels/nixos’ does not exist.
file ‘nixpkgs/nixos’ was not found in the Nix search path (add it using $NIX_PATH or -I)

For some reason I don’t have nixos directory in /nix/var/nix/profiles/per-user/root/channels/nixos

Maybe by removing stable channel nixos-23.11 that directory was removed from path. Added stable channel again, but it looks like there is still no nixos directory.