@@ -11,21 +11,21 @@ import (
1111 "io/ioutil"
1212 "os"
1313 "os/exec"
14+ "path"
1415 "path/filepath"
1516 "syscall"
1617 "time"
17- "path"
1818)
1919
2020type Host struct {
21- HealthChecks healthchecks.HealthChecks
22- Name string
23- NixosRelease string
24- TargetHost string
25- Secrets map [string ]secrets.Secret
26- BuildOnly bool
21+ HealthChecks healthchecks.HealthChecks
22+ Name string
23+ NixosRelease string
24+ TargetHost string
25+ Secrets map [string ]secrets.Secret
26+ BuildOnly bool
2727 SubstituteOnDestination bool
28- NixConfig map [string ]string
28+ NixConfig map [string ]string
2929}
3030
3131type NixContext struct {
@@ -144,19 +144,19 @@ func (ctx *NixContext) BuildMachines(deploymentPath string, hosts []Host, nixArg
144144
145145 resultLinkPath := filepath .Join (path .Dir (deploymentPath ), ".gcroots" , path .Base (deploymentPath ))
146146 if ctx .KeepGCRoot {
147- if err = os .MkdirAll (path .Dir (resultLinkPath ), 0755 ) ; err != nil {
148- ctx .KeepGCRoot = false ;
149- fmt .Fprintf (os .Stderr , "Unable to create GC root, skipping: %s" , err )
150- }
147+ if err = os .MkdirAll (path .Dir (resultLinkPath ), 0755 ); err != nil {
148+ ctx .KeepGCRoot = false
149+ fmt .Fprintf (os .Stderr , "Unable to create GC root, skipping: %s" , err )
150+ }
151151 }
152- if ! ctx .KeepGCRoot {
153- // create tmp dir for result link
154- tmpdir , err := ioutil .TempDir ("" , "morph-" )
155- if err != nil {
156- return "" , err
157- }
158- defer os .Remove (tmpdir )
159- resultLinkPath = filepath .Join (tmpdir , "result" )
152+ if ! ctx .KeepGCRoot {
153+ // create tmp dir for result link
154+ tmpdir , err := ioutil .TempDir ("" , "morph-" )
155+ if err != nil {
156+ return "" , err
157+ }
158+ defer os .Remove (tmpdir )
159+ resultLinkPath = filepath .Join (tmpdir , "result" )
160160 }
161161 args := []string {ctx .EvalMachines ,
162162 "-A" , "machines" ,
@@ -180,8 +180,8 @@ func (ctx *NixContext) BuildMachines(deploymentPath string, hosts []Host, nixArg
180180 }
181181
182182 cmd := exec .Command ("nix-build" , args ... )
183- if ! ctx .KeepGCRoot {
184- defer os .Remove (resultLinkPath )
183+ if ! ctx .KeepGCRoot {
184+ defer os .Remove (resultLinkPath )
185185 }
186186
187187 // show process output on attached stdout/stderr
@@ -249,7 +249,7 @@ func Push(ctx *ssh.SSHContext, host Host, paths ...string) (err error) {
249249 keyArg = "?ssh-key=" + ctx .IdentityFile
250250 }
251251 if ctx .SkipHostKeyCheck {
252- env = append (env , fmt .Sprintf ("NIX_SSHOPTS=%s" ,"-o StrictHostkeyChecking=No -o UserKnownHostsFile=/dev/null" ))
252+ env = append (env , fmt .Sprintf ("NIX_SSHOPTS=%s" , "-o StrictHostkeyChecking=No -o UserKnownHostsFile=/dev/null" ))
253253 }
254254
255255 options := mkOptions (host )
0 commit comments