Fix octodns setup
This commit is contained in:
parent
78198f18b2
commit
404f6c8d3e
10 changed files with 238 additions and 178 deletions
|
@ -69,7 +69,6 @@ let
|
|||
in
|
||||
# }}}
|
||||
{
|
||||
satellite.dns.domain = "moonythm.dev";
|
||||
satellite.dns.records = lib.flatten [
|
||||
(ghPage "doffycup")
|
||||
(ghPage "erratic-gate")
|
||||
|
|
61
dns/pkgs.nix
61
dns/pkgs.nix
|
@ -1,37 +1,48 @@
|
|||
{ pkgs, self, ... }: rec {
|
||||
{ pkgs, self, ... }:
|
||||
rec {
|
||||
octodns-zones =
|
||||
let
|
||||
nixosConfigModules = pkgs.lib.mapAttrsToList
|
||||
(_: current: { satellite.dns = current.config.satellite.dns; })
|
||||
self.nixosConfigurations;
|
||||
nixosConfigModules = pkgs.lib.mapAttrsToList (
|
||||
key: current:
|
||||
# The iso image doesn't do any dns stuff
|
||||
if key == "iso" then
|
||||
{ }
|
||||
else
|
||||
# Copy over all dns records
|
||||
{ satellite.dns = current.config.satellite.dns; }
|
||||
) self.nixosConfigurations;
|
||||
|
||||
evaluated = pkgs.lib.evalModules {
|
||||
specialArgs = { inherit pkgs; };
|
||||
specialArgs = {
|
||||
inherit pkgs;
|
||||
};
|
||||
modules = [
|
||||
../modules/nixos/dns.nix
|
||||
../modules/common/octodns.nix
|
||||
./common.nix
|
||||
]
|
||||
++ nixosConfigModules;
|
||||
] ++ nixosConfigModules;
|
||||
};
|
||||
in
|
||||
evaluated.config.satellite.dns.octodns;
|
||||
octodns-sync =
|
||||
pkgs.symlinkJoin {
|
||||
name = "octodns-sync";
|
||||
paths = [ self.packages.${pkgs.system}.octodns ];
|
||||
buildInputs = [ pkgs.makeWrapper pkgs.yq ];
|
||||
postBuild = ''
|
||||
cat ${./octodns.yaml} | yq '.providers.zones.directory="${octodns-zones}"' > $out/config.yaml
|
||||
wrapProgram $out/bin/octodns-sync \
|
||||
--run 'export CLOUDFLARE_TOKEN=$( \
|
||||
sops \
|
||||
--decrypt \
|
||||
--extract "[\"cloudflare_dns_api_token\"]" \
|
||||
./hosts/nixos/common/secrets.yaml \
|
||||
)' \
|
||||
--add-flags "--config-file $out/config.yaml"
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
octodns-sync = pkgs.symlinkJoin {
|
||||
name = "octodns-sync";
|
||||
paths = [ self.packages.${pkgs.system}.octodns ];
|
||||
buildInputs = [
|
||||
pkgs.makeWrapper
|
||||
pkgs.yq
|
||||
];
|
||||
|
||||
postBuild = ''
|
||||
cat ${./octodns.yaml} | yq '.providers.zones.directory="${octodns-zones}"' > $out/config.yaml
|
||||
wrapProgram $out/bin/octodns-sync \
|
||||
--run 'export CLOUDFLARE_TOKEN=$( \
|
||||
sops \
|
||||
--decrypt \
|
||||
--extract "[\"cloudflare_dns_api_token\"]" \
|
||||
./hosts/nixos/common/secrets.yaml \
|
||||
)' \
|
||||
--add-flags "--config-file $out/config.yaml"
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue