Embed builtin description for apps

This commit is contained in:
Mikhail Klementev 2019-12-30 14:09:44 +00:00
parent 3416808444
commit 99bd71b80c
No known key found for this signature in database
GPG Key ID: BE44DA8C062D87DC
2 changed files with 37 additions and 1 deletions

View File

@ -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)
}

View File

@ -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
}