diff --git a/flake.nix b/flake.nix index 178a7e0..c5033b6 100644 --- a/flake.nix +++ b/flake.nix @@ -63,6 +63,7 @@ extern = mkNix [ ./hosts/extern ]; # External Drive/USB kitty = mkNix [ ./hosts/kitty ]; # Dell Optiplex 7010 + midas = mkNix [ ./hosts/midas ]; # Dell Optiplex 5040 prophet = mkNix [ ./hosts/prophet ]; # Oracle Neoverse-N1 }; diff --git a/hosts/midas/boot/default.nix b/hosts/midas/boot/default.nix new file mode 100644 index 0000000..50d146f --- /dev/null +++ b/hosts/midas/boot/default.nix @@ -0,0 +1,4 @@ +{ pkgs, ... }: +{ + boot.kernelPackages = pkgs.linuxPackages_latest; +} diff --git a/hosts/midas/default.nix b/hosts/midas/default.nix new file mode 100644 index 0000000..0d2f327 --- /dev/null +++ b/hosts/midas/default.nix @@ -0,0 +1,24 @@ +{ pkgs, ... }: +{ + imports = [ + #./boot + ./disko + #./filesystems + ./hardware + ./users + ../../modules/system + ]; + + networking = { + hostName = "midas"; + hostId = "462433de"; + }; + + system = { + desktop.enable = true; + #lanzaboote.enable = true; + wireless.enable = false; + libvirtd.enable = true; + stateVersion = "24.11"; + }; +} diff --git a/hosts/midas/disko/default.nix b/hosts/midas/disko/default.nix new file mode 100644 index 0000000..9fae370 --- /dev/null +++ b/hosts/midas/disko/default.nix @@ -0,0 +1,90 @@ +{ disko, config, ... }: +{ + imports = [ disko.nixosModules.disko ]; + + disko.devices = { + disk = { + "${config.networking.hostName}" = { + type = "disk"; + device = "/dev/nvme0n1"; + content = { + type = "gpt"; + partitions = { + ESP = { + priority = 1; + size = "2G"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + }; + }; + luks = { + size = "100%"; + content = { + type = "luks"; + name = "${config.networking.hostName}-disk"; + settings.allowDiscards = true; + passwordFile = "/tmp/secret.key"; + content = { + type = "lvm_pv"; + vg = "${config.networking.hostName}"; + }; + }; + }; + }; + }; + }; + }; + + lvm_vg = { + "${config.networking.hostName}" = { + type = "lvm_vg"; + lvs = { + root = { + size = "100%"; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; + subvolumes = { + "/root" = { + mountpoint = "/"; + mountOptions = [ "compress=zstd" "noatime" "ssd" ]; + }; + "/prev" = { + mountpoint = "/prev"; + mountOptions = [ "compress=zstd" "noatime" "ssd" "noexec" ]; + }; + "/nix" = { + mountpoint = "/nix"; + mountOptions = [ "compress=zstd" "noatime" "ssd" ]; + }; + + # Impermanence + "/persist" = { + mountpoint = "/persist"; + mountOptions = [ "compress=zstd" "noatime" "ssd" ]; + }; + "/persist/.snapshots" = { }; + "/persist/home/${config.sysusers.main}" = { }; + "/persist/home/${config.sysusers.main}/.snapshots" = { }; + }; + }; + }; + swap = { + size = "8G"; + content = { + type = "swap"; + discardPolicy = "both"; + }; + }; + }; + }; + }; + }; + + # Needed for impermanence + fileSystems."/persist".neededForBoot = true; +} diff --git a/hosts/midas/filesystems/default.nix b/hosts/midas/filesystems/default.nix new file mode 100644 index 0000000..d1a9fb2 --- /dev/null +++ b/hosts/midas/filesystems/default.nix @@ -0,0 +1,48 @@ +{ config, ... }: +{ + fileSystems = { + # Games and such + "/mnt/Linux1" = { + device = "/dev/disk/by-uuid/b2901f8c-ffda-4b88-bb63-a9ea0c96ccb4"; + fsType = "ext4"; + options = [ "nosuid" "nodev" "nofail" "x-gvfs-show" ]; + }; + "/mnt/Linux2" = { + device = "/dev/disk/by-uuid/f08e4f38-162c-402f-ba2a-5925151b78bf"; + fsType = "ext4"; + options = [ "nosuid" "nodev" "nofail" "x-gvfs-show" ]; + }; + "/mnt/Linux3" = { + device = "/dev/disk/by-uuid/e7bc75bd-c371-4b28-b212-7be9b1fad339"; + fsType = "ext4"; + options = [ "nosuid" "nodev" "nofail" "x-gvfs-show" ]; + }; + "/mnt/Windows1" = { + device = "/dev/disk/by-uuid/48F5C6E06416229C"; + options = [ "nosuid" "nodev" "noauto" ]; + }; + "/mnt/Windows2" = { + device = "/dev/disk/by-uuid/0A5A3420237C863A"; + options = [ "nosuid" "nodev" "noauto" ]; + }; + + # Bulk storage mounts + "/persist/var/lib/libvirt" = { + device = "/dev/disk/by-uuid/abf78669-de2a-4afa-8e62-604f4e4cb355"; + fsType = "btrfs"; + options = [ "subvol=libvirt" "nosuid" "nodev" "nofail" ]; + }; + "/persist/home/${config.sysusers.main}/VMs" = { + device = "/dev/disk/by-uuid/abf78669-de2a-4afa-8e62-604f4e4cb355"; + fsType = "btrfs"; + options = [ "subvol=images" "nosuid" "nodev" "nofail" ]; + }; + + # Network mounts + "/home/${config.sysusers.main}/KittyNFS" = { + device = "${config.ips.server}:/export/KittyNFS"; + fsType = "nfs4"; + options = [ "x-systemd.automount" "noauto" "soft" "_netdev" ]; + }; + }; +} diff --git a/hosts/midas/hardware/default.nix b/hosts/midas/hardware/default.nix new file mode 100644 index 0000000..6e5be0a --- /dev/null +++ b/hosts/midas/hardware/default.nix @@ -0,0 +1,12 @@ +# nixos-generate-config --root ./ --no-filesystems +{ config, lib, modulesPath, ... }: +{ + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + + networking.useDHCP = lib.mkDefault true; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/midas/users/default.nix b/hosts/midas/users/default.nix new file mode 100644 index 0000000..57e7f20 --- /dev/null +++ b/hosts/midas/users/default.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + imports = [ ./main ]; +} diff --git a/hosts/midas/users/main/default.nix b/hosts/midas/users/main/default.nix new file mode 100644 index 0000000..be52ead --- /dev/null +++ b/hosts/midas/users/main/default.nix @@ -0,0 +1,11 @@ +{ config, lib, ... }: +{ + home-manager.users."${config.sysusers.main}" = { + home = { + desktop.enable = true; + gaming.enable = true; + production.enable = true; + stateVersion = lib.mkForce config.system.stateVersion; + }; + }; +}