1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 19:51:17 +00:00
nixpkgs/pkgs/common-updater/scripts.nix
José Romildo 19a4717846 directoryListingUpdater: init
Update a package looking for available versions in an html page
2022-10-01 12:27:09 -03:00

45 lines
813 B
Nix

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