diff options
| author | 2025-12-11 20:42:41 +0000 | |
|---|---|---|
| committer | 2025-12-11 20:42:41 +0000 | |
| commit | 3a7b48d67de536538d755f6d18af71cc65eafc49 (patch) | |
| tree | 869657654cbed6cba94381284f62d451940d7587 | |
| parent | try to make scripts work in nix (diff) | |
| signature | ||
pywb: create wrapper
| -rw-r--r-- | pkgs/default.nix | 13 | ||||
| -rw-r--r-- | pkgs/pywb/default.nix | 29 | ||||
| -rw-r--r-- | pkgs/pywikibot-scripts/default.nix.bak | 29 | ||||
| -rw-r--r-- | pkgs/shell/default.nix | 2 |
4 files changed, 71 insertions, 2 deletions
diff --git a/pkgs/default.nix b/pkgs/default.nix index aee22c3..c115292 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -5,8 +5,17 @@ lib.makeScope newScope (self: { /*example = self.callPackage ./example { };*/ pywikibot-scripts = self.callPackage ./pywikibot-scripts { }; - pywikibot = self.callPackage ./pywikibot { pywikibot-scripts = self.pywikibot-scripts; }; + pywikibot = self.callPackage ./pywikibot { + pywikibot-scripts = self.pywikibot-scripts; + }; + pywb = self.callPackage ./pywb { + pywikibot = self.pywikibot; + pywikibot-scripts = self.pywikibot-scripts; + }; - shell = self.callPackage ./shell { pywikibot = self.pywikibot; }; + shell = self.callPackage ./shell { + pywb = self.pywb; + pywikibot = self.pywikibot; + }; }) diff --git a/pkgs/pywb/default.nix b/pkgs/pywb/default.nix new file mode 100644 index 0000000..9664cd7 --- /dev/null +++ b/pkgs/pywb/default.nix @@ -0,0 +1,29 @@ +{ lib +, writeShellApplication +, python3 +, pywikibot-scripts +, pywikibot +}: + +writeShellApplication { + name = "pywb"; + text = '' + pwbs="${pywikibot-scripts}/${python3.sitePackages}/scripts" + if [ -z "''${1:-}" ]; then + echo "not specified command to run" >&2 + exit 2 + fi + if [ -f "$pwbs/''${1:-}.py" ]; then + exec "${pywikibot}/bin/pwb" "$pwbs/''${1:-}" "$@" + elif [ -f "$pwbs/''${1:-}" ]; then + exec "${pywikibot}/bin/pwb" "$pwbs/''${1:-}" "$@" + else + if [ "$1" = "__get_path" ]; then + echo "$pwbs" + exit + fi + echo "$1 not found in pywkibot's scripts folder (make sure it doesn't end in .py)" >&2 + exit 1 + fi + ''; +} diff --git a/pkgs/pywikibot-scripts/default.nix.bak b/pkgs/pywikibot-scripts/default.nix.bak new file mode 100644 index 0000000..18e9b28 --- /dev/null +++ b/pkgs/pywikibot-scripts/default.nix.bak @@ -0,0 +1,29 @@ +{ + lib, + fetchgit, + python3, + stdenv, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "pywikibot-scripts"; + version = "f1b4b4d0cfbc199c36fb72570425328daa93b067"; + + src = fetchgit { + url = "https://gerrit.wikimedia.org/r/pywikibot/core"; + rev = finalAttrs.version; + fetchSubmodules = true; + hash = "sha256-L/Yz9yidpTV7WCqHs2L6lFw/CpQyZ1UNd+NpMLJT0Hs="; + }; + + wbsitePackages = "${placeholder "out"}/${python3.sitePackages}"; + wbdistInfo = "${finalAttrs.wbsitePackages}/scripts-${finalAttrs.version}.dist-info"; + installPhase = '' + #mkdir -p ${finalAttrs.wbsitePackages} ${finalAttrs.wbdistInfo} + #cp -r $src/scripts/ ${finalAttrs.wbsitePackages}/ + #printf "Metadata-Version: 2.4\nName: scripts\nVersion: ${finalAttrs.version}\n" >${finalAttrs.wbdistInfo}/METADATA + #printf "Wheel-Version: 1.0\n" >${finalAttrs.wbdistInfo}/WHEEL + #echo "scripts" >${finalAttrs.wbdistInfo}/top_level.txt + #touch ${finalAttrs.wbdistInfo}/RECORD + ''; +}) diff --git a/pkgs/shell/default.nix b/pkgs/shell/default.nix index 85fa3a7..3db055d 100644 --- a/pkgs/shell/default.nix +++ b/pkgs/shell/default.nix @@ -8,6 +8,7 @@ , git , internetarchive , pywikibot +, pywb }: mkShellNoCC { @@ -18,6 +19,7 @@ mkShellNoCC { pywikibot ])) pywikibot + pywb websocat # connect to websocket jq libfaketime # used by my fossil script |
