From b717ea973afe28766754d8b4176bae1f72339406 Mon Sep 17 00:00:00 2001 From: "matthew.binning" Date: Wed, 11 Feb 2026 05:13:20 -0800 Subject: [PATCH] feat: Convert to a multi-host flake --- .gitignore | 1 - configuration.nix | 11 - flake.lock | 314 ++++++++++++++++++++ flake.nix | 37 ++- anvil.nix => hosts/anvil/default.nix | 7 +- hosts/anvil/hardware-configuration.nix | 20 ++ hosts/anvil/nginx.nix | 5 + crossbox.nix => hosts/crossbox/default.nix | 9 + docuseal.nix => hosts/crossbox/docuseal.nix | 0 forgejo.nix => hosts/crossbox/forgejo.nix | 0 hosts/crossbox/hardware-configuration.nix | 39 +++ nginx.nix => hosts/crossbox/nginx.nix | 0 ollama.nix => hosts/crossbox/ollama.nix | 0 radicale.nix => hosts/crossbox/radicale.nix | 0 14 files changed, 416 insertions(+), 27 deletions(-) create mode 100644 flake.lock rename anvil.nix => hosts/anvil/default.nix (78%) create mode 100644 hosts/anvil/hardware-configuration.nix create mode 100644 hosts/anvil/nginx.nix rename crossbox.nix => hosts/crossbox/default.nix (93%) rename docuseal.nix => hosts/crossbox/docuseal.nix (100%) rename forgejo.nix => hosts/crossbox/forgejo.nix (100%) create mode 100644 hosts/crossbox/hardware-configuration.nix rename nginx.nix => hosts/crossbox/nginx.nix (100%) rename ollama.nix => hosts/crossbox/ollama.nix (100%) rename radicale.nix => hosts/crossbox/radicale.nix (100%) diff --git a/.gitignore b/.gitignore index 15d854b..fd03719 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,5 @@ result-* # Ignore automatically generated direnv output .direnv -hardware-configuration.nix comfy-ui.nix *.bak diff --git a/configuration.nix b/configuration.nix index 12c0dab..b1f11bb 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,17 +1,6 @@ { config, pkgs, ... }: -let - hostConfigs = { - crossbox = [ ./crossbox.nix ./sdr.nix ./syncthing.nix ./forgejo.nix ./radicale.nix ./ollama.nix #./docuseal.nix - ./nginx.nix ]; - anvil = [ ./anvil.nix ./sdr.nix ./vpn.nix ./syncthing.nix ./staging.nginx.nix ]; - }; -in { - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ] ++ hostConfigs.crossbox; nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.gc = { diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..a63e9a0 --- /dev/null +++ b/flake.lock @@ -0,0 +1,314 @@ +{ + "nodes": { + "chaotic": { + "inputs": { + "flake-schemas": "flake-schemas", + "home-manager": "home-manager", + "jovian": "jovian", + "nixpkgs": "nixpkgs_2", + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1754907869, + "narHash": "sha256-tzshAAjt0xDjCc/aOgii6PSqePIc2rWYSXF8VnqEhIg=", + "owner": "chaotic-cx", + "repo": "nyx", + "rev": "b5f83e0d7bce67af178f6aaef95853fedf4c00a0", + "type": "github" + }, + "original": { + "owner": "chaotic-cx", + "ref": "nyxpkgs-unstable", + "repo": "nyx", + "type": "github" + } + }, + "disko": { + "inputs": { + "nixpkgs": [ + "strix-halo", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1754971456, + "narHash": "sha256-p04ZnIBGzerSyiY2dNGmookCldhldWAu03y0s3P8CB0=", + "owner": "nix-community", + "repo": "disko", + "rev": "8246829f2e675a46919718f9a64b71afe3bfb22d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, + "ec-su-axb35": { + "flake": false, + "locked": { + "lastModified": 1752926484, + "narHash": "sha256-CKMoltjRCvfKF7tJvP+wvwiuy2EpTP3vGbs875ey/7M=", + "owner": "cmetz", + "repo": "ec-su_axb35-linux", + "rev": "1761092d215322a62dee19afab7b4765788611eb", + "type": "github" + }, + "original": { + "owner": "cmetz", + "repo": "ec-su_axb35-linux", + "type": "github" + } + }, + "flake-schemas": { + "locked": { + "lastModified": 1721999734, + "narHash": "sha256-G5CxYeJVm4lcEtaO87LKzOsVnWeTcHGKbKxNamNWgOw=", + "rev": "0a5c42297d870156d9c57d8f99e476b738dcd982", + "revCount": 75, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.5/0190ef2f-61e0-794b-ba14-e82f225e55e6/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%3D0.1.5.tar.gz" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "strix-halo", + "chaotic", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1754886238, + "narHash": "sha256-LTQomWOwG70lZR+78ZYSZ9sYELWNq3HJ7/tdHzfif/s=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "0d492b89d1993579e63b9dbdaed17fd7824834da", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "jovian": { + "inputs": { + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "strix-halo", + "chaotic", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1754639028, + "narHash": "sha256-w1+XzPBAZPbeGLMAgAlOjIquswo6Q42PMep9KSrRzOA=", + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "rev": "d49809278138d17be77ab0ef5506b26dc477fa62", + "type": "github" + }, + "original": { + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "type": "github" + } + }, + "llama-cpp": { + "flake": false, + "locked": { + "lastModified": 1755068833, + "narHash": "sha256-U2bNRei5Q+fpMmk0Oc2HVSIY6KSBhgcNNkNhGykpG2c=", + "owner": "ggerganov", + "repo": "llama.cpp", + "rev": "bc5182272c373267352bc689e5fca276934bea2d", + "type": "github" + }, + "original": { + "owner": "ggerganov", + "repo": "llama.cpp", + "type": "github" + } + }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "strix-halo", + "chaotic", + "jovian", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1729697500, + "narHash": "sha256-VFTWrbzDlZyFHHb1AlKRiD/qqCJIripXKiCSFS8fAOY=", + "owner": "zhaofengli", + "repo": "nix-github-actions", + "rev": "e418aeb728b6aa5ca8c5c71974e7159c2df1d8cf", + "type": "github" + }, + "original": { + "owner": "zhaofengli", + "ref": "matrix-name", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1770562336, + "narHash": "sha256-ub1gpAONMFsT/GU2hV6ZWJjur8rJ6kKxdm9IlCT0j84=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d6c71932130818840fc8fe9509cf50be8c64634f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1754725699, + "narHash": "sha256-iAcj9T/Y+3DBy2J0N+yF9XQQQ8IEb5swLFzs23CdP88=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "85dbfc7aaf52ecb755f87e577ddbe6dbbdbc1054", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1754725699, + "narHash": "sha256-iAcj9T/Y+3DBy2J0N+yF9XQQQ8IEb5swLFzs23CdP88=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "85dbfc7aaf52ecb755f87e577ddbe6dbbdbc1054", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "rocwmma": { + "flake": false, + "locked": { + "lastModified": 1755039337, + "narHash": "sha256-qs6SFRRQHDJjja5GM91y0q5VpX/qzrtcGqdPN4FJMWI=", + "owner": "ROCm", + "repo": "rocWMMA", + "rev": "697624de0919f62f0f42bb237dd45d0296fc2c1a", + "type": "github" + }, + "original": { + "owner": "ROCm", + "repo": "rocWMMA", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "strix-halo": "strix-halo" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "strix-halo", + "chaotic", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1754880555, + "narHash": "sha256-tG6l0wiX8V8IvG4HFYY8IYN5vpNAxQ+UWunjjpE6SqU=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "17c591a44e4eb77f05f27cd37e1cfc3f219c7fc4", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "strix-halo": { + "inputs": { + "chaotic": "chaotic", + "disko": "disko", + "ec-su-axb35": "ec-su-axb35", + "flake-utils": "flake-utils", + "llama-cpp": "llama-cpp", + "nixpkgs": "nixpkgs_3", + "rocwmma": "rocwmma" + }, + "locked": { + "lastModified": 1766179824, + "narHash": "sha256-11kC3d0GrpodpZ8yVJFsgNjdUlw99yvAa9Q2LOHtQWw=", + "owner": "hellas-ai", + "repo": "nix-strix-halo", + "rev": "3d090ab99f3b86b33f10c30c283225fbf4f16628", + "type": "github" + }, + "original": { + "owner": "hellas-ai", + "repo": "nix-strix-halo", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index 44638eb..9ccf9e4 100644 --- a/flake.nix +++ b/flake.nix @@ -1,23 +1,32 @@ -# /etc/nixos/flake.nix { - description = "Framework Desktop with Strix Halo"; + description = "NixOS configurations for crossbox and anvil"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; strix-halo.url = "github:hellas-ai/nix-strix-halo"; }; - outputs = { self, nixpkgs, strix-halo, ... }: { - nixosConfigurations.crossbox = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ./configuration.nix - - ({ pkgs, ... }: { - # Apply Strix Halo overlay - nixpkgs.overlays = [ strix-halo.overlays.default ]; - }) - ]; + outputs = { self, nixpkgs, strix-halo, ... }: + let + mkHost = { hostDir, extraModules ? [], overlays ? [] }: + nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./configuration.nix + hostDir + ({ ... }: { nixpkgs.overlays = overlays; }) + ] ++ extraModules; + }; + in { + nixosConfigurations.crossbox = mkHost { + hostDir = ./hosts/crossbox; + overlays = [ strix-halo.overlays.default ]; + extraModules = [ ./sdr.nix ./syncthing.nix ]; + }; + + nixosConfigurations.anvil = mkHost { + hostDir = ./hosts/anvil; + extraModules = [ ./sdr.nix ./syncthing.nix ]; }; }; -} \ No newline at end of file +} diff --git a/anvil.nix b/hosts/anvil/default.nix similarity index 78% rename from anvil.nix rename to hosts/anvil/default.nix index 7b718ef..ab180b1 100644 --- a/anvil.nix +++ b/hosts/anvil/default.nix @@ -1,10 +1,15 @@ { config, pkgs, ... }: { + imports = [ + ./hardware-configuration.nix + # ./nginx.nix # TODO + ]; + networking.hostName = "anvil"; system.stateVersion = "24.11"; networking.firewall.allowedTCPPorts = [ 8384 ]; - hardware.pulseaudio.enable = false; + services.pulseaudio.enable = false; boot.initrd.luks.devices."luks-1f261d60-dfb4-4f63-9c77-f331a007108b".device = "/dev/disk/by-uuid/1f261d60-dfb4-4f63-9c77-f331a007108b"; diff --git a/hosts/anvil/hardware-configuration.nix b/hosts/anvil/hardware-configuration.nix new file mode 100644 index 0000000..661efab --- /dev/null +++ b/hosts/anvil/hardware-configuration.nix @@ -0,0 +1,20 @@ +# TODO: Replace with actual hardware-configuration.nix from anvil machine +# Run on anvil: nixos-generate-config --show-hardware-config +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + # Placeholder filesystem - replace with actual values from anvil + fileSystems."/" = { + device = "/dev/disk/by-uuid/PLACEHOLDER"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/PLACEHOLDER"; + fsType = "vfat"; + }; +} diff --git a/hosts/anvil/nginx.nix b/hosts/anvil/nginx.nix new file mode 100644 index 0000000..ea17920 --- /dev/null +++ b/hosts/anvil/nginx.nix @@ -0,0 +1,5 @@ +# TODO: Configure anvil's nginx +{ config, pkgs, lib, ... }: + +{ +} diff --git a/crossbox.nix b/hosts/crossbox/default.nix similarity index 93% rename from crossbox.nix rename to hosts/crossbox/default.nix index 02d8592..3811cd4 100644 --- a/crossbox.nix +++ b/hosts/crossbox/default.nix @@ -9,6 +9,15 @@ let }) { system = pkgs.system; }; in { + imports = [ + ./hardware-configuration.nix + ./nginx.nix + ./forgejo.nix + ./radicale.nix + ./ollama.nix + # ./docuseal.nix + ]; + environment.systemPackages = with pkgs; [ bisqPkgs.bisq-desktop # v1.9.15-1.9.17 from nixos-24.05 bisq2 diff --git a/docuseal.nix b/hosts/crossbox/docuseal.nix similarity index 100% rename from docuseal.nix rename to hosts/crossbox/docuseal.nix diff --git a/forgejo.nix b/hosts/crossbox/forgejo.nix similarity index 100% rename from forgejo.nix rename to hosts/crossbox/forgejo.nix diff --git a/hosts/crossbox/hardware-configuration.nix b/hosts/crossbox/hardware-configuration.nix new file mode 100644 index 0000000..8b1187f --- /dev/null +++ b/hosts/crossbox/hardware-configuration.nix @@ -0,0 +1,39 @@ +# 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, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usbhid" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/da4a61ca-f2f7-47d3-a902-a898e2cf1dfc"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/36FB-9CD5"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + fileSystems."/data" = + { device = "/dev/disk/by-uuid/1e785349-ecd9-4b0f-9dc6-f6e3a6fe95f1"; + fsType = "ext4"; + options = [ "noatime" "users" "nofail" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/69fc5898-4a33-431e-bea6-3ce7352312bf"; } + ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/nginx.nix b/hosts/crossbox/nginx.nix similarity index 100% rename from nginx.nix rename to hosts/crossbox/nginx.nix diff --git a/ollama.nix b/hosts/crossbox/ollama.nix similarity index 100% rename from ollama.nix rename to hosts/crossbox/ollama.nix diff --git a/radicale.nix b/hosts/crossbox/radicale.nix similarity index 100% rename from radicale.nix rename to hosts/crossbox/radicale.nix