aboutsummaryrefslogtreecommitdiff
path: root/snowfall
diff options
context:
space:
mode:
authorCaroline Larimore <caroline@larimo.re>2025-02-03 19:30:44 -0800
committerCaroline Larimore <caroline@larimo.re>2025-04-14 18:58:17 -0700
commit5a0a36726756bc2a88770f8fd65418b6d3ce007b (patch)
treec6eac6d1e52f6171d5dcb6b06b706329e3239618 /snowfall
parentffc499cddd42ff4bea818718ae0b2f12d0e5dfbb (diff)
migration: barebones c-pc config
Diffstat (limited to 'snowfall')
-rw-r--r--snowfall/modules/nixos/system/default.nix21
-rw-r--r--snowfall/systems/x86_64-linux/c-pc/default.nix17
-rw-r--r--snowfall/systems/x86_64-linux/c-pc/hardware.nix59
-rw-r--r--snowfall/systems/x86_64-linux/c-pc/network.nix25
4 files changed, 122 insertions, 0 deletions
diff --git a/snowfall/modules/nixos/system/default.nix b/snowfall/modules/nixos/system/default.nix
new file mode 100644
index 0000000..a6a570b
--- /dev/null
+++ b/snowfall/modules/nixos/system/default.nix
@@ -0,0 +1,21 @@
+{ options, config, lib, namespace, ... }:
+
+with lib; with lib.${namespace}; let
+ cfg = config.${namespace}.system;
+in {
+ options.${namespace}.system = with types; {
+ hostname = mkOption {
+ type = strMatching "^$|^[[:alnum:]]([[:alnum:]_-]{0,61}[[:alnum:]])?$";
+ };
+
+ id = mkOption {
+ default = null;
+ type = nullOr str;
+ };
+ };
+
+ config = {
+ networking.hostName = cfg.hostname;
+ networking.hostId = cfg.id;
+ };
+} \ No newline at end of file
diff --git a/snowfall/systems/x86_64-linux/c-pc/default.nix b/snowfall/systems/x86_64-linux/c-pc/default.nix
new file mode 100644
index 0000000..ad4b923
--- /dev/null
+++ b/snowfall/systems/x86_64-linux/c-pc/default.nix
@@ -0,0 +1,17 @@
+{ lib, namespace, ... }:
+
+with lib; with lib.${namespace}; {
+ imports = [
+ ./hardware.nix
+ ./network.nix
+ ];
+
+ cxl = {
+ system = {
+ hostname = "c-pc";
+ id = "23ce94ff";
+ };
+ };
+
+ system.stateVersion = "23.11";
+} \ No newline at end of file
diff --git a/snowfall/systems/x86_64-linux/c-pc/hardware.nix b/snowfall/systems/x86_64-linux/c-pc/hardware.nix
new file mode 100644
index 0000000..68cf8bd
--- /dev/null
+++ b/snowfall/systems/x86_64-linux/c-pc/hardware.nix
@@ -0,0 +1,59 @@
+{ config, lib, pkgs, modulesPath, ... }:
+
+{
+ imports = [
+ (modulesPath + "/installer/scan/not-detected.nix")
+ ];
+
+ boot = {
+ loader.grub = {
+ enable = true;
+
+ useOSProber = true;
+
+ zfsSupport = true;
+ efiSupport = true;
+ efiInstallAsRemovable = true;
+
+ mirroredBoots = [
+ { devices = [ "nodev" ]; path = "/boot"; }
+ ];
+ };
+
+ initrd = {
+ availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
+ kernelModules = [ "amdgpu" ];
+
+ postDeviceCommands = lib.mkAfter ''
+ zfs rollback -r zpool/root@blank && zfs rollback -r zpool/home@blank
+ '';
+
+ postMountCommands = lib.mkAfter ''
+ chmod u=rw,g=,o= /secrets
+ '';
+ };
+
+ kernelModules = [ "kvm-amd" ];
+ extraModulePackages = [ ];
+
+ supportedFilesystems = [ "ntfs" ];
+ };
+
+ fileSystems = {
+ "/" = { fsType = "zfs"; neededForBoot = true; device = "zpool/root"; };
+ "/nix" = { fsType = "zfs"; neededForBoot = true; device = "zpool/nix"; };
+ "/home" = { fsType = "zfs"; neededForBoot = true; device = "zpool/home"; };
+ "/persist" = { fsType = "zfs"; neededForBoot = true; device = "zpool/persist"; };
+ "/persist/secure" = { fsType = "zfs"; neededForBoot = true; device = "zpool/secure/persist"; };
+ "/secrets" = { fsType = "zfs"; neededForBoot = true; device = "zpool/secure/secrets"; };
+
+ "/boot" = { fsType = "vfat"; device = "/dev/disk/by-uuid/12CE-A600"; };
+
+ "/mnt/4tb" = { fsType = "ext4"; device = "/dev/disk/by-label/4tb"; };
+ };
+
+ swapDevices = [ ];
+
+ nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
+ hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
+}
diff --git a/snowfall/systems/x86_64-linux/c-pc/network.nix b/snowfall/systems/x86_64-linux/c-pc/network.nix
new file mode 100644
index 0000000..aa7e075
--- /dev/null
+++ b/snowfall/systems/x86_64-linux/c-pc/network.nix
@@ -0,0 +1,25 @@
+{ ... }:
+
+{
+ networking = {
+ useDHCP = true;
+
+ wireless = {
+ enable = true;
+
+ # Import /etc/wpa_supplicant.conf networks
+ allowAuxiliaryImperativeNetworks = true;
+ };
+
+ firewall = {
+ enable = false;
+
+ allowedTCPPorts = [ 8096 50000 ];
+ allowedUDPPorts = [ ];
+ };
+ };
+
+ environment.etc."wpa_supplicant.conf" = {
+ source = "/secrets/wireless.conf";
+ };
+}