mirror of
https://code.dumpstack.io/tools/appvm.git
synced 2024-12-24 11:59:48 +00:00
Embed builtin description for apps
This commit is contained in:
parent
3416808444
commit
99bd71b80c
7
appvm.go
7
appvm.go
@ -372,7 +372,12 @@ func main() {
|
||||
|
||||
os.MkdirAll(configDir+"/nix", 0700)
|
||||
|
||||
err := ioutil.WriteFile(configDir+"/nix/base.nix", base_nix, 0644)
|
||||
err := writeBuiltinApps(configDir + "/nix")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
err = ioutil.WriteFile(configDir+"/nix/base.nix", base_nix, 0644)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -1,3 +1,19 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
// Builtin VMs
|
||||
|
||||
type app struct {
|
||||
Name string
|
||||
Nix []byte
|
||||
}
|
||||
|
||||
var builtin_chromium_nix = app{
|
||||
Name: "chromium",
|
||||
Nix: []byte(`
|
||||
{pkgs, ...}:
|
||||
{
|
||||
imports = [
|
||||
@ -19,3 +35,18 @@
|
||||
environment.systemPackages = [ pkgs.chromium ];
|
||||
services.xserver.displayManager.sessionCommands = "while [ 1 ]; do ${pkgs.chromium}/bin/chromium; done &";
|
||||
}
|
||||
`),
|
||||
}
|
||||
|
||||
func writeBuiltinApps(path string) (err error) {
|
||||
for _, f := range []app{
|
||||
builtin_chromium_nix,
|
||||
} {
|
||||
err = ioutil.WriteFile(configDir+"/nix/"+f.Name+".nix", f.Nix, 0644)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
Loading…
Reference in New Issue
Block a user