mirror of
https://code.dumpstack.io/tools/appvm.git
synced 2024-11-23 16:41:29 +00:00
[feat] using remote configs for appvm creation
This commit is contained in:
parent
ba569d4aab
commit
4ce9b6ee86
6
appvm.go
6
appvm.go
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue