cargo-auditable: Move builder to seperate file
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
rustPlatform,
|
||||
fetchFromGitHub,
|
||||
installShellFiles,
|
||||
auditable-bootstrap,
|
||||
}:
|
||||
lib.extendMkDerivation {
|
||||
constructDrv = rustPlatform.buildRustPackage.override { cargo-auditable = auditable-bootstrap; };
|
||||
|
||||
extendDrvArgs =
|
||||
finalAttrs:
|
||||
{
|
||||
pname ? "cargo-auditable",
|
||||
auditable ? true,
|
||||
hash ? "",
|
||||
cargoHash ? "",
|
||||
...
|
||||
}:
|
||||
{
|
||||
inherit auditable pname;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "rust-secure-code";
|
||||
repo = "cargo-auditable";
|
||||
tag = "v${finalAttrs.version}";
|
||||
inherit hash;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
installShellFiles
|
||||
];
|
||||
|
||||
checkFlags = [
|
||||
# requires wasm32-unknown-unknown target
|
||||
"--skip=test_wasm"
|
||||
# Seems to be a bug in tests of locked vs. semver compatible packages
|
||||
# https://github.com/rust-secure-code/cargo-auditable/issues/235
|
||||
"--skip=test_proc_macro"
|
||||
"--skip=test_self_hosting"
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
installManPage cargo-auditable/cargo-auditable.1
|
||||
'';
|
||||
|
||||
passthru.bootstrap = auditable-bootstrap;
|
||||
|
||||
meta = {
|
||||
description = "Tool to make production Rust binaries auditable";
|
||||
mainProgram = "cargo-auditable";
|
||||
homepage = "https://github.com/rust-secure-code/cargo-auditable";
|
||||
changelog = "https://github.com/rust-secure-code/cargo-auditable/blob/v${finalAttrs.version}/cargo-auditable/CHANGELOG.md";
|
||||
license = with lib.licenses; [
|
||||
mit # or
|
||||
asl20
|
||||
];
|
||||
maintainers = with lib.maintainers; [ RossSmyth ];
|
||||
broken = stdenv.hostPlatform != stdenv.buildPlatform;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,13 +1,11 @@
|
||||
{
|
||||
lib,
|
||||
buildPackages,
|
||||
fetchFromGitHub,
|
||||
callPackage,
|
||||
makeRustPlatform,
|
||||
installShellFiles,
|
||||
stdenv,
|
||||
}:
|
||||
|
||||
let
|
||||
# Need to use the build platform rustc and Cargo so that
|
||||
# we don't infrec
|
||||
rustPlatform = makeRustPlatform {
|
||||
inherit (buildPackages) rustc;
|
||||
cargo = buildPackages.cargo.override {
|
||||
@@ -15,71 +13,23 @@ let
|
||||
};
|
||||
};
|
||||
|
||||
auditableBuilder = lib.extendMkDerivation {
|
||||
constructDrv = rustPlatform.buildRustPackage.override { cargo-auditable = bootstrap; };
|
||||
|
||||
extendDrvArgs =
|
||||
finalAttrs:
|
||||
{
|
||||
pname ? "cargo-auditable",
|
||||
auditable ? true,
|
||||
...
|
||||
}:
|
||||
{
|
||||
inherit auditable pname;
|
||||
version = "0.6.5";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "rust-secure-code";
|
||||
repo = "cargo-auditable";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-zjv2/qZM0vRyz45DeKRtPHaamv2iLtjpSedVTEXeDr8=";
|
||||
};
|
||||
|
||||
cargoHash = "sha256-oTPGmoGlNfPVZ6qha/oXyPJp94fT2cNlVggbIGHf2bc=";
|
||||
|
||||
nativeBuildInputs = [
|
||||
installShellFiles
|
||||
];
|
||||
|
||||
checkFlags = [
|
||||
# requires wasm32-unknown-unknown target
|
||||
"--skip=test_wasm"
|
||||
# Seems to be a bug in tests of locked vs. semver compatible packages
|
||||
# https://github.com/rust-secure-code/cargo-auditable/issues/235
|
||||
"--skip=test_proc_macro"
|
||||
"--skip=test_self_hosting"
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
installManPage cargo-auditable/cargo-auditable.1
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit bootstrap;
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Tool to make production Rust binaries auditable";
|
||||
mainProgram = "cargo-auditable";
|
||||
homepage = "https://github.com/rust-secure-code/cargo-auditable";
|
||||
changelog = "https://github.com/rust-secure-code/cargo-auditable/blob/v${finalAttrs.version}/cargo-auditable/CHANGELOG.md";
|
||||
license = with lib.licenses; [
|
||||
mit # or
|
||||
asl20
|
||||
];
|
||||
maintainers = with lib.maintainers; [ RossSmyth ];
|
||||
broken = stdenv.hostPlatform != stdenv.buildPlatform;
|
||||
};
|
||||
};
|
||||
auditableBuilder = callPackage ./builder.nix {
|
||||
inherit rustPlatform;
|
||||
auditable-bootstrap = bootstrap;
|
||||
};
|
||||
|
||||
hash = "sha256-zjv2/qZM0vRyz45DeKRtPHaamv2iLtjpSedVTEXeDr8=";
|
||||
cargoHash = "sha256-oTPGmoGlNfPVZ6qha/oXyPJp94fT2cNlVggbIGHf2bc=";
|
||||
version = "0.6.5";
|
||||
|
||||
# cargo-auditable cannot be built with cargo-auditable until cargo-auditable is built
|
||||
bootstrap = auditableBuilder {
|
||||
inherit version hash cargoHash;
|
||||
pname = "cargo-auditable-bootstrap";
|
||||
auditable = false;
|
||||
};
|
||||
in
|
||||
auditableBuilder {
|
||||
inherit version hash cargoHash;
|
||||
auditable = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user