I’m having difficulties getting overlays that are working with user’s nix-env
to also apply to the system-wide nixos-rebuild
. Having studied Overlays - NixOS Wiki I’m not getting any wiser - from my understanding of that, this should work.
Any clever heads in here that can spot (or suggest debugging steps to understanding) why [root@USERNAME-desktop:~]# NIX_PATH="$NIX_PATH:nixpkgs-overlays=/etc/nixos/overlays" nixos-rebuild switch
doesn’t pick up the overlays I have in /etc/nixos/overlays/*.nix
?
Details:
I’m on 20.03, having environment.systemPackages = with pkgs; [... nextcloud-client ... ]
in my configuration.nix
so I get nextcloud-client version 2.6.4:
[root@USERNAME-desktop:~]# nix-channel --update
unpacking channels...
created 1 symlinks in user environment
[root@USERNAME-desktop:~]# nix-channel --list
nixos https://nixos.org/channels/nixos-20.03
[root@USERNAME-desktop:~]# nix-env -e nextcloud-client
[root@USERNAME-desktop:~]# nixos-rebuild switch
building Nix...
building the system configuration...
activating the configuration...
setting up /etc...
reloading user units for USERNAME...
setting up tmpfiles
[root@USERNAME-desktop:~]# nextcloud --version
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Nextcloud version 2.6.4git
Git revision b45f5fd1a947dc21eb11c69049a99616a2ec950e
Using Qt 5.12.7, built against Qt 5.12.7
Using 'OpenSSL 1.1.1g 21 Apr 2020'
I have an overlay in /etc/nixos/overlays/nextcloud-client.nix
to get version 3.0.3:
root@USERNAME-desktop:~]# cat /etc/nixos/overlays/nextcloud-client.nix
self: super: {
nextcloud-client = super.nextcloud-client.overrideAttrs (old: rec{
version = "3.0.3";
src = super.fetchFromGitHub {
owner = "nextcloud";
repo = "desktop";
rev = "v3.0.3";
sha256 = "0idh8i71jivdjjs2y62l22yl3qxwgcr0hf53dad587bzgkkkr223";
};
buildInputs = old.buildInputs ++ [
super.qt5.qtquickcontrols2
super.qt5.qtgraphicaleffects
];
});
}
I would expect this nixos-rebuild switch
to pick up the overlay, but it doesn’t:
[root@USERNAME-desktop:~]# NIX_PATH="$NIX_PATH:nixpkgs-overlays=/etc/nixos/overlays" nixos-rebuild switch
building Nix...
building the system configuration...
activating the configuration...
setting up /etc...
reloading user units for USERNAME...
setting up tmpfiles
[root@USERNAME-desktop:~]# nextcloud --version
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Nextcloud version 2.6.4git
Git revision b45f5fd1a947dc21eb11c69049a99616a2ec950e
Using Qt 5.12.7, built against Qt 5.12.7
Using 'OpenSSL 1.1.1g 21 Apr 2020'
While nix-env
does:
[root@USERNAME-desktop:~]# NIX_PATH="$NIX_PATH:nixpkgs-overlays=/etc/nixos/overlays" nix-env -i nextcloud-client
installing 'nextcloud-client-3.0.3'
building '/nix/store/il2f3z8jd5hq8mcjp4nk6vhgagww6k8i-user-environment.drv'...
created 17 symlinks in user environment
[root@USERNAME-desktop:~]# nextcloud --version
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Nextcloud version 3.0.3git
Git revision 78da725ac38e1508e5800d02fd1700a4e43b1088
Using Qt 5.12.7, built against Qt 5.12.7
Using Qt platform plugin 'xcb'
Using 'OpenSSL 1.1.1g 21 Apr 2020'
Running on NixOS 20.03 (Markhor), x86_64
And the bit of the wiki from which I understand that both of the above should bring in the overlay:
On the system level
If you want your overlays to be accessible by nix tools and also in the system-wide configuration, add nixpkgs-overlays to your NIX_PATH:
NIX_PATH="$NIX_PATH:nixpkgs-overlays=/etc/nixos/overlays"
Currently nixos-rebuild only works with a path that is a directory.
Finally, the whole lot of the code lives here: nixos · master · Egon Kidmose / dotfiles · GitLab