about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--home-manager/wms/river/default.nix2
-rw-r--r--lib/default.nix18
2 files changed, 19 insertions, 1 deletions
diff --git a/home-manager/wms/river/default.nix b/home-manager/wms/river/default.nix
index 2d85e802..d1a8606b 100644
--- a/home-manager/wms/river/default.nix
+++ b/home-manager/wms/river/default.nix
@@ -6,7 +6,7 @@
   ...
 }: {
   xdg.configFile."river/init".source =
-    sysLib.makeShellScriptWithLibrary {
+    sysLib.makeShellScriptWithLibraryAndKeepPath {
       name = "river_init";
       script = ./init;
       dependencies = builtins.attrValues {
diff --git a/lib/default.nix b/lib/default.nix
index f368121a..2704944f 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -23,6 +23,24 @@ in {
       wrapProgram "$out/bin/${name}" --set PATH ${pkgs.lib.makeBinPath shellDependencies}
     '';
 
+  # This dumps the extra things in the default path; TODO fix this
+  makeShellScriptWithLibraryAndKeepPath = {
+    dependencies,
+    name,
+    script,
+    ...
+  }: let
+    shellDependencies = dependencies ++ shellLibraryDeps;
+  in
+    pkgs.runCommandLocal name {
+      nativeBuildInputs = [pkgs.makeWrapper] ++ shellDependencies;
+    } ''
+      install -m755 ${script} -D "$out/bin/${name}"
+      sed -i 's|%SHELL_LIBRARY_PATH|${shell-library}/lib|' "$out/bin/${name}"
+      patchShebangs "$out/bin/${name}"
+      wrapProgram "$out/bin/${name}" --prefix PATH : ${pkgs.lib.makeBinPath shellDependencies}
+    '';
+
   makeShellScriptWithLibraryUnwrapped = {
     name,
     script,