feat: try out colmena
Signed-off-by: Lander Van den Bulcke <landervandenbulcke@gmail.com>
This commit is contained in:
parent
7d306e67fa
commit
81807eeaa8
4 changed files with 309 additions and 28 deletions
71
flake.nix
71
flake.nix
|
|
@ -26,6 +26,9 @@
|
|||
# deploy-rs
|
||||
deploy-rs.url = "github:serokell/deploy-rs";
|
||||
|
||||
# colmena
|
||||
colmena.url = "github:zhaofengli/colmena";
|
||||
|
||||
# nixos-wsl
|
||||
nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
|
||||
|
||||
|
|
@ -58,6 +61,7 @@
|
|||
nixpkgs,
|
||||
tidalcycles,
|
||||
deploy-rs,
|
||||
colmena,
|
||||
...
|
||||
}@inputs:
|
||||
let
|
||||
|
|
@ -92,6 +96,20 @@
|
|||
nixosModules = import ./modules/nixos;
|
||||
homeManagerModules = import ./modules/home-manager;
|
||||
|
||||
devShells = forAllSystems (
|
||||
system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
{
|
||||
default = pkgs.mkShell {
|
||||
buildInputs = [
|
||||
colmena.packages.${system}.colmena
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
nixosConfigurations =
|
||||
let
|
||||
hetzner = import ./lib/hetzner.nix { inherit inputs nixpkgs; };
|
||||
|
|
@ -136,7 +154,7 @@
|
|||
};
|
||||
|
||||
# servers
|
||||
db-01 = hetzner.mkHetznerMachine "db-01" {
|
||||
db-01 = hetzner.mkMachine "db-01" {
|
||||
ipv6Address = "2a01:4f8:c012:15d4::/64";
|
||||
};
|
||||
hosting-01 = nixpkgs.lib.nixosSystem {
|
||||
|
|
@ -146,7 +164,7 @@
|
|||
./hosts/hosting-01
|
||||
];
|
||||
};
|
||||
hosting-02 = hetzner.mkHetznerMachine "hosting-02" {
|
||||
hosting-02 = hetzner.mkMachine "hosting-02" {
|
||||
ipv6Address = "2a01:4f8:c013:7fc0::/64";
|
||||
};
|
||||
mail-01 = nixpkgs.lib.nixosSystem {
|
||||
|
|
@ -166,6 +184,55 @@
|
|||
};
|
||||
}) { inherit (self.nixosConfigurations) db-01 hosting-02; };
|
||||
|
||||
colmenaHive =
|
||||
let
|
||||
servers = builtins.map (file: nixpkgs.lib.removeSuffix ".nix" file) (
|
||||
builtins.filter (file: file != "common.nix" && nixpkgs.lib.hasSuffix ".nix" file) (
|
||||
builtins.attrNames (builtins.readDir ./hosts/servers)
|
||||
)
|
||||
);
|
||||
|
||||
colmenaConfig = nixpkgs.lib.genAttrs servers (
|
||||
name:
|
||||
{ ... }:
|
||||
let
|
||||
diskConfig = import ./lib/disk-config.nix { inherit nixpkgs; };
|
||||
machineConfig = import ./hosts/servers/${name}.nix;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
inputs.disko.nixosModules.disko
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
inputs.self.nixosModules.namespaced-vpn
|
||||
inputs.self.nixosModules.storagebox
|
||||
|
||||
./hosts/servers/common.nix
|
||||
|
||||
diskConfig
|
||||
machineConfig
|
||||
];
|
||||
|
||||
deployment = {
|
||||
targetHost = "${name}.escapeangle.com";
|
||||
targetPort = 22;
|
||||
targetUser = "root";
|
||||
buildOnTarget = true;
|
||||
};
|
||||
}
|
||||
);
|
||||
in
|
||||
colmena.lib.makeHive (
|
||||
{
|
||||
meta = {
|
||||
nixpkgs = import nixpkgs {
|
||||
system = "aarch64-linux";
|
||||
overlays = [ ];
|
||||
};
|
||||
};
|
||||
}
|
||||
// colmenaConfig
|
||||
);
|
||||
|
||||
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue