-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathflake.nix
More file actions
98 lines (83 loc) · 3.12 KB
/
flake.nix
File metadata and controls
98 lines (83 loc) · 3.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{
# ============================================================================
# FLAKE INPUTS - External dependencies and packages
# ============================================================================
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
colmena.url = "github:zhaofengli/colmena";
};
# ============================================================================
# FLAKE OUTPUTS - What this flake provides
# ============================================================================
outputs =
{ nixpkgs, colmena, ... }:
let
# Import host definitions from single source of truth
hosts = import ./hosts.nix;
# For scaling up your homelab, you'd likely want automated host generation:
# mkHost = name: hostConfig: {
# deployment = {
# targetHost = hostConfig.ip;
# targetUser = hostConfig.user;
# tags = hostConfig.tags;
# };
# imports = [ ./hosts/${name}/configuration.nix ];
# };
# hostConfigs = builtins.mapAttrs mkHost hosts;
in
{
# ==========================================================================
# DEVELOPMENT SHELL - Local development environment
# ==========================================================================
devShells.x86_64-linux.default = nixpkgs.legacyPackages.x86_64-linux.mkShell {
buildInputs = [ colmena.packages.x86_64-linux.colmena ];
};
# ==========================================================================
# COLMENA HIVE - Fleet deployment configuration
# ==========================================================================
colmenaHive = colmena.lib.makeHive {
# ========================================================================
# GLOBAL CONFIGURATION - Settings applied to all hosts
# ========================================================================
meta = {
nixpkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [ ];
};
};
# ========================================================================
# HOST DEFINITIONS - Individual server configurations
# ========================================================================
alpha = {
deployment = {
targetHost = hosts.alpha.ip;
targetUser = hosts.alpha.user;
tags = hosts.alpha.tags;
};
imports = [
./hosts/alpha/configuration.nix
];
};
bravo = {
deployment = {
targetHost = hosts.bravo.ip;
targetUser = hosts.bravo.user;
tags = hosts.bravo.tags;
};
imports = [
./hosts/bravo/configuration.nix
];
};
charlie = {
deployment = {
targetHost = hosts.charlie.ip;
targetUser = hosts.charlie.user;
tags = hosts.charlie.tags;
};
imports = [
./hosts/charlie/configuration.nix
];
};
};
};
}