From 0a7afa2d1e576f05253b62c6b17e5e4873fbdebc Mon Sep 17 00:00:00 2001 From: Arpit Chakladar Date: Tue, 4 Aug 2026 20:01:06 +0530 Subject: feat: moved gpg data directory, other gopass ssh keys, script builder - Using ~/.local/share/gnupg/ for storing the data for gnupg, and made the necessary changes in all places to that effect - Additional ssh keys can be added to gopass under ssh/, which is on top of the git servers that already existed - Using pkgs.writeShellApplication for creating the scripts, stopped setting path for each dependency (creating a long PATH variable and thus finding binaries may take longer), instead using the inbuild dependency (runtimeInputs) for the scripts --- modules/scripts/lib.nix | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) (limited to 'modules/scripts/lib.nix') diff --git a/modules/scripts/lib.nix b/modules/scripts/lib.nix index 2d2aed3..70affba 100644 --- a/modules/scripts/lib.nix +++ b/modules/scripts/lib.nix @@ -8,31 +8,19 @@ let descLines = lib.filter (s: s != "") (lib.splitString "\n" description); descComment = if descLines == [ ] then "" else lib.concatMapStringsSep "\n" (line: "# ${line}") descLines + "\n"; - envVars = lib.concatStringsSep "\n" (lib.mapAttrsToList (n: v: "${n}=\"${toString v}\"") env); - wrappedScript = pkgs.writeTextFile { - name = name; - executable = true; - destination = "/bin/${name}"; - text = '' - #!${shell} - ${descComment}${envVars} - ${builtins.readFile path} - ''; - }; + envVars = lib.concatStringsSep "\n" ( + lib.mapAttrsToList (n: v: "export ${n}=${lib.escapeShellArg (toString v)}") env + ); in - pkgs.runCommand name - { - nativeBuildInputs = [ pkgs.makeWrapper ]; - meta.mainProgram = name; - } - '' - mkdir -p $out/bin - cp ${wrappedScript}/bin/${name} $out/bin/${name} - chmod +x $out/bin/${name} - - wrapProgram $out/bin/${name} \ - --prefix PATH : ${lib.makeBinPath deps} + pkgs.writeShellApplication { + inherit name; + runtimeInputs = deps; + text = '' + #!${shell} + ${descComment}${envVars} + ${builtins.readFile path} ''; + }; mkScriptModule = { -- cgit v1.2.3