btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / by-name / tr / tracexec / package.nix
bloba5fc0c456f83798bf0fb29f693b92f3e8566108f
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   rustPlatform,
6   cargo-about,
7   nix-update-script,
8 }:
9 let
10   pname = "tracexec";
11   version = "0.5.2";
13 rustPlatform.buildRustPackage {
14   inherit pname version;
16   src = fetchFromGitHub {
17     owner = "kxxt";
18     repo = "tracexec";
19     rev = "refs/tags/v${version}";
20     hash = "sha256-PLUB0t9eDR0mYUI6TiUxafo6yMymwdTux7ykF8rTGGc=";
21   };
23   cargoHash = "sha256-PJclGjQTAOvnl8LJTxlDyEuzdWE1R7A2gJe1I1sKde0=";
25   nativeBuildInputs = [ cargo-about ];
27   # Remove RiscV64 specialisation when this is fixed:
28   # * https://github.com/NixOS/nixpkgs/pull/310158#pullrequestreview-2046944158
29   # * https://github.com/rust-vmm/seccompiler/pull/72
30   cargoBuildFlags = lib.optional stdenv.hostPlatform.isRiscV64 "--no-default-features";
32   preBuild = ''
33     sed -i '1ino-clearly-defined = true' about.toml  # disable network requests
34     cargo about generate --config about.toml -o THIRD_PARTY_LICENSES.HTML about.hbs
35   '';
37   # Tests don't work for native non-x86 compilation
38   # because upstream overrides the name of the linker executables,
39   # see https://github.com/NixOS/nixpkgs/pull/310158#issuecomment-2118845043
40   doCheck = stdenv.hostPlatform.isx86_64;
42   checkFlags = [
43     "--skip=cli::test::log_mode_without_args_works" # `Permission denied` (needs `CAP_SYS_PTRACE`)
44     "--skip=tracer::test::tracer_emits_exec_event" # needs `/bin/true`
45   ];
47   postInstall = ''
48     # Remove test binaries (e.g. `empty-argv`, `corrupted-envp`) and only retain `tracexec`
49     find "$out/bin" -type f \! -name tracexec -print0 | xargs -0 rm -v
51     install -Dm644 LICENSE -t "$out/share/licenses/tracexec/"
52     install -Dm644 THIRD_PARTY_LICENSES.HTML -t "$out/share/licenses/tracexec/"
53   '';
55   passthru.updateScript = nix-update-script { };
57   meta = {
58     changelog = "https://github.com/kxxt/tracexec/blob/v${version}/CHANGELOG.md";
59     description = "Small utility for tracing execve{,at} and pre-exec behavior";
60     homepage = "https://github.com/kxxt/tracexec";
61     license = lib.licenses.gpl2Plus;
62     mainProgram = "tracexec";
63     maintainers = with lib.maintainers; [
64       fpletz
65       nh2
66     ];
67     platforms = lib.platforms.linux;
68   };