aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2021-10-25 17:19:24 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2021-10-29 11:34:01 +0200
commitcc1caa87fbbc11338a650623c7776bf57402cd16 (patch)
tree878cd6695e3a1c5a262a7fdeeaeef32c54c43f55
parent69b89fb46df3b2b0ab189218812efdcf5852f8f2 (diff)
downloadgarage-cc1caa87fbbc11338a650623c7776bf57402cd16.tar.gz
garage-cc1caa87fbbc11338a650623c7776bf57402cd16.zip
Use Rust binaries from Nix instead of rustup
-rw-r--r--default.nix13
-rw-r--r--nix/common.nix6
-rw-r--r--shell.nix14
3 files changed, 11 insertions, 22 deletions
diff --git a/default.nix b/default.nix
index 940f3823..d44d5741 100644
--- a/default.nix
+++ b/default.nix
@@ -11,26 +11,17 @@ with import ./nix/common.nix;
let
crossSystem = { config = target; };
in let
-
pkgs = import pkgsSrc {
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).
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.
*/
- rustChannel = rustDist // {
- cargo = rustDist;
- rustc = rustDist.override {
- targets = [
- (pkgs.rustBuilder.rustLib.realHostTriple pkgs.stdenv.targetPlatform)
- ];
- };
- };
+ rustChannel = pkgs.rustPlatform.rust;
overrides = pkgs.buildPackages.rustBuilder.overrides.all ++ [
(pkgs.rustBuilder.rustLib.makeOverride {
diff --git a/nix/common.nix b/nix/common.nix
index aee38bd8..eafaa088 100644
--- a/nix/common.nix
+++ b/nix/common.nix
@@ -12,16 +12,10 @@ rec {
url = "https://github.com/superboum/cargo2nix";
rev = "1364752cd784764db2ef5b1e1248727cebfae2ce";
};
- rustOverlaySrc = fetchGit {
- # As of 2021-10-05
- url = "https://github.com/oxalica/rust-overlay";
- rev = "9c2fc6a62ccbc6f420d71ecac6bf0b84dbbee64f";
- };
/*
* Shared objects
*/
- rustOverlay = import rustOverlaySrc;
cargo2nix = import cargo2nixSrc;
cargo2nixOverlay = import "${cargo2nixSrc}/overlay";
}
diff --git a/shell.nix b/shell.nix
index f407ed95..a91a9e20 100644
--- a/shell.nix
+++ b/shell.nix
@@ -1,6 +1,5 @@
{
system ? builtins.currentSystem,
- crossSystem ? null,
rust ? true,
integration ? true,
release ? true,
@@ -10,10 +9,9 @@ with import ./nix/common.nix;
let
pkgs = import pkgsSrc {
- inherit system crossSystem;
- overlays = [ cargo2nixOverlay rustOverlay ];
+ inherit system;
+ overlays = [ cargo2nixOverlay ];
};
- rustDist = pkgs.buildPackages.rust-bin.stable.latest.default;
kaniko = (import ./nix/kaniko.nix) pkgs;
in
@@ -60,7 +58,13 @@ function refresh_index {
'';
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 [])
++