Skip to content

Commit 23e8069

Browse files
authored
Merge pull request #31 from pinpox/use-ssh-opts
Use configurable ssh command and options everywhere
2 parents 502c97c + 2e91627 commit 23e8069

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

flake.nix

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@
5959

6060
# Create parent directory if it does not exist
6161
''
62-
ssh {{.REMOTE_USER}}@{{.REMOTE_HOST}} 'umask 076; sudo -u ${user} mkdir -p "$(dirname ${pkgs.lib.escapeShellArg secretConfig.path})"'
62+
{{.REMOTE_COMMAND}} {{.REMOTE_SSH_OPTS}} {{.REMOTE_USER}}@{{.REMOTE_HOST}} 'umask 076; sudo -u ${user} mkdir -p "$(dirname ${pkgs.lib.escapeShellArg secretConfig.path})"'
6363
''
6464
# Copy file
6565
''
66-
${secretConfig.cmd} | ssh {{.REMOTE_USER}}@{{.REMOTE_HOST}} "umask 077; cat > ${pkgs.lib.escapeShellArg secretConfig.path}"
66+
${secretConfig.cmd} | {{.REMOTE_COMMAND}} {{.REMOTE_SSH_OPTS}} {{.REMOTE_USER}}@{{.REMOTE_HOST}} "umask 077; cat > ${pkgs.lib.escapeShellArg secretConfig.path}"
6767
''
6868
# # Set group and owner
6969
''
70-
ssh {{.REMOTE_USER}}@{{.REMOTE_HOST}} "chown ${secretConfig.owner}:${secretConfig.group-name} ${pkgs.lib.escapeShellArg secretConfig.path}"
70+
{{.REMOTE_COMMAND}} {{.REMOTE_SSH_OPTS}} {{.REMOTE_USER}}@{{.REMOTE_HOST}} "chown ${secretConfig.owner}:${secretConfig.group-name} ${pkgs.lib.escapeShellArg secretConfig.path}"
7171
''
7272
])
7373
userconfig.lollypops.secrets.files))
@@ -130,13 +130,13 @@
130130

131131
# Create parent directory if it does not exist
132132
''
133-
{{.REMOTE_COMMAND}} {{.REMOTE_OPTS}} {{.REMOTE_USER}}@{{.REMOTE_HOST}} \
133+
{{.REMOTE_COMMAND}} {{.REMOTE_SSH_OPTS}} {{.REMOTE_USER}}@{{.REMOTE_HOST}} \
134134
'umask 076; ${optionalString useSudo "{{.REMOTE_SUDO_COMMAND}} {{.REMOTE_SUDO_OPTS}} "} mkdir -p "$(dirname ${path})"'
135135
''
136136

137137
# Copy file
138138
''
139-
${x.cmd} | {{.REMOTE_COMMAND}} {{.REMOTE_OPTS}} {{.REMOTE_USER}}@{{.REMOTE_HOST}} \
139+
${x.cmd} | {{.REMOTE_COMMAND}} {{.REMOTE_SSH_OPTS}} {{.REMOTE_USER}}@{{.REMOTE_HOST}} \
140140
"${optionalString useSudo "{{.REMOTE_SUDO_COMMAND}} {{.REMOTE_SUDO_OPTS}}"} \
141141
install -m 700 /dev/null ${path}; \
142142
${optionalString useSudo "{{.REMOTE_SUDO_COMMAND}} {{.REMOTE_SUDO_OPTS}}"} \
@@ -145,7 +145,7 @@
145145

146146
# Set group and owner
147147
''
148-
{{.REMOTE_COMMAND}} {{.REMOTE_OPTS}} {{.REMOTE_USER}}@{{.REMOTE_HOST}} \
148+
{{.REMOTE_COMMAND}} {{.REMOTE_SSH_OPTS}} {{.REMOTE_USER}}@{{.REMOTE_HOST}} \
149149
"${optionalString useSudo "{{.REMOTE_SUDO_COMMAND}} {{.REMOTE_SUDO_OPTS}}"} \
150150
chown ${x.owner}:${x.group-name} ${path}"
151151
''
@@ -186,7 +186,7 @@
186186
--target-host {{.REMOTE_USER}}@{{.REMOTE_HOST}} \
187187
${optionalString useSudo "--use-remote-sudo"}
188188
'' else ''
189-
{{.REMOTE_COMMAND}} {{.REMOTE_OPTS}} {{.REMOTE_USER}}@{{.REMOTE_HOST}} \
189+
{{.REMOTE_COMMAND}} {{.REMOTE_SSH_OPTS}} {{.REMOTE_USER}}@{{.REMOTE_HOST}} \
190190
"${optionalString useSudo "{{.REMOTE_SUDO_COMMAND}} {{.REMOTE_SUDO_OPTS}}"} nixos-rebuild {{.REBUILD_ACTION}} \
191191
--flake '{{.REMOTE_CONFIG_DIR}}#{{.HOSTNAME}}'"
192192
'')
@@ -206,7 +206,7 @@
206206
fi
207207
${pkgs.rsync}/bin/rsync \
208208
--verbose \
209-
-e {{.REMOTE_COMMAND}}\ -l\ {{.REMOTE_USER}}\ -T \
209+
-e "{{.REMOTE_COMMAND}} -l {{.REMOTE_USER}} -T {{.REMOTE_SSH_OPTS}}" \
210210
-FD \
211211
--checksum \
212212
--times \

0 commit comments

Comments
 (0)