aboutsummaryrefslogtreecommitdiffstats
path: root/modules/scripts/lib.nix
diff options
context:
space:
mode:
authorArpit Chakladar <arpitchakladar+git@gmail.com>2026-08-04 20:01:06 +0530
committerArpit Chakladar <arpitchakladar+git@gmail.com>2026-08-04 20:01:06 +0530
commit0a7afa2d1e576f05253b62c6b17e5e4873fbdebc (patch)
tree4aec8cee7c4db281510bc42ff4e214252428afa4 /modules/scripts/lib.nix
parent2e0f6163f61cb1e4195f1a08ad1148e57a4f5843 (diff)
downloadhome-manager-config-0a7afa2d1e576f05253b62c6b17e5e4873fbdebc.tar.gz
home-manager-config-0a7afa2d1e576f05253b62c6b17e5e4873fbdebc.zip
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
Diffstat (limited to 'modules/scripts/lib.nix')
-rw-r--r--modules/scripts/lib.nix34
1 files changed, 11 insertions, 23 deletions
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 =
{