about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorene <ene@sils.li>2023-02-25 17:05:21 +0100
committerene <ene@sils.li>2023-02-25 17:05:21 +0100
commit6ec73592f730ce16734fb4e9c502c2781dfa2e2d (patch)
treecf9b44db036c4c366ca620fc0ecf40c591941795
parentFix(scripts): Use ll unwrapped (diff)
downloadnixos-config-6ec73592f730ce16734fb4e9c502c2781dfa2e2d.tar.gz
nixos-config-6ec73592f730ce16734fb4e9c502c2781dfa2e2d.zip
Fix(packages): Use a custom function for packaging ll
-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}"
+    '';
 }