depot/third_party/nixpkgs/pkgs/common-updater/scripts.nix
Default email d2947cfef0 Project import generated by Copybara.
GitOrigin-RevId: 598f83ebeb2235435189cf84d844b8b73e858e0f
2022-10-06 20:32:54 +02:00

44 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
'';
}