From f151954d1410046ee3876fd9b33b06c9261fa3d6 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 17 Jun 2024 16:59:19 +0200 Subject: [PATCH] Allow the 'nix' input to point to the Nix repo (#1013) This way, you can build upstream Nix or a branch/fork by doing nix build --override-input github:my-org/nix/my-branch without needing the https://github.com/DeterminateSystems/nix wrapper. --- flake.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 2810c06a2..eff3f58a5 100644 --- a/flake.nix +++ b/flake.nix @@ -55,6 +55,10 @@ ] ++ nixpkgs.lib.optionals (system == "aarch64-linux") [ targets.aarch64-unknown-linux-musl.stable.rust-std ]); + + nixTarballs = forAllSystems ({ system, ... }: + inputs.nix.tarballs_direct.${system} + or "${inputs.nix.checks."${system}".binaryTarball}/nix-${inputs.nix.packages."${system}".default.version}-${system}.tar.xz"); in { overlays.default = final: prev: @@ -87,7 +91,7 @@ RUSTFLAGS = "--cfg tokio_unstable"; cargoTestOptions = f: f ++ [ "--all" ]; - NIX_INSTALLER_TARBALL_PATH = inputs.nix.tarballs_direct.${final.stdenv.system}; + NIX_INSTALLER_TARBALL_PATH = nixTarballs.${final.stdenv.system}; override = { preBuild ? "", ... }: { preBuild = preBuild + '' @@ -132,7 +136,7 @@ name = "nix-install-shell"; RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library"; - NIX_INSTALLER_TARBALL_PATH = inputs.nix.tarballs_direct.${system}; + NIX_INSTALLER_TARBALL_PATH = nixTarballs.${system}; nativeBuildInputs = with pkgs; [ ]; buildInputs = with pkgs; [