nixpkgs/pkgs/development/perl-modules/strip-nondeterminism/default.nix
Farid Zakaria 3987b0e481 strip-nondeterminism: file to propagatedBuildInput
`file` is used by the perl script.

```
sub _get_file_type($) {
	my $file=shift;
	open(FILE, '-|') # handle all filenames safely
	  || exec('file', $file)
	  || die "can't exec file: $!";
	my $type=<FILE>;
	close FILE;
	return $type;
}
```

This script is very handy to run within a `nix-build` context,
specifically during the fixupPhase.

Unfortunately, file is not propagated, and does not exist causing the
build to fail. Fix it by adding it.

Co-authored-by: Jonathan Ringer <jonringer@users.noreply.github.com>
2021-06-29 20:51:50 -07:00

40 lines
1.1 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ lib, stdenv, file, fetchFromGitLab, buildPerlPackage, ArchiveZip, ArchiveCpio, shortenPerlShebang }:
buildPerlPackage rec {
pname = "strip-nondeterminism";
version = "1.0.0";
outputs = [ "out" "dev" ]; # no "devdoc"
src = fetchFromGitLab {
owner = "reproducible-builds";
repo = "strip-nondeterminism";
domain = "salsa.debian.org";
rev = version;
sha256 = "1pwar1fyadqxmvb7x4zyw2iawbi5lsfjcg0ps9n9rdjb6an7vv64";
};
# stray test failure
doCheck = false;
nativeBuildInputs = lib.optionals stdenv.isDarwin [ shortenPerlShebang ];
buildInputs = [ ArchiveZip ArchiveCpio ];
propagatedNativeBuildInputs = [ file ];
perlPostHook = ''
# we dont need the debhelper script
rm $out/bin/dh_strip_nondeterminism
rm $out/share/man/man1/dh_strip_nondeterminism.1.gz
'';
postInstall = lib.optionalString stdenv.isDarwin ''
shortenPerlShebang $out/bin/strip-nondeterminism
'';
meta = with lib; {
description = "A Perl module for stripping bits of non-deterministic information";
homepage = "https://reproducible-builds.org/";
license = licenses.gpl3;
maintainers = with maintainers; [ pSub ];
};
}