about summary refs log tree commit diff
path: root/pkgs/common-updater/scripts.nix
diff options
context:
space:
mode:
authorJosé Romildo <malaquias@gmail.com>2022-09-15 15:32:57 -0300
committerJosé Romildo <malaquias@gmail.com>2022-10-01 12:27:09 -0300
commit19a47178461e509bcd3821cea3b92e8deba20a40 (patch)
treef9384e792139c8f7bebf9c01975a1824a699b283 /pkgs/common-updater/scripts.nix
parente78c23cf5b4e3b5534b480ff1d6a534620d6e395 (diff)
directoryListingUpdater: init
Update a package looking for available versions in an html page
Diffstat (limited to 'pkgs/common-updater/scripts.nix')
-rw-r--r--pkgs/common-updater/scripts.nix32
1 files changed, 29 insertions, 3 deletions
diff --git a/pkgs/common-updater/scripts.nix b/pkgs/common-updater/scripts.nix
index 26c77e8763622..d5ee3b58c504b 100644
--- a/pkgs/common-updater/scripts.nix
+++ b/pkgs/common-updater/scripts.nix
@@ -1,9 +1,28 @@
-{ lib, stdenv, makeWrapper, coreutils, gnused, gnugrep, diffutils, nix, git, jq }:
+{ lib
+, stdenv
+, makeWrapper
+, coreutils
+, diffutils
+, git
+, gnugrep
+, gnused
+, jq
+, nix
+, python3Packages
+}:
 
 stdenv.mkDerivation {
   name = "common-updater-scripts";
 
-  nativeBuildInputs = [ makeWrapper ];
+  nativeBuildInputs = [
+    makeWrapper
+    python3Packages.wrapPython
+  ];
+
+  pythonPath = [
+    python3Packages.beautifulsoup4
+    python3Packages.requests
+  ];
 
   dontUnpack = true;
 
@@ -11,8 +30,15 @@ stdenv.mkDerivation {
     mkdir -p $out/bin
     cp ${./scripts}/* $out/bin
 
+    # wrap non python scripts
     for f in $out/bin/*; do
-      wrapProgram $f --prefix PATH : ${lib.makeBinPath [ coreutils gnused gnugrep nix diffutils git jq ]}
+      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
   '';
 }