I am creating my dot files following this tutorial. It successfully works for emacs.d
.
Since I am using NixOS, I tried doing exactly the same steps with symlink creation for the configuration.nix
file. Thus, I did:
1 - On terminal:
[pedro@system:/etc/nixos]$ sudo mv /etc/nixos/configuration.nix ~/.dotfiles/
2 - Then:
[pedro@system:/etc/nixos]$ ln -sf ~/.dotfiles/configuration.nix configuration.nix~
3 - It seems to work fine, as I do:
[pedro@system:/etc/nixos]$ ls -la
total 12
drwxr-xr-x 2 root root 4096 Dec 1 21:41 .
drwxr-xr-x 32 root root 4096 Dec 1 22:00 ..
lrwxrwxrwx 1 root root 39 Dec 1 21:41 configuration.nix~ -> /home/pedro/.dotfiles/configuration.nix
-rw-r--r-- 1 root root 842 Nov 12 17:40 hardware-configuration.nix
After doing some editions and saving the changes, I can't do nixos-rebuild switch
, though. It throws an error:
[pedro@system:/etc/nixos]$ sudo nixos-rebuild switch
warning: Nix search path entry '/etc/nixos/configuration.nix' does not exist, ignoring
error: file 'nixos-config' was not found in the Nix search path (add it using $NIX_PATH or -I), at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/default.nix:1:60
(use '--show-trace' to show detailed location information)
building Nix...
warning: Nix search path entry '/etc/nixos/configuration.nix' does not exist, ignoring
error: file 'nixos-config' was not found in the Nix search path (add it using $NIX_PATH or -I), at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/default.nix:1:60
(use '--show-trace' to show detailed location information)
building the system configuration...
warning: Nix search path entry '/etc/nixos/configuration.nix' does not exist, ignoring
error: file 'nixos-config' was not found in the Nix search path (add it using $NIX_PATH or -I), at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/default.nix:1:60
(use '--show-trace' to show detailed location information)
The ~
after configuration.nix~
might be the problem here. How can I fix this?
Thanks!
Your Step 2 seems to have cause the issue here: The symlink should be called configuration.nix
not configuration.nix~
as you have noticed.
You could fix this by running mv configuration.nix~ configuration.nix
in the /etc/nixos
folder which would rename configuration.nix~
to the correct configuration.nix
.