core/pkgs/common-updater/scripts.nix

31 lines
804 B
Nix
Raw Normal View History

2024-05-13 21:24:10 +00:00
{ lib, stdenv, makeWrapper, coreutils, diffutils, git, gnugrep, gnused, jq, nix
, python3Packages }:
2024-05-02 00:46:19 +00:00
stdenv.mkDerivation {
name = "common-updater-scripts";
2024-05-13 21:24:10 +00:00
nativeBuildInputs = [ makeWrapper python3Packages.wrapPython ];
2024-05-02 00:46:19 +00:00
2024-05-13 21:24:10 +00:00
pythonPath = [ python3Packages.beautifulsoup4 python3Packages.requests ];
2024-05-02 00:46:19 +00:00
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
2024-05-13 21:24:10 +00:00
wrapProgram $f --prefix PATH : ${
lib.makeBinPath [ coreutils diffutils git gnugrep gnused jq nix ]
}
2024-05-02 00:46:19 +00:00
fi
done
# wrap python scripts
makeWrapperArgs+=( --prefix PATH : "${lib.makeBinPath [ nix ]}" )
wrapPythonPrograms
'';
}