summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2021-12-08 11:58:54 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2021-12-08 11:58:54 +0100
commitf7bfa8f38cba7da1fb54bcf9e778b4dafeea967e (patch)
tree800a0ebaba60d99b628a1176051eed5e5532a042
parente435d8fe627646e485adaae36d08fc115c22fa20 (diff)
downloadnixos-f7bfa8f38cba7da1fb54bcf9e778b4dafeea967e.tar
nixos-f7bfa8f38cba7da1fb54bcf9e778b4dafeea967e.tar.gz
nixos-f7bfa8f38cba7da1fb54bcf9e778b4dafeea967e.tar.bz2
nixos-f7bfa8f38cba7da1fb54bcf9e778b4dafeea967e.tar.xz
nixos-f7bfa8f38cba7da1fb54bcf9e778b4dafeea967e.zip
gkleen@sif: sshpass-secret
-rw-r--r--accounts/gkleen@sif/default.nix26
1 files changed, 25 insertions, 1 deletions
diff --git a/accounts/gkleen@sif/default.nix b/accounts/gkleen@sif/default.nix
index 64e1e6c0..4f4897f5 100644
--- a/accounts/gkleen@sif/default.nix
+++ b/accounts/gkleen@sif/default.nix
@@ -59,6 +59,30 @@ let
59 wrapProgram $out/bin/zulip \ 59 wrapProgram $out/bin/zulip \
60 --add-flags '--force-device-scale-factor=1.6' 60 --add-flags '--force-device-scale-factor=1.6'
61 ''; 61 '';
62 sshpassSecret = pkgs.writeScriptBin "sshpass-secret" ''
63 #!${pkgs.zsh}/bin/zsh -e
64
65 typeset -a cmd
66 cmd=()
67
68 while
69 if [[ "$#" -le 0 ]]; then
70 echo "Insufficient arguments" >&2
71 exit 2
72 fi
73 arg="''${1}"
74 shift
75 do
76 [[ "''${arg}" == '--' ]] && break
77 user=''${arg%@*}
78 host=''${arg#*@}
79 exec {fdnum}< <(${pkgs.gnome.libsecret}/bin/secret-tool lookup service sshpass host "''${host}" user "''${user}")
80 cmd+=(${pkgs.sshpass}/bin/sshpass -d ''${fdnum} -P "''${user}@''${host}'s password:")
81 done
82
83 cmd+=($@)
84 exec -a ''${cmd[1]} -- $cmd
85 '';
62in { 86in {
63 imports = with flake.nixosModules.userProfiles.${userName}; [ 87 imports = with flake.nixosModules.userProfiles.${userName}; [
64 mpv yt-dlp 88 mpv yt-dlp
@@ -279,7 +303,7 @@ in {
279 skype virt-manager rclone cached-nix-shell xournal discord 303 skype virt-manager rclone cached-nix-shell xournal discord
280 xmonad worktime fira-code-symbols emacsclientDesktopItem 304 xmonad worktime fira-code-symbols emacsclientDesktopItem
281 libreoffice xournalpp wrappedChrome nixos-shell virt-viewer 305 libreoffice xournalpp wrappedChrome nixos-shell virt-viewer
282 freerdp 306 freerdp gnome-icon-theme paper-icon-theme sshpassSecret
283 ]; 307 ];
284 308
285 file = { 309 file = {