shmu26
1
I switched to flakes, and now my config files, including flake.nix
, live in
~/nixos-config
I understand that to rebuild, the proper command would be
sudo nixos-rebuild switch --flake .
But it is not finding the flake.nix
file, because it says
path '/home/shmuel' does not contain a 'flake.nix', searching up
error: could not find a flake.nix file
It does not seem to be looking up the correct path.
sokai
2
Hey @shmu26 ,
I think you have 2 options.
- Run your
sudo nixos-rebuild
command inside your new flake directory (~/nixos-config
): cd ~/nixos-config && sudo nixos-rebuild switch --flake .
- Specify the flake directory with the
--flake
parameter: sudo nixos-rebuild switch --flake ~/nixos-config
KR
sokai
3
2 Additions (for myself ;)):
-
@1. “
cd ~/nixos-config && sudo nixos-rebuild switch
” works the same
-
@2.
- “
nixos-rebuild switch --use-remote-sudo --flake ~/nixos-config
” should do the same (without calling nix
with sudo
)
- “
sudo nixos-rebuild switch --flake ~/nixos-config/
” (mention the trailing slash /
), if ~/nixos-config
is a symlink