forked from Deuxfleurs/garage
Use Rust binaries from Nix instead of rustup
This commit is contained in:
parent
69b89fb46d
commit
cc1caa87fb
3 changed files with 11 additions and 22 deletions
13
default.nix
13
default.nix
|
@ -11,26 +11,17 @@ with import ./nix/common.nix;
|
||||||
let
|
let
|
||||||
crossSystem = { config = target; };
|
crossSystem = { config = target; };
|
||||||
in let
|
in let
|
||||||
|
|
||||||
pkgs = import pkgsSrc {
|
pkgs = import pkgsSrc {
|
||||||
inherit system crossSystem;
|
inherit system crossSystem;
|
||||||
overlays = [ cargo2nixOverlay rustOverlay ];
|
overlays = [ cargo2nixOverlay ];
|
||||||
};
|
};
|
||||||
rustDist = pkgs.buildPackages.rust-bin.stable.latest.default;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The following complexity should be abstracted by makePackageSet' (note the final quote).
|
The following complexity should be abstracted by makePackageSet' (note the final quote).
|
||||||
However its code uses deprecated features of rust-overlay that can lead to bug.
|
However its code uses deprecated features of rust-overlay that can lead to bug.
|
||||||
Instead, we build our own rustChannel object with the recommended API of rust-overlay.
|
Instead, we build our own rustChannel object with the recommended API of rust-overlay.
|
||||||
*/
|
*/
|
||||||
rustChannel = rustDist // {
|
rustChannel = pkgs.rustPlatform.rust;
|
||||||
cargo = rustDist;
|
|
||||||
rustc = rustDist.override {
|
|
||||||
targets = [
|
|
||||||
(pkgs.rustBuilder.rustLib.realHostTriple pkgs.stdenv.targetPlatform)
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
overrides = pkgs.buildPackages.rustBuilder.overrides.all ++ [
|
overrides = pkgs.buildPackages.rustBuilder.overrides.all ++ [
|
||||||
(pkgs.rustBuilder.rustLib.makeOverride {
|
(pkgs.rustBuilder.rustLib.makeOverride {
|
||||||
|
|
|
@ -12,16 +12,10 @@ rec {
|
||||||
url = "https://github.com/superboum/cargo2nix";
|
url = "https://github.com/superboum/cargo2nix";
|
||||||
rev = "1364752cd784764db2ef5b1e1248727cebfae2ce";
|
rev = "1364752cd784764db2ef5b1e1248727cebfae2ce";
|
||||||
};
|
};
|
||||||
rustOverlaySrc = fetchGit {
|
|
||||||
# As of 2021-10-05
|
|
||||||
url = "https://github.com/oxalica/rust-overlay";
|
|
||||||
rev = "9c2fc6a62ccbc6f420d71ecac6bf0b84dbbee64f";
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Shared objects
|
* Shared objects
|
||||||
*/
|
*/
|
||||||
rustOverlay = import rustOverlaySrc;
|
|
||||||
cargo2nix = import cargo2nixSrc;
|
cargo2nix = import cargo2nixSrc;
|
||||||
cargo2nixOverlay = import "${cargo2nixSrc}/overlay";
|
cargo2nixOverlay = import "${cargo2nixSrc}/overlay";
|
||||||
}
|
}
|
||||||
|
|
14
shell.nix
14
shell.nix
|
@ -1,6 +1,5 @@
|
||||||
{
|
{
|
||||||
system ? builtins.currentSystem,
|
system ? builtins.currentSystem,
|
||||||
crossSystem ? null,
|
|
||||||
rust ? true,
|
rust ? true,
|
||||||
integration ? true,
|
integration ? true,
|
||||||
release ? true,
|
release ? true,
|
||||||
|
@ -10,10 +9,9 @@ with import ./nix/common.nix;
|
||||||
|
|
||||||
let
|
let
|
||||||
pkgs = import pkgsSrc {
|
pkgs = import pkgsSrc {
|
||||||
inherit system crossSystem;
|
inherit system;
|
||||||
overlays = [ cargo2nixOverlay rustOverlay ];
|
overlays = [ cargo2nixOverlay ];
|
||||||
};
|
};
|
||||||
rustDist = pkgs.buildPackages.rust-bin.stable.latest.default;
|
|
||||||
kaniko = (import ./nix/kaniko.nix) pkgs;
|
kaniko = (import ./nix/kaniko.nix) pkgs;
|
||||||
|
|
||||||
in
|
in
|
||||||
|
@ -60,7 +58,13 @@ function refresh_index {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nativeBuildInputs =
|
nativeBuildInputs =
|
||||||
(if rust then [ rustDist (pkgs.callPackage cargo2nix {}).package ] else [])
|
(if rust then [
|
||||||
|
pkgs.rustPlatform.rust.rustc
|
||||||
|
pkgs.rustPlatform.rust.cargo
|
||||||
|
pkgs.clippy
|
||||||
|
pkgs.rustfmt
|
||||||
|
/*(pkgs.callPackage cargo2nix {}).package*/
|
||||||
|
] else [])
|
||||||
++
|
++
|
||||||
(if integration then [ pkgs.s3cmd pkgs.awscli2 pkgs.minio-client pkgs.rclone pkgs.socat pkgs.psmisc pkgs.which ] else [])
|
(if integration then [ pkgs.s3cmd pkgs.awscli2 pkgs.minio-client pkgs.rclone pkgs.socat pkgs.psmisc pkgs.which ] else [])
|
||||||
++
|
++
|
||||||
|
|
Loading…
Reference in a new issue