aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authoralex <alex@pdp7.net>2025-08-10 16:42:20 +0200
committeralexpdp7 <alex@corcoles.net>2025-08-10 16:43:10 +0200
commit4c15b787432e2cb41a0cc63fe4cdac81679faec4 (patch)
tree218560f14fef2995cff5fe3af326be459fb1f80b /scripts
parent023ba50fe6d115b859e5deb28120a0957fa50bcb (diff)
Also run ledger with nix-portable
Diffstat (limited to 'scripts')
-rw-r--r--scripts/p7s/__init__.py9
-rw-r--r--scripts/p7s/ledger.py4
-rw-r--r--scripts/p7s/senpai.py8
-rw-r--r--scripts/pyproject.toml1
4 files changed, 16 insertions, 6 deletions
diff --git a/scripts/p7s/__init__.py b/scripts/p7s/__init__.py
index e1dfa06c..9afc6ba7 100644
--- a/scripts/p7s/__init__.py
+++ b/scripts/p7s/__init__.py
@@ -1,4 +1,11 @@
-import pathlib
+import os, pathlib, shutil, subprocess, sys
+
+
+def nix_portable(command):
+ def main():
+ os.environ["NP_RUNTIME"] = "bwrap"
+ sys.exit(subprocess.run([shutil.which("nix-portable"), "nix", "run", f"nixpkgs#{command}"] + sys.argv[1:]).returncode)
+ return main
BASHRC_D = pathlib.Path.home() / ".bashrc.d"
diff --git a/scripts/p7s/ledger.py b/scripts/p7s/ledger.py
new file mode 100644
index 00000000..645fd106
--- /dev/null
+++ b/scripts/p7s/ledger.py
@@ -0,0 +1,4 @@
+import p7s
+
+
+main = p7s.nix_portable("ledger")
diff --git a/scripts/p7s/senpai.py b/scripts/p7s/senpai.py
index 60629879..81956ce3 100644
--- a/scripts/p7s/senpai.py
+++ b/scripts/p7s/senpai.py
@@ -1,6 +1,4 @@
-#!/usr/bin/python3
-import os, shutil, subprocess, sys
+import p7s
-def main():
- os.environ["NP_RUNTIME"] = "bwrap"
- sys.exit(subprocess.run([shutil.which("nix-portable"), "nix", "run", "nixpkgs#senpai"]).returncode)
+
+main = p7s.nix_portable("senpai")
diff --git a/scripts/pyproject.toml b/scripts/pyproject.toml
index b7b5ecf6..0ebf6573 100644
--- a/scripts/pyproject.toml
+++ b/scripts/pyproject.toml
@@ -29,3 +29,4 @@ setup_ubpkg = 'p7s.ubpkg:setup_ubpkg'
setup_paperwm = 'p7s.paperwm:setup_paperwm'
setup_x12 = 'p7s.x12:setup_x12'
senpai = 'p7s.senpai:main'
+ledger = 'p7s.ledger:main'