feat: Convert to a multi-host flake

This commit is contained in:
matthew.binning 2026-02-11 05:13:20 -08:00
parent c20fd46f9f
commit b717ea973a
14 changed files with 416 additions and 27 deletions

1
.gitignore vendored
View file

@ -6,6 +6,5 @@ result-*
# Ignore automatically generated direnv output
.direnv
hardware-configuration.nix
comfy-ui.nix
*.bak

View file

@ -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 = {

314
flake.lock generated Normal file
View file

@ -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
}

View file

@ -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 ];
};
};
}
}

View file

@ -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";

View file

@ -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";
};
}

5
hosts/anvil/nginx.nix Normal file
View file

@ -0,0 +1,5 @@
# TODO: Configure anvil's nginx
{ config, pkgs, lib, ... }:
{
}

View file

@ -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

View file

@ -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;
}