-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
99 lines (89 loc) · 2.86 KB
/
Copy pathflake.nix
File metadata and controls
99 lines (89 loc) · 2.86 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
99
{
description = "2140.dev fleet — host configurations consuming roost";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs";
roost.url = "github:2140-dev/roost";
roost.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{
self,
nixpkgs,
disko,
agenix,
roost,
}:
let
# Per-host extras let us scope opinionated modules (roost's
# batteries-included default) to the host that actually uses them,
# rather than carrying their assertions on every host.
mkHost =
name: extraModules:
nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
# `self` is threaded through so common.nix can stamp the host's
# system.configurationRevision with the flake's git rev. Powers
# `nixos-version --configuration-revision` on the deployed box.
specialArgs = { inherit self; };
modules = [
disko.nixosModules.disko
agenix.nixosModules.default
roost.nixosModules.hetzner-bare-metal
./modules/common.nix
./hosts/${name}
]
++ extraModules;
};
forAllSystems = nixpkgs.lib.genAttrs [
"aarch64-darwin"
"x86_64-linux"
];
forAllLinux = nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
];
in
{
nixosConfigurations = {
finney = mkHost "finney" [
roost.nixosModules.bitcoind-backend-host
roost.nixosModules.wireguard-mesh
];
kingfisher = mkHost "kingfisher" [
roost.nixosModules.default
roost.nixosModules.wireguard-mesh
];
albatross = mkHost "albatross" [
roost.nixosModules.frigate-edge
roost.nixosModules.wireguard-mesh
];
};
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-tree);
devShells = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = pkgs.mkShell {
packages = [
pkgs.nixos-rebuild
pkgs.nixos-anywhere
agenix.packages.${system}.default
];
};
}
);
# Build every host's toplevel as a flake check. Surfaces eval errors
# and module-composition mistakes; runs natively wherever invoked.
checks = forAllLinux (system: {
finney = self.nixosConfigurations.finney.config.system.build.toplevel;
kingfisher = self.nixosConfigurations.kingfisher.config.system.build.toplevel;
albatross = self.nixosConfigurations.albatross.config.system.build.toplevel;
});
};
}