2021-01-12 00:50:37 +00:00
|
|
|
{ lib
|
2021-01-05 16:56:59 +00:00
|
|
|
, callPackage
|
|
|
|
, python27Packages
|
|
|
|
, installShellFiles
|
|
|
|
, fetchFromGitHub
|
|
|
|
, file
|
|
|
|
, findutils
|
|
|
|
, gettext
|
|
|
|
, bats
|
|
|
|
, bash
|
|
|
|
, doCheck ? true
|
|
|
|
}:
|
|
|
|
let
|
2021-01-24 20:59:28 +00:00
|
|
|
version = "0.4.2";
|
2021-01-05 16:56:59 +00:00
|
|
|
rSrc = fetchFromGitHub {
|
|
|
|
owner = "abathur";
|
|
|
|
repo = "resholve";
|
|
|
|
rev = "v${version}";
|
2021-01-24 20:59:28 +00:00
|
|
|
hash = "sha256-ArUQjqh4LRvFLzHiTIcae0q/VFxFF/X9eOFeRnYmTO0=";
|
2021-01-05 16:56:59 +00:00
|
|
|
};
|
|
|
|
deps = callPackage ./deps.nix {
|
|
|
|
/*
|
|
|
|
resholve needs to patch Oil, but trying to avoid adding
|
|
|
|
them all *to* nixpkgs, since they aren't specific to
|
|
|
|
nix/nixpkgs.
|
|
|
|
*/
|
|
|
|
oilPatches = [
|
|
|
|
"${rSrc}/0001-add_setup_py.patch"
|
|
|
|
"${rSrc}/0002-add_MANIFEST_in.patch"
|
|
|
|
"${rSrc}/0003-fix_codegen_shebang.patch"
|
|
|
|
"${rSrc}/0004-disable-internal-py-yajl-for-nix-built.patch"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
in
|
|
|
|
python27Packages.buildPythonApplication {
|
|
|
|
pname = "resholve";
|
|
|
|
inherit version;
|
|
|
|
src = rSrc;
|
|
|
|
format = "other";
|
|
|
|
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [ deps.oildev python27Packages.ConfigArgParse ];
|
|
|
|
|
|
|
|
patchPhase = ''
|
|
|
|
for file in resholve; do
|
|
|
|
substituteInPlace $file --subst-var-by version ${version}
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
install -Dm755 resholve $out/bin/resholve
|
|
|
|
installManPage resholve.1
|
|
|
|
'';
|
|
|
|
|
|
|
|
inherit doCheck;
|
|
|
|
checkInputs = [ bats ];
|
2021-01-12 00:50:37 +00:00
|
|
|
RESHOLVE_PATH = "${lib.makeBinPath [ file findutils gettext ]}";
|
2021-01-05 16:56:59 +00:00
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
# explicit interpreter for test suite
|
|
|
|
export INTERP="${bash}/bin/bash" PATH="$out/bin:$PATH"
|
|
|
|
patchShebangs .
|
|
|
|
./test.sh
|
|
|
|
'';
|
|
|
|
|
2021-01-12 00:50:37 +00:00
|
|
|
# Do not propagate Python; may be obsoleted by nixos/nixpkgs#102613
|
|
|
|
# for context on why, see abathur/resholve#20
|
|
|
|
postFixup = ''
|
|
|
|
rm $out/nix-support/propagated-build-inputs
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2021-01-05 16:56:59 +00:00
|
|
|
description = "Resolve external shell-script dependencies";
|
|
|
|
homepage = "https://github.com/abathur/resholve";
|
|
|
|
license = with licenses; [ mit ];
|
|
|
|
maintainers = with maintainers; [ abathur ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|