So here I am trying to use flakes to manage my NixOS systems. I maintain my own fork of Nixpkgs in a branch called myChannel
on github:doronbehar/nixpkgs
. Hence:
$ nix registry list
user flake:nixpkgs github:doronbehar/nixpkgs/myChannel
global flake:blender-bin github:edolstra/nix-warez
global flake:dwarffs github:edolstra/dwarffs
global flake:hydra github:NixOS/hydra
global flake:nimble github:nix-community/flake-nimble
global flake:nix github:NixOS/nix
global flake:nixops github:NixOS/nixops
global flake:nixos-hardware github:NixOS/nixos-hardware
global flake:nixos-homepage github:NixOS/nixos-homepage/flake
global flake:nur github:nix-community/NUR
global flake:nixpkgs/release-19.09 github:edolstra/nixpkgs/release-19.09
global flake:nixpkgs github:NixOS/nixpkgs
global flake:templates github:NixOS/templates
global flake:patchelf github:NixOS/patchelf
Overall this works fine - some packages defined only on my fork are evaluated on nixos-rebuild
. Today, I wanted to get a zoom-us
update quicker then the channels, and so I went to my nixpkgs clone and committed the update to myChannel
and pushed it to my fork. Now, nixos-rebuild switch
won’t update zoom-us
, i.e:
sudo nixos-rebuild switch --impure --flake '/etc/nixos/#'
readlink $(where zoom-us)
Shows zoom-us
wasn’t updated (rebooting or logging in and out won’t help). I think I can notice nixos-rebuild
checks the last commit of the defined nixpkgs flake, but it won’t update it still, apparently.
Maybe this has to do something with NIX_PATH
? Before I started using flakes, I had in /etc/nixos/nixpkgs
a Nixpkgs clone always checked out on myChannel
. And so I set (via nix.nixPath
):
$ echo $NIX_PATH
nixpkgs=/etc/nixos/nixpkgs:nixos-config=/etc/nixos/configuration.nix:nixpkgs-overlays=/etc/nixos/overlays-compat/
Part of the motivation for me to use flakes and nixUnstable
in general was to allow me not to manually go to /etc/nixos/nixpkgs
and git pull
there. Does nixUnstable
even adheres NIX_PATH
? (Excluding of course the compatibility nix-
commands).
Setting and unsetting NIX_PATH
won’t help. I also tried:
sudo env -u NIX_PATH nixos-rebuild switch -I nixpkgs=https://github.com/doronbehar/nixpkgs/archive/myChannel.tar.gz --impure --flake '/etc/nixos/#'
And:
sudo nixos-rebuild switch -I nixpkgs=$PWD --impure --flake '/etc/nixos/#'
Where $PWD
was where my Nixpkgs clone was checked out on myChannel
.
The only way around this I could find is to switch back to nixStable
by:
- Removing
/etc/nixos/flake.nix
- Commenting
nix.package = pkgs.nixUnstable
- Running once (with
nixos-rebuild
usingnixUnstable
):
sudo nixos-rebuild switch -I nixpkgs=https://github.com/doronbehar/nixpkgs/archive/myChannel.tar.gz --impure
- And once more with
nixos-rebuild
usingnixStable
sudo nixos-rebuild switch -I nixpkgs=https://github.com/doronbehar/nixpkgs/archive/myChannel.tar.gz