diff --git a/config/config.go b/config/config.go index 339a64f..5c2280d 100644 --- a/config/config.go +++ b/config/config.go @@ -7,30 +7,30 @@ import ( ) type InstallConfig struct { - Disk string - EnableLUKS bool - Hostname string - Username string - RootPassword string - UserPassword string - Timezone string - Locale string + Disk string + EnableLUKS bool + Hostname string + Username string + RootPassword string + UserPassword string + Timezone string + Locale string } type ArchInstallConfig struct { - Version string `json:"version"` - Script string `json:"script"` - ArchinstallLanguage string `json:"archinstall-language"` - Bootloader string `json:"bootloader"` - Kernels []string `json:"kernels"` - Hostname string `json:"hostname"` - Timezone string `json:"timezone"` - LocaleConfig LocaleConfig `json:"locale_config"` - DiskConfig DiskConfig `json:"disk_config"` - ProfileConfig ProfileConfig `json:"profile_config"` - AuthConfig AuthConfig `json:"auth_config"` - Packages []string `json:"packages"` - Services []string `json:"services"` + Version string `json:"version"` + Script string `json:"script"` + ArchinstallLanguage string `json:"archinstall-language"` + Bootloader string `json:"bootloader"` + Kernels []string `json:"kernels"` + Hostname string `json:"hostname"` + Timezone string `json:"timezone"` + LocaleConfig LocaleConfig `json:"locale_config"` + DiskConfig DiskConfig `json:"disk_config"` + ProfileConfig ProfileConfig `json:"profile_config"` + AuthConfig AuthConfig `json:"auth_config"` + Packages []string `json:"packages"` + Services []string `json:"services"` } type LocaleConfig struct { @@ -40,14 +40,14 @@ type LocaleConfig struct { } type DiskConfig struct { - ConfigType string `json:"config_type"` + ConfigType string `json:"config_type"` DeviceModifications []DeviceModification `json:"device_modifications"` } type DeviceModification struct { - Device string `json:"device"` - Partitions []Partition `json:"partitions"` - Wipe bool `json:"wipe"` + Device string `json:"device"` + Partitions []Partition `json:"partitions"` + Wipe bool `json:"wipe"` } type Partition struct { @@ -125,34 +125,33 @@ func (c *InstallConfig) ToArchInstall() *ArchInstallConfig { "linux-hardened", "linux-firmware", "btrfs-progs", - + // Text editors "neovim", - + // Shell "zsh", - + // Terminal "alacritty", - + // System tools "tmux", "git", "networkmanager", - + // Security tools "opendoas", "firejail", "apparmor", "nftables", // Using nftables instead of ufw as requested - "hardened-malloc", - + // Browsers "chromium", // Using regular chromium instead of ungoogled-chromium as requested - + // Wayland support "xwayland-satellite", - + // Cosmic Desktop "cosmic-session", "cosmic-greeter", @@ -220,24 +219,24 @@ func (c *InstallConfig) SaveArchInstallConfig(filepath string) error { return fmt.Errorf("failed to marshal config: %w", err) } - return os.WriteFile(filepath, data, 0644) + return os.WriteFile(filepath, data, 0o644) } func (c *InstallConfig) SaveUserCredentials(filepath string) error { // For credentials, we only save the sensitive information creds := map[string]interface{}{} - + if c.EnableLUKS && c.RootPassword != "" { creds["encryption_password"] = c.RootPassword } - + creds["users"] = []map[string]string{ { "username": c.Username, "password": c.UserPassword, }, } - + if c.RootPassword != "" { creds["root_enc_password"] = c.RootPassword } @@ -247,5 +246,5 @@ func (c *InstallConfig) SaveUserCredentials(filepath string) error { return fmt.Errorf("failed to marshal credentials: %w", err) } - return os.WriteFile(filepath, data, 0600) + return os.WriteFile(filepath, data, 0o600) }