mirror of
https://code.dumpstack.io/tools/appvm.git
synced 2024-12-25 12:29:48 +00:00
Save app nix description to config directory
This commit is contained in:
parent
f18d55bd27
commit
6ebc562599
2
appvm.go
2
appvm.go
@ -46,6 +46,8 @@ func getAppVMExpressionPath(name string) (paths []string, config string) {
|
||||
paths = strings.Split(os.Getenv("NIX_PATH"), ":")
|
||||
config = "nix/" + name + ".nix"
|
||||
|
||||
paths = append(paths, configDir)
|
||||
|
||||
for _, a := range paths {
|
||||
searchpath := a
|
||||
log.Print("Searching " + searchpath + " for expressions")
|
||||
|
12
generate.go
12
generate.go
@ -88,6 +88,16 @@ func generate(l *libvirt.Libvirt, name, bin string) {
|
||||
}
|
||||
|
||||
realName := strings.Split(name, ".")[1]
|
||||
appFilename := configDir + "/nix/" + realName + ".nix"
|
||||
|
||||
fmt.Printf(template, realName, bin)
|
||||
appNixConfig := fmt.Sprintf(template, realName, bin)
|
||||
|
||||
err = ioutil.WriteFile(appFilename, []byte(appNixConfig), 0600)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Print(appNixConfig + "\n")
|
||||
log.Println("Configuration file is saved to", appFilename)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user