about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorene <ene@sils.li>2023-02-21 11:23:30 +0100
committerene <ene@sils.li>2023-02-21 11:23:30 +0100
commit976f90b793f27e4b38297753583c9f3cd24cd7cd (patch)
tree9ea16218a2d935435023eb837d93fc1747694218
parentFix(bootstrap): Adapt to the new flake config (diff)
downloadnixos-config-976f90b793f27e4b38297753583c9f3cd24cd7cd.tar.gz
nixos-config-976f90b793f27e4b38297753583c9f3cd24cd7cd.zip
Feat(hosts): Add lahmu, a vm host
Diffstat (limited to '')
-rw-r--r--flake/nixosConfigurations/default.nix11
-rw-r--r--hosts/hostinfo.toml5
-rw-r--r--hosts/lahmu/configuration.nix19
-rw-r--r--hosts/lahmu/hardware/cpu.nix4
-rw-r--r--hosts/lahmu/hardware/default.nix29
-rw-r--r--hosts/lahmu/hardware/gpu.nix15
-rw-r--r--hosts/lahmu/networking.nix14
7 files changed, 96 insertions, 1 deletions
diff --git a/flake/nixosConfigurations/default.nix b/flake/nixosConfigurations/default.nix
index 96fb07bf..d2f2c97e 100644
--- a/flake/nixosConfigurations/default.nix
+++ b/flake/nixosConfigurations/default.nix
@@ -62,6 +62,17 @@ in {
       ]
       ++ defaultModules;
   };
+  lahmu = inputs.nixpkgs.lib.nixosSystem {
+    inherit system;
+    specialArgs =
+      pkgs.lib.recursiveUpdate inputs
+      sysLib;
+    modules =
+      [
+        ../../hosts/lahmu/configuration.nix
+      ]
+      ++ defaultModules;
+  };
   spawn = inputs.nixpkgs.lib.nixosSystem {
     specialArgs = inputs;
     modules = [../../hosts/spawn/configuration.nix];
diff --git a/hosts/hostinfo.toml b/hosts/hostinfo.toml
index dd8723b9..4f3b9aed 100644
--- a/hosts/hostinfo.toml
+++ b/hosts/hostinfo.toml
@@ -4,8 +4,11 @@ description = "This is my main desktop"
 [Apzu]
 description = "This is my light laptop, with modern hardware"
 
-[Mummu]
+[Mammun]
 description = "This is my older and heavier laptop"
 
+[Lahmu]
+description = "This is my config running on a vm"
+
 [Spawn]
 description = "This is a small compilation target, to get sshkeys for secret unlocking"
diff --git a/hosts/lahmu/configuration.nix b/hosts/lahmu/configuration.nix
new file mode 100644
index 00000000..8e78949b
--- /dev/null
+++ b/hosts/lahmu/configuration.nix
@@ -0,0 +1,19 @@
+# vim: ts=2
+{
+  config,
+  lib,
+  nixpkgs,
+  home-manager,
+  ...
+}: {
+  imports = [
+    ./hardware
+    ./networking.nix
+
+    ../../system
+
+    ../../services
+  ];
+
+  system.stateVersion = "23.05";
+}
diff --git a/hosts/lahmu/hardware/cpu.nix b/hosts/lahmu/hardware/cpu.nix
new file mode 100644
index 00000000..2d7232cd
--- /dev/null
+++ b/hosts/lahmu/hardware/cpu.nix
@@ -0,0 +1,4 @@
+{config, ...}: {
+  powerManagement.cpuFreqGovernor = "powersave";
+  hardware.cpu.amd.updateMicrocode = true; # Why not?
+}
diff --git a/hosts/lahmu/hardware/default.nix b/hosts/lahmu/hardware/default.nix
new file mode 100644
index 00000000..217a179d
--- /dev/null
+++ b/hosts/lahmu/hardware/default.nix
@@ -0,0 +1,29 @@
+{
+  config,
+  lib,
+  pkgs,
+  modulesPath,
+  ...
+}: {
+  imports = [
+    (modulesPath + "/installer/scan/not-detected.nix") # TODO is this necessary?
+    (modulesPath + "/profiles/qemu-guest.nix")
+    ./cpu.nix
+    ./gpu.nix
+  ];
+
+  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
+
+  system.fileSystemLayouts = {
+    enable = true;
+    mainDisk = "/dev/disk/by-uuid/dfc66aa1-1530-4fbe-bc4f-205c6dc86ed9";
+    efiDisk = "/dev/disk/by-uuid/A1D1-D13F";
+  };
+
+  boot = {
+    kernelModules = ["kvm-amd"];
+
+    # TODO check this:
+    initrd.availableKernelModules = ["xhci_pci" "nvme" "rtsx_pci_sdmmc"];
+  };
+}
diff --git a/hosts/lahmu/hardware/gpu.nix b/hosts/lahmu/hardware/gpu.nix
new file mode 100644
index 00000000..c3df51ae
--- /dev/null
+++ b/hosts/lahmu/hardware/gpu.nix
@@ -0,0 +1,15 @@
+{
+  config,
+  pkgs,
+  lib,
+  ...
+}: {
+  hardware.opengl.extraPackages = with pkgs; [
+    rocm-opencl-icd # open-cl
+    amdvlk # or directly through mesa
+    amd-media-driver # libva
+  ];
+
+  # Force radv, TODO is this logical?
+  environment.variables.AMD_VULKAN_ICD = "RADV";
+}
diff --git a/hosts/lahmu/networking.nix b/hosts/lahmu/networking.nix
new file mode 100644
index 00000000..05c7d100
--- /dev/null
+++ b/hosts/lahmu/networking.nix
@@ -0,0 +1,14 @@
+{
+  config,
+  lib,
+  ...
+}: {
+  # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
+  # (the default) this is the recommended approach. When using systemd-networkd it's
+  # still possible to use this option, but it's recommended to use it in conjunction
+  # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
+  networking.useDHCP = lib.mkDefault true;
+  # networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
+  # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true;
+  networking.hostName = "mammun";
+}