From a592eb69dd990973db03d26c344e44f58adc27a6 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Sun, 18 Aug 2024 20:59:01 -0400 Subject: [PATCH] feat: init homer device --- devices/homie/default.nix | 57 ++++++++++++++++++++++++ devices/homie/hardware-configuration.nix | 54 ++++++++++++++++++++++ outputs.nix | 3 ++ 3 files changed, 114 insertions(+) create mode 100644 devices/homie/default.nix create mode 100644 devices/homie/hardware-configuration.nix diff --git a/devices/homie/default.nix b/devices/homie/default.nix new file mode 100644 index 00000000..27f0b27b --- /dev/null +++ b/devices/homie/default.nix @@ -0,0 +1,57 @@ +{ + config, + self, + ... +}: let + inherit (config.vars) mainUser hostName; +in { + # ------------------------------------------------ + # Imports + # ------------------------------------------------ + imports = [ + ./hardware-configuration.nix + + self.nixosModules.kmscon + self.nixosModules.server + ]; + + # State Version: DO NOT CHANGE + system.stateVersion = "24.11"; + home-manager.users.${mainUser}.home.stateVersion = "24.11"; + + # ------------------------------------------------ + # User Settings + # ------------------------------------------------ + vars = { + mainUser = "matt"; + hostName = "homie"; + promptMainColor = "yellow"; + }; + + users.users.${mainUser} = { + isNormalUser = true; + extraGroups = [ + "wheel" + "adm" + ]; + }; + + networking = { + inherit hostName; + resolvconf.enable = true; + firewall.enable = false; + }; + + time.timeZone = "America/Montreal"; + + # ------------------------------------------------ + # `Self` Modules configuration + # ------------------------------------------------ + roles.server = { + user = mainUser; + tailscale.enable = true; + sshd.enable = true; + }; + + services.kmscon.enable = true; +} diff --git a/devices/homie/hardware-configuration.nix b/devices/homie/hardware-configuration.nix new file mode 100644 index 00000000..20fea882 --- /dev/null +++ b/devices/homie/hardware-configuration.nix @@ -0,0 +1,54 @@ +{ + config, + modulesPath, + ... +}: { + nixpkgs.hostPlatform = "x86_64-linux"; + imports = [(modulesPath + "/installer/scan/not-detected.nix")]; + + boot = { + loader = { + efi.canTouchEfiVariables = true; + timeout = 2; + + systemd-boot = { + enable = true; + consoleMode = "max"; + configurationLimit = 30; + }; + }; + + initrd.availableKernelModules = [ + "xhci_pci" + "ahci" + "nvme" + "usbhid" + "usb_storage" + "sd_mod" + ]; + }; + + fileSystems = { + "/" = { + device = "/dev/disk/by-label/NIXROOT"; + fsType = "btrfs"; + }; + + "/boot" = { + device = "/dev/disk/by-label/NIXBOOT"; + fsType = "vfat"; + options = ["fmask=0022" "dmask=0022"]; + }; + }; + + swapDevices = [ + { + device = "/var/lib/swapfile"; + size = 16 * 1024; + } + ]; + + zramSwap.enable = true; + + hardware.cpu.intel.updateMicrocode = config.hardware.enableRedistributableFirmware; +} diff --git a/outputs.nix b/outputs.nix index 9efc6202..476b3bda 100644 --- a/outputs.nix +++ b/outputs.nix @@ -85,6 +85,9 @@ secrets.nixosModules.servivi ]; + # Home-assistant + homie = mkNixOS [./devices/homie]; + # Cluster thingone = mkNixOS [ (import ./devices/cluster "thingone")