Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deployment/morph: specify ssh config
Pass the ssh configuration file created by terraform to morph. This way no modifications to the local ssh configuration are necessary. NOTE: the latest released morph does allow passing in the ssh config file but the feature is broken. That's why this change also includes a patch to make this work.
- Loading branch information
Showing
3 changed files
with
43 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
self: super: { | ||
z3 = super.callPackage ../pkgs/z3 { }; | ||
|
||
morph = super.morph.overrideAttrs (old: { | ||
# See https://github.com/DBCDK/morph/pull/141 | ||
# Note that this patch does refelct the original content | ||
# of the PR above since it was broken. | ||
patches = [ ../pkgs/morph/sshopts.patch ]; | ||
src = self.fetchFromGitHub { | ||
owner = "DBCDK"; | ||
repo = "morph"; | ||
rev = "c048d6339f18613a1544bc62ff852cb4c6de1042"; | ||
sha256 = "0yb8prji2nqjsj1aiiqnbqaajbi5l17rg8k78ry7pl3a8sqa3h1x"; | ||
}; | ||
}); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
diff --git a/nix/nix.go b/nix/nix.go | ||
index 6a9cfd5..39b0a34 100644 | ||
--- a/nix/nix.go | ||
+++ b/nix/nix.go | ||
@@ -350,6 +350,7 @@ func Push(ctx *ssh.SSHContext, host Host, paths ...string) (err error) { | ||
|
||
var userArg = "" | ||
var keyArg = "" | ||
+ var sshOpts = []string{} | ||
var env = os.Environ() | ||
if host.TargetUser != "" { | ||
userArg = host.TargetUser + "@" | ||
@@ -360,7 +361,13 @@ func Push(ctx *ssh.SSHContext, host Host, paths ...string) (err error) { | ||
keyArg = "?ssh-key=" + ctx.IdentityFile | ||
} | ||
if ctx.SkipHostKeyCheck { | ||
- env = append(env, fmt.Sprintf("NIX_SSHOPTS=%s", "-o StrictHostkeyChecking=No -o UserKnownHostsFile=/dev/null")) | ||
+ sshOpts = append(sshOpts, fmt.Sprintf("%s", "-o StrictHostkeyChecking=No -o UserKnownHostsFile=/dev/null")) | ||
+ } | ||
+ if ctx.ConfigFile != "" { | ||
+ sshOpts = append(sshOpts, fmt.Sprintf("-F %s", ctx.ConfigFile)) | ||
+ } | ||
+ if len(sshOpts) > 0 { | ||
+ env = append(env, fmt.Sprintf("NIX_SSHOPTS=%s", strings.Join(sshOpts, " "))) | ||
} | ||
|
||
options := mkOptions(host) |