Skip to content

Commit

Permalink
Allow the 'nix' input to point to the Nix repo (#1013)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
edolstra authored Jun 17, 2024
1 parent ac02085 commit f151954
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 + ''
Expand Down Expand Up @@ -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; [
Expand Down

0 comments on commit f151954

Please sign in to comment.