My NixOS is out of date and I can’t upgrade it. I have a hunch the issue is related to the way I am handling my configuration.nix
. I’ve tried to symbolically link my etc nixos directory to a location inside my home user directory. I am doing something wrong but I am not sure what exactly.
Here is the output of:
$ uname -a
Linux nixoslaptop 6.6.69 #1-NixOS SMP PREEMPT_DYNAMIC Thu Jan 2 09:32:11 UTC 2025 x86_64 GNU/Linux
As you can see, I am running Linux v6.6.69. This shouldn’t be the case because search.nixos.org when looking up linux
, the unstable branch expects v6.12.12. Also take note the last build date from uname
above shows “January 2nd 2025” which means the kernel I am running is over 1 month old.
I am indeed on unstable
and not 24.11
as you can see with this output here:
$ sudo nix-channel --list
nixos https://channels.nixos.org/nixos-unstable
Here is where I think the issue is:
Basic switch output
$ sudo nixos-rebuild switch
error:
… while calling the 'seq' builtin
at /nix/store/apfqvr9kddcl6fscjvb92p4xdrqzcwk0-source/lib/modules.nix:334:18:
333| options = checked options;
334| config = checked (removeAttrs config [ "_module" ]);
| ^
335| _module = checked (config._module);
… while evaluating a branch condition
at /nix/store/apfqvr9kddcl6fscjvb92p4xdrqzcwk0-source/lib/modules.nix:273:9:
272| checkUnmatched =
273| if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
| ^
274| let
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: access to absolute path '/home' is forbidden in pure evaluation mode (use '--impure' to override)
Similarly:
Just switch with upgrade
$ sudo nixos-rebuild switch --upgrade
unpacking 1 channels...
error:
… while calling the 'seq' builtin
at /nix/store/apfqvr9kddcl6fscjvb92p4xdrqzcwk0-source/lib/modules.nix:334:18:
333| options = checked options;
334| config = checked (removeAttrs config [ "_module" ]);
| ^
335| _module = checked (config._module);
… while evaluating a branch condition
at /nix/store/apfqvr9kddcl6fscjvb92p4xdrqzcwk0-source/lib/modules.nix:273:9:
272| checkUnmatched =
273| if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
| ^
274| let
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: access to absolute path '/home' is forbidden in pure evaluation mode (use '--impure' to override)
So I resolved to appending --impure
to the end of my command when I invoke switch:
The output for the command I usually use
$ sudo nixos-rebuild switch --upgrade --impure
unpacking 1 channels...
building the system configuration...
evaluation warning: The option `hardware.pulseaudio' defined in `/nix/store/0agswvb80frv1qqbq32ng1qz15bc7w87-source/configuration.nix' has been renamed to `services.pulseaudio'.
activating the configuration...
setting up /etc...
reloading user units for evangelist...
restarting sysinit-reactivation.target
the following new units were started: NetworkManager-dispatcher.service, sysinit-reactivation.target, systemd-tmpfiles-resetup.service
As you can see in the output, the traceback shows work is being done but before and after, the packages remain the same - - everything is out dated. What might you people recommend I try next? How can I better handle my /etc/nixos/configuration.nix?
Even when running upgrade along with impure, work is being done but my system packages remain out of date.
Even with upgrade and impure, here is the output
$ sudo nixos-rebuild switch --upgrade --impure
[sudo] password for evangelist:
unpacking 1 channels...
building the system configuration...
evaluation warning: The option `hardware.pulseaudio' defined in `/nix/store/0agswvb80frv1qqbq32ng1qz15bc7w87-source/configuration.nix' has been renamed to `services.pulseaudio'.
activating the configuration...
setting up /etc...
reloading user units for evangelist...
restarting sysinit-reactivation.target
the following new units were started: NetworkManager-dispatcher.service
Here is my latest configuration.nix hosted on GitHub. There are a few things to notice. I initialized the repo on January 4th which matches the age of my kernel. As you can see, I have added multiple packages iteratively and progressively over time. When I do and run $ sudo nixos-rebuild switch --upgrade
–impure the NixOS package manager installs the packages. It’s just all prior packages remain obsolete and aren’t being upgraded along with the new packages I am adding. It’s also worth pointing out that at line 240 I have correctly specified `system.stateVersion = “unstable”;
Please note: I realize my configuration.nix
on GitHub is a disaster currently. I intend on reorganizing and modularizing it next. Then I am going to learn Flakes.