diff --git a/flake.lock b/flake.lock index bfa81d1..173b119 100644 --- a/flake.lock +++ b/flake.lock @@ -1000,11 +1000,11 @@ "secrets": { "flake": false, "locked": { - "lastModified": 1750611706, - "narHash": "sha256-bKhQ+lAaNtfpTUR3fysCdbnMfYT5PJ4diiM9EkHMdHI=", + "lastModified": 1752936308, + "narHash": "sha256-OAlj8oJpcKo9cCIwxzMolnwdfczlovvC1y1MeIpDPYM=", "ref": "refs/heads/master", - "rev": "ae16fda90546dde6c014a4f91a5443bce4dce234", - "revCount": 34, + "rev": "eddee7a0b83063ba60c0dd49fc18399b6564559d", + "revCount": 36, "type": "git", "url": "ssh://git@git.vimium.com/jordan/nix-secrets.git" }, diff --git a/hosts/artemis/README.md b/hosts/artemis/README.md new file mode 100644 index 0000000..3543896 --- /dev/null +++ b/hosts/artemis/README.md @@ -0,0 +1,36 @@ +# Artemis + +## Overview +Couch gaming PC and media centre + +## Specs +* CPU - AMD Ryzen 7 9800X3D @ 4.70GHz +* Chipset - AMD B850 +* Memory - 64 GB DDR5 +* Motherboard - ASUS ROG STRIX B850-I Gaming WiFi +* GPU - AMD Radeon 7900 XTX +* Case - MCPRUE Apollo S v4 + +### Disks +Device | Partitions _(filesystem, size, usage)_ +--- | --- +WD Black SN850X | `/dev/nvme0n1p1` (EFI, 500 MiB, NixOS Boot)
`/dev/nvme0n1p2` (ZFS, 4 TiB, NixOS Root) + +#### ZFS pool layout +``` +rpool/ +├── local +│ ├── nix +│ └── tmp +├── system +│ ├── root +│ └── var +└── user + └── home +``` + +See [Graham Christensen's article](https://grahamc.com/blog/nixos-on-zfs/#datasets) for the motivation behind these datasets. + +### Networks +- DHCP on `10.0.1.0/24` subnet. +- Tailscale on `100.64.0.0/10` subnet. FQDN: `artemis.mesh.vimium.net`. diff --git a/hosts/artemis/default.nix b/hosts/artemis/default.nix new file mode 100644 index 0000000..a5836a9 --- /dev/null +++ b/hosts/artemis/default.nix @@ -0,0 +1,56 @@ +{ + inputs, + lib, + pkgs, + ... +}: + +{ + imports = [ + inputs.disko.nixosModules.disko + ./hardware-configuration.nix + ./disko-config.nix + ../desktop.nix + ]; + + nixpkgs = { + hostPlatform = "x86_64-linux"; + }; + + boot.loader = { + systemd-boot = { + enable = true; + graceful = true; + }; + efi.canTouchEfiVariables = true; + }; + + networking = { + hostId = "4f9a2b7e"; + networkmanager.enable = true; + }; + + services.sunshine = { + enable = false; + package = pkgs.unstable.sunshine; + capSysAdmin = true; + }; + + modules = { + services = { + borgmatic = { + enable = true; + directories = [ + "/home/jordan/Documents" + ]; + repoPath = "ssh://neafzrj7@neafzrj7.repo.borgbase.com/./repo"; + }; + }; + system.desktop = { + gnome.enable = lib.mkForce false; + hyprland.enable = true; + }; + }; + + system.stateVersion = "25.05"; +} diff --git a/hosts/artemis/disko-config.nix b/hosts/artemis/disko-config.nix new file mode 100644 index 0000000..f6af2c7 --- /dev/null +++ b/hosts/artemis/disko-config.nix @@ -0,0 +1,118 @@ +{ ... }: +{ + disko.devices = { + disk = { + main = { + type = "disk"; + device = "/dev/disk/by-id/nvme-WD_BLACK_SN850X_4000GB_25115L4A0708"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "500M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + zfs = { + size = "100%"; + content = { + type = "zfs"; + pool = "rpool"; + }; + }; + }; + }; + }; + }; + zpool = { + rpool = { + type = "zpool"; + options = { + ashift = "12"; + }; + rootFsOptions = { + canmount = "off"; + mountpoint = "none"; + dnodesize = "auto"; + xattr = "sa"; + }; + postCreateHook = "zfs snapshot rpool@blank"; + datasets = { + local = { + type = "zfs_fs"; + options = { + mountpoint = "none"; + }; + }; + "local/nix" = { + type = "zfs_fs"; + mountpoint = "/nix"; + options = { + atime = "off"; + mountpoint = "legacy"; + }; + }; + "local/tmp" = { + type = "zfs_fs"; + mountpoint = "/tmp"; + options = { + setuid = "off"; + devices = "off"; + mountpoint = "legacy"; + }; + }; + system = { + type = "zfs_fs"; + mountpoint = "/"; + options = { + mountpoint = "legacy"; + }; + }; + "system/var" = { + type = "zfs_fs"; + mountpoint = "/var"; + options = { + mountpoint = "legacy"; + }; + }; + "system/var/tmp" = { + type = "zfs_fs"; + mountpoint = "/var/tmp"; + options = { + devices = "off"; + mountpoint = "legacy"; + }; + }; + "system/var/log" = { + type = "zfs_fs"; + mountpoint = "/var/log"; + options = { + compression = "on"; + acltype = "posix"; + mountpoint = "legacy"; + }; + }; + user = { + type = "zfs_fs"; + options = { + mountpoint = "none"; + }; + }; + "user/home" = { + type = "zfs_fs"; + mountpoint = "/home"; + options = { + setuid = "off"; + devices = "off"; + mountpoint = "legacy"; + }; + }; + }; + }; + }; + }; +} diff --git a/hosts/artemis/hardware-configuration.nix b/hosts/artemis/hardware-configuration.nix new file mode 100644 index 0000000..39fb7d4 --- /dev/null +++ b/hosts/artemis/hardware-configuration.nix @@ -0,0 +1,45 @@ +{ + config, + lib, + pkgs, + modulesPath, + ... +}: + +{ + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot = { + initrd.availableKernelModules = [ + "xhci_pci" + "ehci_pci" + "nvme" + "usbhid" + "usb_storage" + "sd_mod" + ]; + initrd.kernelModules = [ ]; + initrd.supportedFilesystems = [ "zfs" ]; + kernelModules = [ "kvm-amd" ]; + kernelPackages = pkgs.linuxPackages_6_12; + supportedFilesystems = [ "ntfs" ]; + }; + + hardware = { + bluetooth = { + enable = true; + powerOnBoot = true; + }; + cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + }; + + powerManagement.cpuFreqGovernor = "schedutil"; + + services.xserver.videoDrivers = [ "amdgpu" ]; + + networking.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/users/jordan/artemis.nix b/users/jordan/artemis.nix new file mode 100644 index 0000000..5f89a90 --- /dev/null +++ b/users/jordan/artemis.nix @@ -0,0 +1,20 @@ +{ + pkgs, + ... +}: + +{ + imports = [ + ./common/optional/graphical/firefox.nix + ./common/optional/graphical/fonts.nix + ./common/optional/graphical/hyprland + ./common/optional/graphical/mimeapps.nix + ]; + + home.packages = with pkgs; [ + jellyfin-media-player + lutris + unstable.pcsx2 + xemu + ]; +}