From ad09e551fdb6f1216556a6c9ac868fc98b3e0cf6 Mon Sep 17 00:00:00 2001 From: blahai Date: Sun, 12 Jan 2025 22:44:11 +0200 Subject: [PATCH] Add theia stuffies --- modules/nixos/boot/loader/grub.nix | 32 +++++++++++++++- modules/nixos/hardware/cpu/amd.nix | 2 +- modules/nixos/hardware/cpu/default.nix | 1 + modules/profiles/headless/default.nix | 1 + modules/profiles/laptop/default.nix | 1 + modules/profiles/server/default.nix | 1 + systems/theia/default.nix | 24 ++++++++++++ systems/theia/hardware.nix | 20 ++++++++++ systems/theia/networking.nix | 1 + systems/theia/overrides.nix | 53 ++++++++++++++++++++++++++ systems/theia/services.nix | 1 + 11 files changed, 135 insertions(+), 2 deletions(-) create mode 100644 modules/profiles/headless/default.nix create mode 100644 modules/profiles/laptop/default.nix create mode 100644 modules/profiles/server/default.nix create mode 100644 systems/theia/default.nix create mode 100644 systems/theia/hardware.nix create mode 100644 systems/theia/networking.nix create mode 100644 systems/theia/overrides.nix create mode 100644 systems/theia/services.nix diff --git a/modules/nixos/boot/loader/grub.nix b/modules/nixos/boot/loader/grub.nix index 0967ef4..784978a 100644 --- a/modules/nixos/boot/loader/grub.nix +++ b/modules/nixos/boot/loader/grub.nix @@ -1 +1,31 @@ -{} +{ + lib, + config, + ... +}: let + inherit (lib.modules) mkIf mkDefault; + inherit (lib.options) mkOption; + inherit (lib.types) nullOr str; + cfg = config.olympus.system.boot; +in { + options.olympus.system.boot.grub = { + device = mkOption { + type = nullOr str; + default = "nodev"; + description = "The device to install the bootloader to."; + }; + }; + + config = mkIf (cfg.loader == "grub") { + boot.loader.grub = { + enable = mkDefault true; + useOSProber = false; + efiSupport = false; + enableCryptodisk = mkDefault false; + inherit (cfg.grub) device; + theme = null; + backgroundColor = null; + splashImage = null; + }; + }; +} diff --git a/modules/nixos/hardware/cpu/amd.nix b/modules/nixos/hardware/cpu/amd.nix index f0c302d..6417600 100644 --- a/modules/nixos/hardware/cpu/amd.nix +++ b/modules/nixos/hardware/cpu/amd.nix @@ -6,7 +6,7 @@ inherit (config.olympus) device; inherit (lib.modules) mkIf; in { - config = mkIf (device.cpu == "amd") { + config = mkIf (device.cpu == "amd" || device.cpu == "vm-amd") { hardware.cpu.amd.updateMicrocode = true; boot.kernelModules = [ diff --git a/modules/nixos/hardware/cpu/default.nix b/modules/nixos/hardware/cpu/default.nix index cb46e1e..a26726f 100644 --- a/modules/nixos/hardware/cpu/default.nix +++ b/modules/nixos/hardware/cpu/default.nix @@ -9,6 +9,7 @@ in { type = types.nullOr ( types.enum [ "amd" + "vm-amd" ] ); default = null; diff --git a/modules/profiles/headless/default.nix b/modules/profiles/headless/default.nix new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/modules/profiles/headless/default.nix @@ -0,0 +1 @@ +{} diff --git a/modules/profiles/laptop/default.nix b/modules/profiles/laptop/default.nix new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/modules/profiles/laptop/default.nix @@ -0,0 +1 @@ +{} diff --git a/modules/profiles/server/default.nix b/modules/profiles/server/default.nix new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/modules/profiles/server/default.nix @@ -0,0 +1 @@ +{} diff --git a/systems/theia/default.nix b/systems/theia/default.nix new file mode 100644 index 0000000..965c738 --- /dev/null +++ b/systems/theia/default.nix @@ -0,0 +1,24 @@ +{ + imports = [ + ./hardware.nix + ./networking.nix + ./overrides.nix + ./services.nix + ]; + + olympus = { + device = { + cpu = "vm-amd"; + gpu = null; + }; + system = { + boot = { + loader = "grub"; + loadRecommendedModules = true; + enableKernelTweaks = true; + initrd.enableTweaks = true; + plymouth.enable = false; + }; + }; + }; +} diff --git a/systems/theia/hardware.nix b/systems/theia/hardware.nix new file mode 100644 index 0000000..b650f93 --- /dev/null +++ b/systems/theia/hardware.nix @@ -0,0 +1,20 @@ +{ + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/09e65ff9-2195-41d8-b6a4-671c306742c3"; + fsType = "ext4"; + }; + + "/boot" = { + device = "/dev/disk/by-uuid/FED3-A372"; + fsType = "vfat"; + options = ["fmask=0022" "dmask=0022"]; + }; + }; + swapDevices = [ + { + device = "/var/lib/swapfile"; + size = 16 * 1024; + } + ]; +} diff --git a/systems/theia/networking.nix b/systems/theia/networking.nix new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/systems/theia/networking.nix @@ -0,0 +1 @@ +{} diff --git a/systems/theia/overrides.nix b/systems/theia/overrides.nix new file mode 100644 index 0000000..ff127a5 --- /dev/null +++ b/systems/theia/overrides.nix @@ -0,0 +1,53 @@ +{ + lib, + pkgs, + config, + modulesPath, + ... +}: let + inherit (lib.modules) mkForce; +in { + imports = [(modulesPath + "/profiles/qemu-guest.nix")]; + + config = { + services = { + smartd.enable = mkForce false; # Unavailable - device lacks SMART capability. + qemuGuest.enable = true; + }; + systemd.services.qemu-guest-agent.path = [pkgs.shadow]; + + system.stateVersion = mkForce "25.04"; + + boot = { + kernelParams = ["net.ifnames=0"]; + kernel.sysctl = { + "net.ipv4.ip_forward" = true; + "net.ipv6.conf.all.forwarding" = true; + }; + + initrd = { + availableKernelModules = [ + "ata_piix" + "uhci_hcd" + "virtio_pci" + "virtio_scsi" + "ahci" + "sr_mod" + "virtio_blk" + ]; + kernelModules = ["dm-snapshot"]; + }; + + loader.grub = { + enable = true; + useOSProber = mkForce false; + efiSupport = mkForce false; + enableCryptodisk = false; + theme = mkForce null; + backgroundColor = mkForce null; + splashImage = mkForce null; + device = mkForce "/dev/vda"; + }; + }; + }; +} diff --git a/systems/theia/services.nix b/systems/theia/services.nix new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/systems/theia/services.nix @@ -0,0 +1 @@ +{}