Anotther flake.nix bump.

This commit is contained in:
Yaro Kasear 2025-11-29 14:47:32 -06:00
parent 8b2042e2bd
commit f4023c47b0

View file

@ -10,61 +10,92 @@
outputs = { self, nixpkgs, deploy-rs, disko, nixos-anywhere, ... }:
let
system = "x86_64-linux";
# Default architecture if a system doesnt override it
defaultSystem = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
lib = pkgs.lib;
# pkgs per-system so cross-arch doesnt explode later
pkgsFor = system: import nixpkgs { inherit system; };
addressing = import ./lib/addressing {
inherit lib;
};
lib = nixpkgs.lib;
# World spec & addressing
meta = import ./meta.nix;
addressing = import ./lib/addressing { inherit lib; };
# Optional for now; meta.systems can be {} until the systems submodule lands
systemsFromMeta = meta.systems or { };
# Precomputed full network view
network = addressing.mkNetworkFromSpec meta;
in
{
########################
# Library exports
########################
lib.metanix = {
inherit meta addressing;
network = addressing.mkNetworkFromSpec meta;
inherit meta addressing network;
};
########################
# NixOS configurations
########################
nixosConfigurations =
lib.mapAttrs
(name: sysCfg:
let
systemForHost = sysCfg.system or system;
# System for this host, fallback to default
system = sysCfg.system or defaultSystem;
pkgs = pkgsFor system;
in
lib.nixosSystem {
system = systemForHost;
inherit system;
# Make meta + addressing available to all modules
# Make meta/addressing/world visible to modules
specialArgs = {
inherit meta addressing;
inherit lib pkgs meta addressing system;
modulesPath = builtins.toString <nixpkgs/nixos/modules>;
};
modules =
(sysCfg.modules or [ ]) ++ [
# Core Metanix wiring
./modules/metanix/core.nix
./modules/metanix/networkd.nix
# Disko wiring if present
# Identity binding: “this box is <name> in Metanix”
{
networking.hostName = sysCfg.hostName or name;
metanix.thisHost = sysCfg.metanixName or name;
}
# Optional Disko integration per host
(if sysCfg ? diskoConfig then
{ imports = [ disko.nixosModules.disko sysCfg.diskoConfig ]; }
{
imports = [
disko.nixosModules.disko
sysCfg.diskoConfig
];
}
else
{ })
];
})
systemsFromMeta;
########################
# deploy-rs
########################
deploy = {
nodes =
lib.mapAttrs
(name: sysCfg:
let
network = addressing.mkNetworkFromSpec meta;
hasNetworkHost = builtins.hasAttr name network.hosts;
hostInfo = if hasNetworkHost then network.hosts.${name} else null;
defaultHostname =
if hasNetworkHost then hostInfo.fqdn else "${name}.${meta.domain}";
in
@ -74,20 +105,24 @@
profiles.system = {
user = sysCfg.deployUser or "root";
path =
deploy-rs.lib.${system}.activate.nixos
deploy-rs.lib.${defaultSystem}.activate.nixos
self.nixosConfigurations.${name};
};
})
systemsFromMeta;
};
checks.${system}.deploy =
deploy-rs.lib.${system}.deployChecks self.deploy;
checks.${defaultSystem}.deploy =
deploy-rs.lib.${defaultSystem}.deployChecks self.deploy;
apps.${system}.nixos-anywhere = {
########################
# nixos-anywhere helper
########################
apps.${defaultSystem}.nixos-anywhere = {
type = "app";
program =
"${nixos-anywhere.packages.${system}.nixos-anywhere}/bin/nixos-anywhere";
"${nixos-anywhere.packages.${defaultSystem}.nixos-anywhere}/bin/nixos-anywhere";
};
};
}