1{
2 lib,
3 callPackage,
4 python27,
5 fetchFromGitHub,
6 installShellFiles,
7 rSrc,
8 version,
9 oildev,
10 configargparse,
11 gawk,
12 binlore,
13 resholve,
14 resholve-utils,
15}:
16
17let
18 sedparse = python27.pkgs.buildPythonPackage {
19 pname = "sedparse";
20 version = "0.1.2";
21 format = "setuptools";
22 src = fetchFromGitHub {
23 owner = "aureliojargas";
24 repo = "sedparse";
25 rev = "0.1.2";
26 hash = "sha256-Q17A/oJ3GZbdSK55hPaMdw85g43WhTW9tuAuJtDfHHU=";
27 };
28 };
29
30in
31python27.pkgs.buildPythonApplication {
32 pname = "resholve";
33 inherit version;
34 src = rSrc;
35
36 nativeBuildInputs = [ installShellFiles ];
37
38 propagatedBuildInputs = [
39 oildev
40 configargparse
41 sedparse
42 ];
43
44 makeWrapperArgs = [
45 "--prefix PATH : ${lib.makeBinPath [ gawk ]}"
46 ];
47
48 postPatch = ''
49 for file in setup.cfg _resholve/version.py; do
50 substituteInPlace $file --subst-var-by version ${version}
51 done
52 '';
53
54 postInstall = ''
55 installManPage resholve.1
56 '';
57
58 # Do not propagate Python; may be obsoleted by nixos/nixpkgs#102613
59 # for context on why, see abathur/resholve#20
60 postFixup = ''
61 rm $out/nix-support/propagated-build-inputs
62 '';
63
64 passthru = {
65 inherit (resholve-utils)
66 mkDerivation
67 phraseSolution
68 writeScript
69 writeScriptBin
70 ;
71 tests = callPackage ./test.nix {
72 inherit
73 rSrc
74 binlore
75 python27
76 resholve
77 ;
78 };
79 };
80
81 meta = with lib; {
82 description = "Resolve external shell-script dependencies";
83 homepage = "https://github.com/abathur/resholve";
84 changelog = "https://github.com/abathur/resholve/blob/v${version}/CHANGELOG.md";
85 license = with licenses; [ mit ];
86 maintainers = with maintainers; [ abathur ];
87 platforms = platforms.all;
88 knownVulnerabilities = [
89 ''
90 resholve depends on python27 (EOL). While it's safe to
91 run on trusted input in the build sandbox, you should
92 avoid running it on untrusted input.
93 ''
94 ];
95 };
96}