fix(nix/writers/rust): remove args override

We can be closed world, so let’s restrict the arguments to the subset
we need for now.

The existing override was wrong, in that `// args` would use the
arguments we already added, again. So instead of deliberating about
how to make this work right in all cases, we don’t need it, we trim
it.

Change-Id: I6443a0808b8bfd5e4db939b669c6afc741954db8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3057
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
Profpatsch 2021-04-24 13:32:52 +02:00
parent 8dfc7a9f9d
commit 72924facae
2 changed files with 5 additions and 11 deletions

View file

@ -9,9 +9,7 @@ let
bins.s6-ln "-s" path "$out" bins.s6-ln "-s" path "$out"
]; ];
# Build a rust executable. # Build a rust executable, $out is the executable.
# Takes all arguments that `pkgs.buildRustCrate` accepts.
# Rather leaky abstraction.
rustSimple = args@{name, ...}: src: rustSimple = args@{name, ...}: src:
linkTo name "${rustSimpleBin args src}/bin/${name}"; linkTo name "${rustSimpleBin args src}/bin/${name}";
@ -20,8 +18,7 @@ let
name, name,
dependencies ? [], dependencies ? [],
doCheck ? true, doCheck ? true,
... }: src:
}@args: src:
(if doCheck then testRustSimple else pkgs.lib.id) (if doCheck then testRustSimple else pkgs.lib.id)
(pkgs.buildRustCrate ({ (pkgs.buildRustCrate ({
pname = name; pname = name;
@ -37,7 +34,7 @@ let
cp "$srcPath" $out/src/bin/${name}.rs cp "$srcPath" $out/src/bin/${name}.rs
find $out find $out
''; '';
} // args)); }));
# Build a rust library, that can be used as dependency to `rustSimple`. # Build a rust library, that can be used as dependency to `rustSimple`.
# Wrapper around `pkgs.buildRustCrate`, takes all its arguments. # Wrapper around `pkgs.buildRustCrate`, takes all its arguments.
@ -45,8 +42,7 @@ let
name, name,
dependencies ? [], dependencies ? [],
doCheck ? true, doCheck ? true,
... }: src:
}@args: src:
(if doCheck then testRustSimple else pkgs.lib.id) (if doCheck then testRustSimple else pkgs.lib.id)
(pkgs.buildRustCrate ({ (pkgs.buildRustCrate ({
pname = name; pname = name;
@ -61,7 +57,7 @@ let
cp "$srcPath" $out/src/lib.rs cp "$srcPath" $out/src/lib.rs
find $out find $out
''; '';
} // args)); }));
/* Takes a `buildRustCrate` derivation as an input, /* Takes a `buildRustCrate` derivation as an input,
* builds it with `{ buildTests = true; }` and runs * builds it with `{ buildTests = true; }` and runs

View file

@ -7,8 +7,6 @@ let
depot.third_party.rust-crates.nom depot.third_party.rust-crates.nom
depot.users.Profpatsch.execline.exec-helpers depot.users.Profpatsch.execline.exec-helpers
]; ];
release = false;
verbose = true;
} (builtins.readFile ./netencode.rs); } (builtins.readFile ./netencode.rs);
gen = import ./gen.nix { inherit lib; }; gen = import ./gen.nix { inherit lib; };