Skip to content

Commit 8cd1bf6

Browse files
authored
Merge pull request #310158 from nh2/tracexec
tracexec: Packaging improvements
2 parents 485125d + 57bf7a0 commit 8cd1bf6

File tree

1 file changed

+41
-10
lines changed

1 file changed

+41
-10
lines changed
Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,68 @@
11
{
22
lib,
3-
rustPlatform,
3+
stdenv,
44
fetchFromGitHub,
5+
rustPlatform,
6+
cargo-about,
7+
nix-update-script,
58
}:
6-
7-
rustPlatform.buildRustPackage rec {
9+
let
810
pname = "tracexec";
911
version = "0.2.2";
12+
in
13+
rustPlatform.buildRustPackage {
14+
inherit pname version;
1015

1116
src = fetchFromGitHub {
1217
owner = "kxxt";
1318
repo = "tracexec";
14-
rev = "v${version}";
19+
rev = "refs/tags/v${version}";
1520
hash = "sha256-X2hLaBndeYLBMnDe2MT4pgZiPj0COHG2uTvAbW+JVd4=";
1621
};
1722

1823
cargoHash = "sha256-3xANOv+A4soDcKMINy+RnI8l6uS3koZpw3CMIUCmK5A=";
1924

20-
# Remove test binaries and only retain tracexec
25+
nativeBuildInputs = [
26+
cargo-about
27+
];
28+
29+
# Remove RiscV64 specialisation when this is fixed:
30+
# * https://github.com/NixOS/nixpkgs/pull/310158#pullrequestreview-2046944158
31+
# * https://github.com/rust-vmm/seccompiler/pull/72
32+
cargoBuildFlags = lib.optional stdenv.hostPlatform.isRiscV64 "--no-default-features";
33+
34+
preBuild = ''
35+
sed -i '1ino-clearly-defined = true' about.toml # disable network requests
36+
cargo about generate --config about.toml -o THIRD_PARTY_LICENSES.HTML about.hbs
37+
'';
38+
39+
# Tests don't work for native non-x86 compilation
40+
# because upstream overrides the name of the linker executables,
41+
# see https://github.com/NixOS/nixpkgs/pull/310158#issuecomment-2118845043
42+
doCheck = stdenv.hostPlatform.isx86_64;
43+
44+
checkFlags = [
45+
"--skip=cli::test::log_mode_without_args_works" # `Permission denied` (needs `CAP_SYS_PTRACE`)
46+
"--skip=tracer::test::tracer_emits_exec_event" # needs `/bin/true`
47+
];
48+
2149
postInstall = ''
50+
# Remove test binaries (e.g. `empty-argv`, `corrupted-envp`) and only retain `tracexec`
2251
find "$out/bin" -type f \! -name tracexec -print0 | xargs -0 rm -v
52+
53+
install -Dm644 LICENSE -t "$out/share/licenses/${pname}/"
54+
install -Dm644 THIRD_PARTY_LICENSES.HTML -t "$out/share/licenses/${pname}/"
2355
'';
2456

25-
# ptrace is not allowed in sandbox
26-
doCheck = false;
57+
passthru.updateScript = nix-update-script { };
2758

2859
meta = {
60+
changelog = "https://github.com/kxxt/tracexec/blob/v${version}/CHANGELOG.md";
2961
description = "A small utility for tracing execve{,at} and pre-exec behavior";
3062
homepage = "https://github.com/kxxt/tracexec";
31-
changelog = "https://github.com/kxxt/tracexec/blob/${src.rev}/CHANGELOG.md";
32-
license = lib.licenses.gpl2;
33-
maintainers = with lib.maintainers; [ fpletz ];
63+
license = lib.licenses.gpl2Plus;
3464
mainProgram = "tracexec";
65+
maintainers = with lib.maintainers; [ fpletz nh2 ];
3566
platforms = lib.platforms.linux;
3667
};
3768
}

0 commit comments

Comments
 (0)