nix/fetchcargo: restrict src to just Cargo.{toml,lock}

should result in less -vendor pkgs in the nix store
This commit is contained in:
Astro 2019-05-09 20:58:57 +02:00
parent 3d844977ef
commit c420dcad9e
2 changed files with 14 additions and 2 deletions

View File

@ -8,7 +8,7 @@ let
inherit (rust) cargo;
};
adc2tcpDeps = fetchcargo {
name = "adc2tcp-deps";
name = "adc2tcp";
src = ../.;
inherit sha256;
};

View File

@ -1,9 +1,21 @@
{ stdenv, cacert, git, cargo, cargo-vendor }:
{ name, src, sha256 }:
let
# `src` restricted to the two files that define dependencies
cargoOnlySrc = stdenv.mkDerivation {
name = "${name}-cargo";
inherit src;
phases = "installPhase";
installPhase = ''
mkdir $out
cp ${src}/Cargo.{toml,lock} $out/
'';
};
in
stdenv.mkDerivation {
name = "${name}-vendor";
nativeBuildInputs = [ cacert git cargo cargo-vendor ];
inherit src;
src = cargoOnlySrc;
phases = "unpackPhase patchPhase installPhase";