-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
90 lines (89 loc) · 2.58 KB
/
flake.nix
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
{
inputs = {
nvim.url = "github:itslychee/nvim";
colmena.url = "github:zhaofengli/colmena";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
conduwuit.url = "github:girlbossceo/conduwuit?ref=v0.4.6";
nextcloud-caddy.url = "github:onny/nixos-nextcloud-testumgebung/56a5379b83ea9c03d4d16daf27ac91e1ba6b020f";
spicetify-nix.url = "github:Gerg-L/spicetify-nix";
nextcloud-caddy.flake = false;
};
outputs =
{
flake-parts,
nixpkgs,
...
}@inputs':
let
inherit (nixpkgs.lib) flatten mkOption;
inherit (nixpkgs.lib.types)
lazyAttrsOf
raw
attrsOf
package
;
inherit (nixpkgs.lib.fileset)
toList
difference
unions
intersection
fileFilter
;
in
flake-parts.lib.mkFlake { inputs = inputs'; } {
systems = [
"x86_64-linux"
"aarch64-linux"
];
imports = flatten [
# Load flakes
(map (name: ./hosts/${name}/manifest.nix) (builtins.attrNames (builtins.readDir ./hosts)))
{
# copied from nixosConfigurations
options.flake = flake-parts.lib.mkSubmoduleOptions {
colmena = mkOption {
type = lazyAttrsOf raw;
default = { };
};
hydra = mkOption {
type = attrsOf package;
};
};
}
];
flake =
{ lib, self', ... }:
{
colmena = {
meta = {
nixpkgs = inputs'.nixpkgs.legacyPackages.x86_64-linux;
specialArgs = {
inputs = inputs';
};
};
defaults =
{
name,
config,
...
}:
{
imports = toList (
intersection (unions [
(difference ./hosts/${name} ./hosts/${name}/manifest.nix)
(difference ./modules ./modules/roles)
# role definitions
./modules/roles/roles.nix
]) (fileFilter (p: p.hasExt "nix") ./.)
);
networking.hostName = name;
users.users.root.openssh.authorizedKeys.keys = config.hey.keys.lychee.deployment;
deployment.allowLocalDeployment = true;
deployment.buildOnTarget = true;
};
};
hydra = (inputs'.colmena.lib.makeHive inputs'.self.colmena).toplevel;
};
};
}