-
Notifications
You must be signed in to change notification settings - Fork 78
Description
This may not be the right place to post this but I do not know where else to take this.
I have asked on discourse before but it may be a bit too obscure to get much answers.
https://discourse.nixos.org/t/rebuilding-system-using-niv-fails-in-nixos-22-05/19667/3
I used to pin my nixos nixpkgs commit when rebuilding using niv using a technique shown to me by someone at the local hackerspace about a year ago.
To do this I copied my existing systems configuration into my homedir and initialized niv in it.
I then added a file called sources-dir.nix to the nix/ folder generated by niv:
{ system ? builtins.currentSystem }:
let
sources = import ./sources.nix {};
pkgs = import sources.nixpkgs { inherit system; };
lib = pkgs.lib;
in
pkgs.runCommand "sources" {} (
lib.concatStringsSep "\n" ([
"mkdir $out"
]
++ lib.mapAttrsToList (name: source: "ln -s ${source.outPath} $out/${name}") sources
)
)I then built the system config using the following shell script in the root dir of the config:
sources=$(nix-build nix/sources-dir.nix --no-out-link)
nixos-rebuild rebuild --target-host [email protected] --use-remote-sudo -I "$sources" -I "nixos-config=$PWD/configuration.nix"
This used to work out well until the 22.05 update. Whenever I run the command now I get this very obscure error:
building Nix...
building the system configuration...
error: the string '22.05' is not allowed to refer to a store path (such as '/nix/store/0qma2xzkmp0x3j6gb0936fimvqsp297g-nixpkgs-src')
at /nix/store/363n9qpp2aibismayc93ack9kjbs1da7-sources/nixpkgs/lib/strings.nix:562:26:
561| */
562| versionOlder = v1: v2: compareVersions v2 v1 == 1;
| ^
563|
(use '--show-trace' to show detailed location information)
Here is the same when running it with --show-trace: https://gist.github.com/busti/ca32db85512a374ae62f0a78ae921ef5
I have managed to reproduce the error in a standalone repo: https://github.com/busti/nixos-rebuild_niv-bug/blob/dev/deploy.sh