chore: Refactor common cargo build derivations into own function
This creates a mkCargoBuild function of the shared bits from clippy and rust-docs uses it for those targets. Change-Id: I44f9f2b319ea4ef1d1236feabdf726f0256d5d70 Reviewed-on: https://cl.snix.dev/c/snix/+/30647 Reviewed-by: Florian Klink <flokli@flokli.de> Autosubmit: Brian Olsen <brian@maven-group.org> Tested-by: besadii
This commit is contained in:
parent
8e609804b9
commit
a82bd9137e
1 changed files with 17 additions and 22 deletions
|
|
@ -36,9 +36,22 @@ let
|
|||
];
|
||||
};
|
||||
|
||||
mkCargoBuild = args: pkgs.stdenv.mkDerivation ({
|
||||
inherit cargoDeps src;
|
||||
PROTO_ROOT = protos;
|
||||
SNIX_BUILD_SANDBOX_SHELL = "/homeless-shelter";
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
cargo
|
||||
pkg-config
|
||||
protobuf
|
||||
rustc
|
||||
rustPlatform.cargoSetupHook
|
||||
] ++ (args.nativeBuildInputs or [ ]);
|
||||
} // (pkgs.lib.removeAttrs args [ "nativeBuildInputs" ]));
|
||||
in
|
||||
{
|
||||
inherit crates protos;
|
||||
inherit crates protos mkCargoBuild;
|
||||
|
||||
# Provide the snix logo in both .webp and .png format.
|
||||
logo = pkgs.runCommand "logo"
|
||||
|
|
@ -63,19 +76,8 @@ in
|
|||
shell-integration = (import ./shell.nix { inherit pkgs; withIntegration = true; });
|
||||
|
||||
# Build the Rust documentation for publishing on snix.dev/rustdoc.
|
||||
rust-docs = pkgs.stdenv.mkDerivation {
|
||||
inherit cargoDeps src;
|
||||
rust-docs = mkCargoBuild {
|
||||
name = "snix-rust-docs";
|
||||
PROTO_ROOT = protos;
|
||||
SNIX_BUILD_SANDBOX_SHELL = "/homeless-shelter";
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
cargo
|
||||
pkg-config
|
||||
protobuf
|
||||
rustc
|
||||
rustPlatform.cargoSetupHook
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
pkgs.fuse
|
||||
|
|
@ -89,22 +91,15 @@ in
|
|||
|
||||
# Run cargo clippy. We run it with -Dwarnings, so warnings cause a nonzero
|
||||
# exit code.
|
||||
clippy = pkgs.stdenv.mkDerivation {
|
||||
inherit cargoDeps src;
|
||||
clippy = mkCargoBuild {
|
||||
name = "snix-clippy";
|
||||
PROTO_ROOT = protos;
|
||||
SNIX_BUILD_SANDBOX_SHELL = "/homeless-shelter";
|
||||
|
||||
buildInputs = [
|
||||
pkgs.fuse
|
||||
];
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
cargo
|
||||
clippy
|
||||
pkg-config
|
||||
protobuf
|
||||
rustc
|
||||
rustPlatform.cargoSetupHook
|
||||
];
|
||||
|
||||
buildPhase = "cargo clippy --tests --all-features --benches --examples -- -Dwarnings | tee $out";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue