NixOS builds everything from source

I am running nixos 22.05 on a new Dell XPS 15. My issue is that every package I am installing (system-wide or user-wide) is built from source. Thus, installing/updating packages takes rather long.
Before I had nixos running on another laptop, where I did not have this issue.

Any ideas what could be causing this?

What channel are you using? Or are you on flakes?

If you’re not tracking a channel closely to what hydra (the upstream build service) is building, you might end up building everything downstream.

If you removed things from nix.settings.substituters you would also get this result, but I very much doubt you did that, even on accident.

I am not using flakes. My channels are configured like this:

$ sudo nix-channel --list
nixos https://nixos.org/channels/nixos-22.05
$ nix-channel --list
nixos-stable https://nixos.org/channels/nixos-22.05
nixos-unstable https://nixos.org/channels/nixos-unstable

I have not touched the substituters setting afaik.

Though, I am currently pinning the nix package to a specific version:

#TODO: https://github.com/NixOS/nix/issues/6572
nix.package = pkgs.nixVersions.nix_2_7;

Could that have something to do with it?

That shoudn’t cause any rebuilds (even though I’d suggest to use 2.8 which is the default for 22.05)

Also, do you perhaps have any overlays configured? Be it in the configuration or in the ~/.config/nixpkgs/overlays.nix, where you have to check your users and roots HOME.

Last but not least, what is the output of nix --experimental-features nix-command show-config|grep subst?

It’ll be hard to say much without seeing your config. One thing you could do to verify the substituter settings would be nix --extra-experimental-features nix-command show-config | egrep 'substituters|trusted-public-keys'

Just checked, the output looks like this:

substituters = https://cache.nixos.org/
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
trusted-substituters =

Please also check for substitute setting!

This is the output:

$ nix --experimental-features nix-command show-config|grep subst
builders-use-substitutes = false
substitute = true
substituters = https://cache.nixos.org/
trusted-substituters =

So everything is set up for substitution. Any overlays, as asked above?

I checked in my root home, there is no .config/nixpkgs.
In my user home, I do not have an overlays.nix, but something to compose pkgs into groups: https://github.com/cornerman/dotfiles/blob/45a1845e9233d0027488723e44545b1a5fab3811/.config/nixpkgs/config.nix

Here is my global nixos configuration from /etc/nixos: GitHub - cornerman/nix: nixos configuration

I suppose your nix-unstable channel is taking precedence over the other, and it’s not using a revision that has packages built.

I’m not confident with how package overrides work, though this looks suspicious:

3 Likes

Interesting, how could I check that? The issue is happening when I am installing in my user from the nixos-stable channel like nix-env -iA nixos-stable.*. And also when installing packages system-wide with nixos-rebuild where mit pkgs come from the nixos channel.

could you just remove the nixpkgs-unstable channel to see if it solves the issue?

As you are using non-flake evaluation is not pure and depending on how you rebuild your system and how you set up sudo, the user based package overrides might leak.

3 Likes

Yes!! You are right. It is this one. I just commented it out, and things are installing without building from source.

1 Like

Thank you to everyone in this thread for helping. Much appreciated <3
The issue was with the inherit pkgs in my .config/nixpkgs/config.nix in my package overrides, as pointed out by @NobbZ .

2 Likes