From f93f3faf45238243a1069fc89ee11d79774d8ae0 Mon Sep 17 00:00:00 2001
From: Soispha <soispha@vhack.eu>
Date: Fri, 29 Dec 2023 11:58:20 +0100
Subject: fix(sys/svcs/xdg/portals): Set correct permission of shell script

---
 sys/svcs/xdg/default.nix        | 17 ++++++++++-------
 sys/svcs/xdg/scripts/lf_wrapper |  5 +----
 2 files changed, 11 insertions(+), 11 deletions(-)

(limited to 'sys/svcs')

diff --git a/sys/svcs/xdg/default.nix b/sys/svcs/xdg/default.nix
index 73292894..ec17a61d 100644
--- a/sys/svcs/xdg/default.nix
+++ b/sys/svcs/xdg/default.nix
@@ -11,13 +11,16 @@
         enable = true;
         settings = {
           filechooser = {
-            cmd = "${sysLib.writeShellScriptWithLibraryAndKeepPath {
-              name = "lf_wrapper";
-              src = ./scripts/lf_wrapper;
-              dependencies = with pkgs; [
-                lf
-              ];
-            }}/bin/lf_wrapper";
+            cmd = let
+              nativeBuildInputs = with pkgs; [makeWrapper lf gawk coreutils mktemp dash fd gnugrep];
+            in "${pkgs.runCommandLocal "lf_wrapper" {
+                inherit nativeBuildInputs;
+              } ''
+                install -m755 ${./scripts/lf_wrapper} -D "$out/bin/lf_wrapper"
+                patchShebangs "$out/bin/lf_wrapper"
+                wrapProgram "$out/bin/lf_wrapper" --prefix PATH : ${pkgs.lib.makeBinPath nativeBuildInputs};
+                chown -R 1000:100 "$out/bin"
+              ''}/bin/lf_wrapper";
           };
         };
       };
diff --git a/sys/svcs/xdg/scripts/lf_wrapper b/sys/svcs/xdg/scripts/lf_wrapper
index 559acaae..326ffd3f 100755
--- a/sys/svcs/xdg/scripts/lf_wrapper
+++ b/sys/svcs/xdg/scripts/lf_wrapper
@@ -1,7 +1,4 @@
-#!/usr/bin/env dash
-
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="1.10.0" . %SHELL_LIBRARY_PATH
+#!/usr/bin/env sh
 
 # This wrapper script is invoked by xdg-desktop-portal-termfilechooser.
 #
-- 
cgit 1.4.1