Pinning system to a older version of a channel

So, I’ve been stuck on a build from March because any later builds break jackd. It seems that this means that, not only am I completely unable to update pkgs, I can’t even change my system configuration.

Is it possible to work out the commit of my channel and pin to that? If so, might that free me to to install packages and, more importantly, change my system config.

If you rollback your channels you might get the working one back:

sudo nix-channel --rollback
2 Likes

I believe channels don’t auto-update, so “pinning” should be no-op… at least after you get (back) to the version you want.

1 Like

When you know the commit you want, you can build the system with

nixos-rebuild switch -I nixpkgs=https://releases.nixos.org/nixos/19.09/nixos-19.09.2370.e10c65cdb35/nixexprs.tar.xz

2 Likes

Thanks. That is helpful as a start. I failed to mention that I have have several local derivations that I’m trying to maintain as well.

But, generally, it seems it should be doable.

So, the next thing I need to figure out is how to identify the channel generation I was on when things were stable.

Thanks!

If you have a NixOS system generation that works, you should be able to find the NixPkgs commit hash relatively easily.

ls -l /nix/var/nix/profiles/system-NN-link

Very nice.

lrwxrwxrwx 1 root root 87 Apr 25 20:55 /nix/var/nix/profiles/system-179-link -> /nix/store/pbai9j25f3f3yf0hzff0v2rdf79cgdjj-nixos-system-dt2-20.09pre222244.22a3bf9fb9e
lrwxrwxrwx 1 root root 87 Jul 15 12:20 /nix/var/nix/profiles/system-180-link -> /nix/store/hnpn8amify92nwkwbyvfyx2ccxsmg9j3-nixos-system-dt2-20.09pre234242.c71518e75bf
lrwxrwxrwx 1 root root 87 Sep 18 17:51 /nix/var/nix/profiles/system-181-link -> /nix/store/20lrxnzn9x4ngjh25ppzg092yqzhkk2n-nixos-system-dt2-21.03pre243690.441a7da8080

So should those versions, e.g. 20.09pre222244.22a3bf9fb9e, correspond directly to channels I can fall back to? Or must I rely on the file timestamp?

You can just use -I nixpkgs=https://github.com/nixos/nixpkgs/archive/22a3bf9fb9e.tar.gz with the nixos-rebuild command.

Timestamp may be good for you to know when you built that system but what really matters is the nixpkgs hash (and the starting point of version is good to give you idea about ordering among those hashes).

1 Like