package config type InstallConfig struct { Disk string EnableLUKS bool Hostname string Username string RootPassword string UserPassword string Timezone string Locale string } type ArchInstallConfig struct { Bootloader string `json:"bootloader"` Kernels []string `json:"kernels"` Filesystem string `json:"filesystem"` Disk string `json:"disk"` Encryption *Encryption `json:"encryption,omitempty"` Hostname string `json:"hostname"` Timezone string `json:"timezone"` Locale string `json:"locale"` Desktop string `json:"desktop"` Users []User `json:"users"` } type Encryption struct { Type string `json:"type"` Password string `json:"password"` } type User struct { Username string `json:"username"` Password string `json:"password"` Sudo bool `json:"sudo"` } func (c *InstallConfig) ToArchInstall() *ArchInstallConfig { ac := &ArchInstallConfig{ Bootloader: "systemd-boot", Kernels: []string{"linux-hardened"}, Filesystem: "btrfs", Disk: c.Disk, Hostname: c.Hostname, Timezone: c.Timezone, Locale: c.Locale, Desktop: "cosmic", Users: []User{ { Username: c.Username, Password: c.UserPassword, Sudo: true, }, }, } if c.EnableLUKS { ac.Encryption = &Encryption{ Type: "luks2", Password: c.RootPassword, } } return ac }