-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
181 lines (168 loc) · 5.34 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
{
description = "aurlila's full system configurations using Lix, NixOS, and HM";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
inputs.darwin.follows = "";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
nixgl = {
url = "github:guibou/nixGL";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
nixos-dns = {
url = "github:Janik-Haag/nixos-dns";
inputs.nixpkgs.follows = "nixpkgs";
};
catppuccin.url = "github:catppuccin/nix";
};
outputs =
inputs@{
self,
home-manager,
nixpkgs,
nixpkgs-unstable,
agenix,
disko,
nixgl,
nixos-dns,
catppuccin,
...
}:
let
hostSystem = "x86_64-linux";
nixpkgsHost = import nixpkgs-unstable { system = hostSystem; };
forAllSystems = nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
];
nixos-imports = {
imports = [
home-manager.nixosModules.home-manager
agenix.nixosModules.default
disko.nixosModules.disko
catppuccin.nixosModules.catppuccin
nixos-dns.nixosModules.dns
./nixos
];
_module.args = {
pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; };
catppuccin-hm = catppuccin.homeManagerModules.catppuccin;
nixgl = nixgl.packages.x86_64-linux;
};
};
in
{
devShells.${hostSystem}.default = nixpkgsHost.mkShell {
buildInputs = [
nixpkgsHost.colmena
agenix.packages.${hostSystem}.default
nixpkgsHost.nixfmt-rfc-style
(nixpkgsHost.octodns.withProviders (
ps:
with nixpkgsHost;
with python3Packages;
[
octodns-providers.bind
(buildPythonPackage rec {
pname = "octodns-gcore";
version = "0.0.5-unstable";
pyproject = true;
src = fetchFromGitHub {
owner = "octodns";
repo = "octodns-gcore";
rev = "84ce0854a9a27cee9a00cae62049c402eb47c719";
hash = "sha256-v+NLsBSoTRUB35sxeF824v6uOcWK8/pCZTc9k3NH50A=";
};
nativeBuildInputs = [ setuptools ];
propagatedBuildInputs = [
octodns
requests
];
pythonImportsCheck = [ "octodns_gcore" ];
nativeCheckInputs = [
pytestCheckHook
requests-mock
];
meta = with lib; {
description = "GCore DNS provider for octoDNS";
homepage = "https://github.com/octodns/octodns-gcore/";
changelog = "https://github.com/octodns/octodns-gcore/blob/${src.rev}/CHANGELOG.md";
license = licenses.mit;
};
})
]
))
];
};
colmena =
(builtins.mapAttrs (name: host: {
deployment.tags = host.tags;
imports = [ ./hosts/${host.config or name} ];
}) (import ./meta.nix).nodes)
// {
meta.nixpkgs = import nixpkgs { system = "x86_64-linux"; };
defaults = nixos-imports // {
deployment = {
buildOnTarget = true;
allowLocalDeployment = true;
};
};
};
packages = forAllSystems (
system:
let
generate = nixos-dns.utils.generate nixpkgs.legacyPackages.${system};
dnsConfig = {
nixosConfigurations = (
builtins.mapAttrs (
name: host:
nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
{
_module.args.name = name;
feline.dns.enable = true;
}
nixos-imports
./hosts/${host.config or name}
];
}
) (import ./meta.nix).nodes
);
extraConfig = import ./dns.nix;
};
in
{
zoneFiles = generate.zoneFiles dnsConfig;
octodns = generate.octodnsConfig {
inherit dnsConfig;
config.providers = {
gcore = {
class = "octodns_gcore.GCoreProvider";
token = "env/GCORE_TOKEN";
};
config.check_origin = false;
};
zones = {
"kitten.works." = inputs.nixos-dns.utils.octodns.generateZoneAttrs [ "gcore" ];
"feline.works." = inputs.nixos-dns.utils.octodns.generateZoneAttrs [ "gcore" ];
"theria.nl." = inputs.nixos-dns.utils.octodns.generateZoneAttrs [ "gcore" ];
"ehir.art." = inputs.nixos-dns.utils.octodns.generateZoneAttrs [ "gcore" ];
};
};
}
);
};
}