From 48d9bc352a2619bd998cfdadcdc330020e9ab890 Mon Sep 17 00:00:00 2001 From: Infinidoge Date: Mon, 13 Dec 2021 20:50:22 -0500 Subject: [PATCH] hosts/Infini-SERVER: update configuration --- hosts/Infini-SERVER/default.nix | 31 ++++++++- .../Infini-SERVER/hardware-configuration.nix | 66 +++++++++++++++++++ 2 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 hosts/Infini-SERVER/hardware-configuration.nix diff --git a/hosts/Infini-SERVER/default.nix b/hosts/Infini-SERVER/default.nix index 765b68b..14b5379 100644 --- a/hosts/Infini-SERVER/default.nix +++ b/hosts/Infini-SERVER/default.nix @@ -1,6 +1,8 @@ { suites, profiles, pkgs, lib, ... }: { imports = lib.flatten [ (with suites; [ base ]) + + ./hardware-configuration.nix ]; modules = { @@ -9,8 +11,35 @@ timeout = 1; }; hardware = { - gpu.nvidia = true; + # gpu.nvidia = true; form.server = true; }; + filesystems = { + enable = true; + btrfs.enable = true; + }; + }; + + environment.persistence."/persist" = { + directories = [ + "/home" + "/etc/nixos" + + # /var directories + "/var/log" + "/var/lib/systemd/coredump" + ]; + + files = [ + "/etc/machine-id" + + "/etc/ssh/ssh_host_rsa_key" + "/etc/ssh/ssh_host_rsa_key.pub" + "/etc/ssh/ssh_host_ed25519_key" + "/etc/ssh/ssh_host_ed25519_key.pub" + + "/root/.local/share/nix/trusted-settings.json" + "/root/.ssh/known_hosts" + ]; }; } diff --git a/hosts/Infini-SERVER/hardware-configuration.nix b/hosts/Infini-SERVER/hardware-configuration.nix new file mode 100644 index 0000000..e72cf62 --- /dev/null +++ b/hosts/Infini-SERVER/hardware-configuration.nix @@ -0,0 +1,66 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +let + uuid = uuid: "/dev/disk/by-uuid/${uuid}"; +in +{ + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "usb_storage" "xhci_pci" "ahci" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" "kvm-intel" ]; + boot.extraModulePackages = [ ]; + boot.kernelParams = [ "boot.shell_on_fail" ]; + boot.supportedFilesystems = [ "btrfs" ]; + + fileSystems = + let + main = uuid "577db170-141b-4131-8df5-ca5e7b595294"; + esp = uuid "E6C2-3E00"; + in + { + "/" = { + device = "none"; + fsType = "tmpfs"; + options = [ "defaults" "size=4G" "mode=755" ]; + }; + + "/persist" = { + device = main; + fsType = "btrfs"; + options = [ "subvol=root" "autodefrag" "noatime" "ssd" ]; + neededForBoot = true; + }; + + "/nix" = { + device = main; + fsType = "btrfs"; + options = [ "subvol=nix" "autodefrag" "noatime" "ssd" ]; + neededForBoot = true; + }; + + "/boot" = { + device = main; + fsType = "btrfs"; + options = [ "subvol=boot" "autodefrag" "noatime" "ssd" ]; + neededForBoot = true; + }; + + "/boot/efi" = { + device = esp; + fsType = "vfat"; + neededForBoot = true; + }; + }; + + swapDevices = [ + { device = uuid "d6a57248-e29b-4366-aec6-721a7ddbe2ec"; } + ]; + + powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; +}