Skip to content

Commit 50e6d0e

Browse files
committed
Introduce fleet management with colmena
This commit modifies the main flake to allow for the use of colmena as a fleet management tool.
1 parent 9650877 commit 50e6d0e

File tree

2 files changed

+39
-8
lines changed

2 files changed

+39
-8
lines changed

flake.nix

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,58 @@
1111

1212
inputs = {
1313
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
14+
colmena.url = "github:zhaofengli/colmena";
1415
sops-nix.url = "github:Mic92/sops-nix";
15-
nix-minecraft.url = "github:Infinidoge/nix-minecraft";
1616
};
1717

1818
outputs =
19-
inputs@{ self, nixpkgs, ... }:
19+
inputs@{
20+
self,
21+
nixpkgs,
22+
colmena,
23+
...
24+
}:
2025
let
2126
system = "x86_64-linux";
2227
pkgs = nixpkgs.legacyPackages.${system};
2328
in
2429
{
25-
# The itx server hosting most of my homelab.
26-
nixosConfigurations.itxserver = nixpkgs.lib.nixosSystem {
27-
specialArgs = { inherit inputs; };
28-
modules = [ ./hosts/itxserver/configuration.nix ];
30+
# Define a local nix-develop environment
31+
devShells.${system}.default = pkgs.mkShell {
32+
buildInputs = [ colmena.packages.${system}.colmena ];
33+
};
34+
35+
# Manage the entire fleet with colmena
36+
colmenaHive = colmena.lib.makeHive {
37+
meta = {
38+
nixpkgs = import nixpkgs {
39+
inherit system;
40+
};
41+
specialArgs = { inherit inputs; };
42+
};
43+
44+
# The itx server hosting most of my homelab
45+
alfa = {
46+
deployment = {
47+
targetHost = "100.89.38.72";
48+
targetUser = "lukas";
49+
tags = [ "homelab" ];
50+
};
51+
52+
imports = [
53+
./hosts/itxserver/configuration.nix
54+
];
55+
};
2956
};
3057

58+
# Although the whole fleet can be managed with colmena, I like to have a
59+
# vanilla nixos fallback option in case colmena breaks.
60+
# ----------------------------------------------------------------------
61+
62+
# The itx server hosting most of my homelab
3163
nixosConfigurations.alfa = nixpkgs.lib.nixosSystem {
3264
specialArgs = { inherit inputs; };
33-
modules = [ ./hosts/s-alfa/default.nix ];
65+
modules = [ ./hosts/itxserver/configuration.nix ];
3466
};
3567
};
3668
}

hosts/itxserver/configuration.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ in
3030
../../modules/containers/homeassistant.nix
3131
../../modules/containers/plex.nix
3232
../../modules/containers/freshrss.nix
33-
../../modules/other/minecraft-server.nix
3433
# Any other modules:
3534
inputs.sops-nix.nixosModules.sops
3635
];

0 commit comments

Comments
 (0)