2022-09-15 18:32:57 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, makeWrapper
|
|
|
|
, coreutils
|
|
|
|
, diffutils
|
|
|
|
, git
|
|
|
|
, gnugrep
|
|
|
|
, gnused
|
|
|
|
, jq
|
|
|
|
, nix
|
|
|
|
, python3Packages
|
|
|
|
}:
|
2016-12-31 12:31:56 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "common-updater-scripts";
|
|
|
|
|
2022-09-15 18:32:57 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
python3Packages.wrapPython
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonPath = [
|
|
|
|
python3Packages.beautifulsoup4
|
|
|
|
python3Packages.requests
|
|
|
|
];
|
2016-12-31 12:31:56 +00:00
|
|
|
|
2019-06-19 15:45:34 +00:00
|
|
|
dontUnpack = true;
|
2016-12-31 12:31:56 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp ${./scripts}/* $out/bin
|
|
|
|
|
2022-09-15 18:32:57 +00:00
|
|
|
# wrap non python scripts
|
2016-12-31 12:31:56 +00:00
|
|
|
for f in $out/bin/*; do
|
2022-09-15 18:32:57 +00:00
|
|
|
if ! (head -n1 "$f" | grep -q '#!.*/env.*\(python\|pypy\)'); then
|
|
|
|
wrapProgram $f --prefix PATH : ${lib.makeBinPath [ coreutils diffutils git gnugrep gnused jq nix ]}
|
|
|
|
fi
|
2016-12-31 12:31:56 +00:00
|
|
|
done
|
2022-09-15 18:32:57 +00:00
|
|
|
|
|
|
|
# wrap python scripts
|
|
|
|
makeWrapperArgs+=( --prefix PATH : "${lib.makeBinPath [ nix ]}" )
|
|
|
|
wrapPythonPrograms
|
2016-12-31 12:31:56 +00:00
|
|
|
'';
|
|
|
|
}
|