cerulean/flake.nix

78 lines
1.7 KiB
Nix
Raw Normal View History

2025-12-13 09:30:20 +10:00
{
description = "Your Nix Cloud Simplified";
inputs = {
2025-12-13 13:24:37 +10:00
systems.url = "github:nix-systems/default";
2025-12-13 09:30:20 +10:00
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
2025-12-13 13:24:37 +10:00
nib = {
url = "github:emilelcb/nib";
inputs.systems.follows = "systems";
2025-12-13 13:24:37 +10:00
};
deploy-rs.url = "github:serokell/deploy-rs";
2025-12-13 09:30:20 +10:00
};
2025-12-13 13:24:37 +10:00
outputs = {
2025-12-13 09:30:20 +10:00
self,
nixpkgs,
2025-12-13 13:24:37 +10:00
nixpkgs-unstable,
nib,
deploy-rs,
2025-12-13 09:30:20 +10:00
...
2025-12-13 13:24:37 +10:00
} @ inputs: let
lib = nixpkgs.lib;
2025-12-13 09:30:20 +10:00
2025-12-13 13:24:37 +10:00
sys = with nib;
mkUSys {
pkgs = withPkgs nixpkgs {
config.allowUnfree = false;
2025-12-13 09:30:20 +10:00
overlays = builtins.attrValues self.overlays;
2025-12-13 13:24:37 +10:00
};
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;
}
);
2025-12-13 09:30:20 +10:00
2025-12-13 13:24:37 +10:00
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};
};
2025-12-13 09:30:20 +10:00
});
2025-12-13 13:24:37 +10:00
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks deploy) deploy-rs.lib;
};
mkNexus = outputs: let
config = outputs.cerulean;
in
(mkNexusConfig config) // (builtins.removeAttrs outputs ["cerulean"]);
2025-12-13 09:30:20 +10:00
};
}