[feat] using remote configs for appvm creation

This commit is contained in:
Vladimir Serov 2019-12-29 18:41:26 +03:00
parent ba569d4aab
commit 4ce9b6ee86
No known key found for this signature in database
GPG Key ID: 6BA7C26C3FDF7BB3

View File

@ -99,7 +99,7 @@ var xmlTmpl = `
` `
func evalNix(expr string) (s string) { func evalNix(expr string) (s string) {
command := exec.Command("nix", "eval", expr) command := exec.Command("nix", "eval", "--raw", expr)
bytes, _ := command.Output() bytes, _ := command.Output()
s = string(bytes) s = string(bytes)
return return
@ -213,9 +213,11 @@ func streamStdOutErr(command *cmd.Cmd) {
} }
func generateVM(name string, verbose bool) (realpath, reginfo, qcow2 string, err error) { func generateVM(name string, verbose bool) (realpath, reginfo, qcow2 string, err error) {
vmConfigPath := getAppVMExpressionPath(name)
log.Print(vmConfigPath)
command := cmd.NewCmdOptions(cmd.Options{Buffered: false, Streaming: true}, command := cmd.NewCmdOptions(cmd.Options{Buffered: false, Streaming: true},
"nix-build", "<nixpkgs/nixos>", "-A", "config.system.build.vm", "nix-build", "<nixpkgs/nixos>", "-A", "config.system.build.vm",
"-I", "nixos-config=nix/"+name+".nix", "-I", ".") "-I", "nixos-config="+vmConfigPath, "-I", ".")
if verbose { if verbose {
go streamStdOutErr(command) go streamStdOutErr(command)
} }