From a2fbb5801109023a6653738ee62524fc861e9ed8 Mon Sep 17 00:00:00 2001 From: xeals Date: Tue, 20 Jun 2023 16:21:11 +1000 Subject: [PATCH] flake: upport channel-less in NUR check Interestingly doesn't actually fail like `nix flake check` does. --- flake.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 31fb387..a1211f7 100644 --- a/flake.nix +++ b/flake.nix @@ -37,11 +37,16 @@ # Normally we'd also run with `--option restrict-eval true`, but # this is incompatible with flakes because reasons. nur = pkgs.writeShellScriptBin "nur-check" '' + # Prefer nixpkgs channel (actual build), otherwise read from flake.lock (CI) + if ! nixpkgs=$(nix-instantiate --find-file nixpkgs 2>/dev/null); then + _rev=$(${pkgs.jq}/bin/jq -r .nodes.nixpkgs.locked.rev flake.lock) + nixpkgs="https://github.com/nixos/nixpkgs/archive/''${_rev}.tar.gz" + fi nix-env -f . -qa \* --meta \ --allowed-uris https://static.rust-lang.org \ --option allow-import-from-derivation true \ --drv-path --show-trace \ - -I nixpkgs=$(nix-instantiate --find-file nixpkgs) \ + -I nixpkgs="$nixpkgs" \ -I ./ \ --json | ${pkgs.jq}/bin/jq -r 'values | .[].name' '';