Merge pull request #310158 from nh2/tracexec

tracexec: Packaging improvements

authored by Niklas Hambüchen and committed by GitHub 8cd1bf6b 485125d6

+41 -10
+41 -10
pkgs/by-name/tr/tracexec/package.nix
··· 1 1 { 2 2 lib, 3 + stdenv, 4 + fetchFromGitHub, 3 5 rustPlatform, 4 - fetchFromGitHub, 6 + cargo-about, 7 + nix-update-script, 5 8 }: 6 - 7 - rustPlatform.buildRustPackage rec { 9 + let 8 10 pname = "tracexec"; 9 11 version = "0.2.2"; 12 + in 13 + rustPlatform.buildRustPackage { 14 + inherit pname version; 10 15 11 16 src = fetchFromGitHub { 12 17 owner = "kxxt"; 13 18 repo = "tracexec"; 14 - rev = "v${version}"; 19 + rev = "refs/tags/v${version}"; 15 20 hash = "sha256-X2hLaBndeYLBMnDe2MT4pgZiPj0COHG2uTvAbW+JVd4="; 16 21 }; 17 22 18 23 cargoHash = "sha256-3xANOv+A4soDcKMINy+RnI8l6uS3koZpw3CMIUCmK5A="; 19 24 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 + 21 49 postInstall = '' 50 + # Remove test binaries (e.g. `empty-argv`, `corrupted-envp`) and only retain `tracexec` 22 51 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}/" 23 55 ''; 24 56 25 - # ptrace is not allowed in sandbox 26 - doCheck = false; 57 + passthru.updateScript = nix-update-script { }; 27 58 28 59 meta = { 60 + changelog = "https://github.com/kxxt/tracexec/blob/v${version}/CHANGELOG.md"; 29 61 description = "A small utility for tracing execve{,at} and pre-exec behavior"; 30 62 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; 34 64 mainProgram = "tracexec"; 65 + maintainers = with lib.maintainers; [ fpletz nh2 ]; 35 66 platforms = lib.platforms.linux; 36 67 }; 37 68 }