nix emergency procedure

@mildsunrise@tech.lgbt

Content warning: nix emergency procedure

if you need to downgrade the nixos channel to the version used to build a given system generation, even if nix-channel --list-generations no longer has it, it's still possible!

  • consult the nixos-version file on the system's toplevel
  • pull up hydra's list of builds for the nixos.channel job of your release's jobset
  • go to the build for the matching version string
  • under "build products", copy the URL of the released tar
  • add its contents to the store with e.g. nix-prefetch-url --unpack
  • run The Incantation, replacing PATH as appropriate:
nix-env --profile /nix/var/nix/profiles/per-user/root/channels --upgrade --always --from-expression '_: (import <nixpkgs> {}).runCommand "nixos-26.05" { src = builtins.storePath "PATH"; } "mkdir $out; ln -s $src $out/nixos"'