From 858e2319e8252076b29d39fddd4ff2125ce2d025 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Sun, 8 Dec 2024 12:03:12 -0600 Subject: [PATCH] systems/bruddynix: init --- systems/x86_64-linux/bruddynix/default.nix | 125 ++++++++++++++++++ systems/x86_64-linux/bruddynix/disks.nix | 53 ++++++++ systems/x86_64-linux/bruddynix/hardware.nix | 50 +++++++ systems/x86_64-linux/bruddynix/network.nix | 13 ++ .../bruddynix/specializations.nix | 18 +++ 5 files changed, 259 insertions(+) create mode 100644 systems/x86_64-linux/bruddynix/default.nix create mode 100644 systems/x86_64-linux/bruddynix/disks.nix create mode 100644 systems/x86_64-linux/bruddynix/hardware.nix create mode 100644 systems/x86_64-linux/bruddynix/network.nix create mode 100644 systems/x86_64-linux/bruddynix/specializations.nix diff --git a/systems/x86_64-linux/bruddynix/default.nix b/systems/x86_64-linux/bruddynix/default.nix new file mode 100644 index 000000000..dac5a15be --- /dev/null +++ b/systems/x86_64-linux/bruddynix/default.nix @@ -0,0 +1,125 @@ +{ + config, + lib, + namespace, + ... +}: +let + inherit (lib.${namespace}) enabled; +in +{ + imports = [ + ./disks.nix + ./hardware.nix + ./network.nix + ./specializations.nix + ]; + + khanelinix = { + nix = enabled; + + archetypes = { + gaming = enabled; + personal = enabled; + }; + + hardware = { + audio = { + enable = true; + extra-packages = [ ]; + }; + + bluetooth = enabled; + cpu.amd = enabled; + gpu.amd = enabled; + opengl = enabled; + rgb.openrgb.enable = true; + + storage = { + enable = true; + ssdEnable = true; + }; + + tpm = enabled; + }; + + programs = { + graphical = { + desktop-environment = { + gnome = { + enable = true; + }; + }; + }; + }; + + services = { + avahi = enabled; + # TODO: input-leap replace barrier + geoclue = enabled; + power = enabled; + printing = enabled; + + openssh = { + enable = true; + + authorizedKeys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEpfTVxQKmkAYOrsnroZoTk0LewcBIC4OjlsoJY6QbB0" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINBG8l3jQ2EPLU+BlgtaQZpr4xr97n2buTLAZTxKHSsD" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM7UBwfd7+K0mdkAIb2TE6RzMu6L4wZnG/anuoYqJMPB" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJAZIwy7nkz8CZYR/ZTSNr+7lRBW2AYy1jw06b44zaID" + ]; + + # TODO: make part of ssh config proper + extraConfig = '' + Host server + User ${config.${namespace}.user.name} + Hostname austinserver.local + ''; + }; + }; + + security = { + # doas = enabled; + keyring = enabled; + sudo-rs = enabled; + # sops = { + # enable = true; + # sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; + # defaultSopsFile = lib.snowfall.fs.get-file "secrets/bruddynix/default.yaml"; + # }; + }; + + system = { + boot = { + enable = true; + secureBoot = true; + plymouth = true; + silentBoot = true; + }; + + fonts = enabled; + locale = enabled; + networking = { + enable = true; + optimizeTcp = true; + }; + realtime = enabled; + time = enabled; + }; + }; + + nix.settings = { + cores = 8; + max-jobs = 8; + }; + + services = { + mpd = { + musicDirectory = "nfs://austinserver.local/mnt/user/data/media/music"; + }; + rpcbind.enable = true; # needed for NFS + }; + + system.stateVersion = "24.11"; +} diff --git a/systems/x86_64-linux/bruddynix/disks.nix b/systems/x86_64-linux/bruddynix/disks.nix new file mode 100644 index 000000000..dd8353111 --- /dev/null +++ b/systems/x86_64-linux/bruddynix/disks.nix @@ -0,0 +1,53 @@ +{ + disko.devices.disk = { + main = { + device = "/dev/nvme0n1"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "1G"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + extraArgs = [ + "-n" + "ESP" + ]; + }; + }; + root = { + size = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + mountOptions = [ + "defaults" + ]; + extraArgs = [ + "-Lnixos" + ]; + }; + }; + swap = { + size = "32G"; + content = { + type = "swap"; + discardPolicy = "both"; + resumeDevice = true; # resume from hiberation from this device + extraArgs = [ + "-Lswap" + ]; + }; + }; + }; + }; + }; + }; + +} diff --git a/systems/x86_64-linux/bruddynix/hardware.nix b/systems/x86_64-linux/bruddynix/hardware.nix new file mode 100644 index 000000000..55be8f921 --- /dev/null +++ b/systems/x86_64-linux/bruddynix/hardware.nix @@ -0,0 +1,50 @@ +{ pkgs, modulesPath, ... }: +{ + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + ## + # Desktop VM config + ## + boot = { + blacklistedKernelModules = [ "eeepc_wmi" ]; + + kernelPackages = pkgs.linuxPackages_latest; + kernel.sysctl."kernel.sysrq" = 1; + + initrd = { + availableKernelModules = [ + "ahci" + # "ehci_pci" + "nvme" + "sd_mod" + # "sr_mod" + "usb_storage" + "usbhid" + "xhci_pci" + ]; + # verbose = false; + }; + }; + + # fileSystems = { + # "/" = { + # device = "/dev/disk/by-label/nixos"; + # fsType = "ext4"; + # }; + # + # "/boot" = { + # device = "/dev/disk/by-label/ESP"; + # fsType = "vfat"; + # options = [ + # "fmask=0077" + # "dmask=0077" + # ]; + # }; + # }; + + # swapDevices = [ { device = "/dev/disk/by-label/swap"; } ]; + + hardware = { + enableRedistributableFirmware = true; + }; +} diff --git a/systems/x86_64-linux/bruddynix/network.nix b/systems/x86_64-linux/bruddynix/network.nix new file mode 100644 index 000000000..149380eea --- /dev/null +++ b/systems/x86_64-linux/bruddynix/network.nix @@ -0,0 +1,13 @@ +_: { + systemd = { + network.networks = { + "30-network-defaults-wired" = { + matchConfig.Name = "en* | eth* | usb*"; + networkConfig = { + DHCP = "ipv4"; + MulticastDNS = true; + }; + }; + }; + }; +} diff --git a/systems/x86_64-linux/bruddynix/specializations.nix b/systems/x86_64-linux/bruddynix/specializations.nix new file mode 100644 index 000000000..de9ab5693 --- /dev/null +++ b/systems/x86_64-linux/bruddynix/specializations.nix @@ -0,0 +1,18 @@ +{ lib, pkgs, ... }: +{ + specialisation = { + zen = { + inheritParentConfig = true; + configuration = { + boot.kernelPackages = lib.mkForce pkgs.linuxPackages_zen; + }; + }; + + lts = { + inheritParentConfig = true; + configuration = { + boot.kernelPackages = lib.mkForce pkgs.linuxPackages; + }; + }; + }; +}