-
Notifications
You must be signed in to change notification settings - Fork 3
/
flake.nix
80 lines (74 loc) · 2.13 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
{
description = "A example on how one can use nixos-dns";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixos-dns.url = "github:Janik-Haag/nixos-dns";
nixos-dns.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
inputs@{
self,
nixpkgs,
nixos-dns,
}:
let
forAllSystems = nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
];
dnsConfig = {
inherit (self) nixosConfigurations;
extraConfig = import ./dns.nix;
};
in
{
nixosConfigurations = {
host1 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
nixos-dns.nixosModules.dns
./hosts/host1.nix
];
};
host2 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
nixos-dns.nixosModules.dns
./hosts/host2.nix
];
};
};
# nix eval .#dnsDebugHost
dnsDebugHost = nixos-dns.utils.debug.host self.nixosConfigurations.host1;
# nix eval .#dnsDebugConfig
dnsDebugConfig = nixos-dns.utils.debug.config dnsConfig;
packages = forAllSystems (
system:
let
generate = nixos-dns.utils.generate nixpkgs.legacyPackages.${system};
in
{
# nix build .#zoneFiles
zoneFiles = generate.zoneFiles dnsConfig;
# nix build .#octodns
octodns = generate.octodnsConfig {
inherit dnsConfig;
config = {
providers = {
powerdns = {
class = "octodns_powerdns.PowerDnsProvider";
host = "ns.dns.invalid";
api_key = "env/POWERDNS_API_KEY";
};
};
};
zones = {
"example.com." = nixos-dns.utils.octodns.generateZoneAttrs [ "powerdns" ];
"example.org." = nixos-dns.utils.octodns.generateZoneAttrs [ "powerdns" ];
"missing.invalid." = nixos-dns.utils.octodns.generateZoneAttrs [ "powerdns" ];
};
};
}
);
};
}