From 9d87b7d5401c0d7eac778cf69ed922dc1231e7f7 Mon Sep 17 00:00:00 2001 From: Infinidoge Date: Tue, 27 Feb 2024 03:04:12 -0500 Subject: [PATCH] Infini-SD: init --- hosts/Infini-SD/default.nix | 37 ++++++++++++++++++++++ hosts/Infini-SD/filesystems.nix | 36 +++++++++++++++++++++ hosts/Infini-SD/hardware-configuration.nix | 18 +++++++++++ 3 files changed, 91 insertions(+) create mode 100644 hosts/Infini-SD/default.nix create mode 100644 hosts/Infini-SD/filesystems.nix create mode 100644 hosts/Infini-SD/hardware-configuration.nix diff --git a/hosts/Infini-SD/default.nix b/hosts/Infini-SD/default.nix new file mode 100644 index 0000000..34b4e88 --- /dev/null +++ b/hosts/Infini-SD/default.nix @@ -0,0 +1,37 @@ +{ lib, ... }: { + imports = [ + ./hardware-configuration.nix + ./filesystems.nix + ]; + + networking.hostId = "3275c7d3"; + + modules = { + boot.grub.enable = true; + hardware = { + form.server = true; + }; + }; + + persist = { + directories = [ + "/home" + "/etc/nixos" + "/etc/nixos-private" + + "/root/.local/share/nix" + "/root/.ssh" + + # /var directories + "/var/log" + "/var/lib/systemd/coredump" + "/var/lib/tailscale" + ]; + + files = [ + "/etc/machine-id" + ]; + }; + + system.stateVersion = "23.11"; +} diff --git a/hosts/Infini-SD/filesystems.nix b/hosts/Infini-SD/filesystems.nix new file mode 100644 index 0000000..087066e --- /dev/null +++ b/hosts/Infini-SD/filesystems.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, ... }: + +let + uuid = uuid: "/dev/disk/by-uuid/${uuid}"; + main = uuid "ae3f3d98-1d87-47b4-a4ed-d69a896eee69"; + commonOptions = [ "autodefrag" "noatime" "compress-force=zstd:4" ]; + + mkMain' = options: { + device = main; + fsType = "btrfs"; + options = commonOptions ++ options; + }; + mkMain = options: (mkMain' options) // { neededForBoot = true; }; +in +{ + fileSystems = { + "/" = { + device = "none"; + fsType = "tmpfs"; + options = [ "defaults" "size=4G" "mode=755" ]; + }; + + "/media/main" = mkMain' [ ]; + + "/persist" = mkMain [ "subvol=root" ]; + "/etc/ssh" = mkMain [ "subvol=root/etc/ssh" ]; + "/nix" = mkMain [ "subvol=nix" ]; + "/boot" = mkMain [ "subvol=boot" ]; + + "/boot/efi" = { + device = uuid "D7DB-2291"; + fsType = "vfat"; + neededForBoot = true; + }; + }; +} diff --git a/hosts/Infini-SD/hardware-configuration.nix b/hosts/Infini-SD/hardware-configuration.nix new file mode 100644 index 0000000..385e273 --- /dev/null +++ b/hosts/Infini-SD/hardware-configuration.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "ahci" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ "usb_storage" ]; + boot.kernelModules = [ "kvm-amd" "kvm-intel" ]; + boot.extraModulePackages = [ ]; + boot.kernelParams = [ "boot.shell_on_fail" ]; + boot.supportedFilesystems = [ "btrfs" "zfs" ]; + boot.zfs.forceImportRoot = false; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + + info.model = "Portable Installation"; +}