From 163debc8a02c63c0ae27feed87286b180341b59a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Tue, 18 Oct 2022 19:53:40 -0300 Subject: [PATCH] Fix running non shell programs --- scripts/default.nix | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/scripts/default.nix b/scripts/default.nix index 254fc48..2a31771 100644 --- a/scripts/default.nix +++ b/scripts/default.nix @@ -3,22 +3,26 @@ with pkgs; let import_script = (_: path: import (path) { inherit config pkgs lib; }); - create_shell_app = (name: text: runtimeInputs: pkgs.writeShellApplication { - inherit name runtimeInputs; - text = (builtins.readFile text); - checkPhase = ""; - }); - create_shell_apps = lib.mapAttrs (name: deps: create_shell_app name ./${name} deps); - in create_shell_apps { - br = []; - bmenu = [ - bemenu - dhist - fish - j4-dmenu-desktop - jq - sway - ]; + create_script = (name: text: runtimeInputs: + let + script_body = pkgs.writeTextFile { + inherit name; + executable = true; + text = '' + ${builtins.readFile text} + ''; + }; + in (pkgs.writeShellApplication { + inherit name runtimeInputs; + text = ''exec ${script_body} "$@"''; + checkPhase = ""; + }) + ); + create_scripts = + lib.mapAttrs (name: deps: create_script name ./${name} deps); + in create_scripts { + br = [ ]; + bmenu = [ bemenu dhist fish j4-dmenu-desktop jq sway ]; } // lib.mapAttrs import_script { wdmenu = ./wdmenu.nix; wlauncher = ./wlauncher.nix;