implement cerulean.nexus.nodes

This commit is contained in:
do butterflies cry? 2025-12-13 13:24:37 +10:00
parent decb028d19
commit bb362d9470
2 changed files with 74 additions and 50 deletions

View file

@ -1,34 +1,85 @@
{
description = "Your Nix Cloud Simplified";
inputs = {
inputs = let
follows = following: {
inputs = builtins.listToAttrs (builtins.map (x: {
name = x;
value = {follows = x;};
})
following);
};
in {
systems.url = "github:nix-systems/default";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default";
};
outputs = inputs @ {
self,
systems,
nixpkgs,
...
}: let
defaultSystems = ["aarch64-darwin" "aarch64-linux" "i686-linux" "x86_64-darwin" "x86_64-linux"];
forAllSystems = f:
nixpkgs.lib.genAttrs defaultSystems (system:
f system (import nixpkgs {
inherit system;
overlays = builtins.attrValues self.overlays;
}));
in {
overlays.default = final: prev: {
nib = {
url = "github:emileclarkb/nib";
inputs = follows ["systems"];
};
checks = self.packages;
packages =
forAllSystems (system: pkgs: rec {
deploy-rs.url = "github:serokell/deploy-rs";
};
outputs = {
self,
nixpkgs,
nixpkgs-unstable,
nib,
deploy-rs,
...
} @ inputs: let
lib = nixpkgs.lib;
sys = with nib;
mkUSys {
pkgs = withPkgs nixpkgs {
config.allowUnfree = false;
overlays = builtins.attrValues self.overlays;
};
upkgs = withPkgs nixpkgs-unstable {
config.allowUnfree = false;
};
};
in rec {
# overlays.default = final: prev: {
# };
# checks = self.packages;
# packages =
# forAllSystems (system: pkgs: rec {
# });
mkNexusConfig = config: let
mapNodes = f: lib.mapAttrs f config.nexus.nodes;
in rec {
nixosConfigurations = mapNodes (
name: node:
lib.nixosSystem {
system = node.system;
modules = node.modules;
}
);
deploy.nodes = mapNodes (name: node: {
hostname = name;
profiles.system = {
user = "root";
path = let
system = node.system;
in
deploy-rs.lib.${system}.activate.nixos nixosConfigurations.${system};
};
});
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks deploy) deploy-rs.lib;
};
mkNexus = outputs: let
config = outputs.cerulean;
in
(mkNexusConfig config) // (builtins.removeAttrs outputs ["cerulean"]);
};
}