about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--home-manager/packages/scripts.nix5
-rw-r--r--lib/default.nix13
2 files changed, 17 insertions, 1 deletions
diff --git a/home-manager/packages/scripts.nix b/home-manager/packages/scripts.nix
index 3bf49fb5..b4354d82 100644
--- a/home-manager/packages/scripts.nix
+++ b/home-manager/packages/scripts.nix
@@ -50,7 +50,10 @@
     path = "wrappers";
     dependencies = builtins.attrValues {}; # TODO add snap-sync
   };
-  ll-scr = pkgs.writeShellScript "ll" (builtins.readFile ./scripts/wrappers/ll);
+  ll-scr = sysLib.makeShellScriptWithLibraryUnwrapped {
+    name = "ll";
+    script = ./scripts/wrappers/ll;
+  };
   # TODO this need to be replaced with a wayland alternative
   #  llp-scr = write_script {
   #     name = "llp";
diff --git a/lib/default.nix b/lib/default.nix
index 0e2caf1b..35e02d45 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -17,4 +17,17 @@
       patchShebangs "$out/bin/${name}"
       wrapProgram "$out/bin/${name}" --prefix PATH : ${pkgs.lib.makeBinPath dependencies}
     '';
+
+  makeShellScriptWithLibraryUnwrapped = {
+    name,
+    script,
+    ...
+  }:
+    pkgs.runCommandLocal name {
+      nativeBuildInputs = [];
+    } ''
+      install -m755 ${script} -D "$out/bin/${name}"
+      sed -i 's|%SHELL_LIBRARY_PATH|${shell-library}/lib|' "$out/bin/${name}"
+      patchShebangs "$out/bin/${name}"
+    '';
 }