mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
project-wide: Working DNS setup + referencing tf.nix from hostConfig
This commit is contained in:
parent
92c12dd991
commit
2eb84e4654
6 changed files with 43 additions and 9 deletions
|
|
@ -7,7 +7,7 @@ rec {
|
||||||
defaultFile = "nixos.nix";
|
defaultFile = "nixos.nix";
|
||||||
};
|
};
|
||||||
|
|
||||||
hosts = import ./lib/hosts.nix { inherit pkgs sources witch profiles; };
|
hosts = import ./lib/hosts.nix { inherit pkgs sources witch profiles; inherit (deploy) tf; };
|
||||||
|
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,10 @@ let
|
||||||
tfEval ({ config, ... }: {
|
tfEval ({ config, ... }: {
|
||||||
imports =
|
imports =
|
||||||
mapAttrsToList (name: host: import (../hosts + "/${name}/meta.nix"))
|
mapAttrsToList (name: host: import (../hosts + "/${name}/meta.nix"))
|
||||||
hosts;
|
hosts ++ [{ config = mkMerge (mapAttrsToList (_: host: mapAttrs (_: mkMerge) host.config.deploy.tf.out.set) hosts); }];
|
||||||
|
|
||||||
deps = {
|
deps = {
|
||||||
|
select.allProviders = true;
|
||||||
enable = true;
|
enable = true;
|
||||||
select.hclPaths =
|
select.hclPaths =
|
||||||
(map (name: config.resources."${name}_system_switch".out.hclPathStr)
|
(map (name: config.resources."${name}_system_switch".out.hclPathStr)
|
||||||
|
|
@ -62,11 +63,13 @@ let
|
||||||
value.shellCommand = "bitw get infra/rfc2136 -f password";
|
value.shellCommand = "bitw get infra/rfc2136 -f password";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dns.zones."kittywit.ch." = { provider = "dns"; };
|
||||||
|
|
||||||
providers.hcloud = { inputs.token = config.variables.hcloud_token.ref; };
|
providers.hcloud = { inputs.token = config.variables.hcloud_token.ref; };
|
||||||
|
|
||||||
providers.dns = {
|
providers.dns = {
|
||||||
inputs.update = {
|
inputs.update = {
|
||||||
server = "45.129.95.255";
|
server = "ns1.as207960.net";
|
||||||
key_name = config.variables.glauca_key.ref;
|
key_name = config.variables.glauca_key.ref;
|
||||||
key_secret = config.variables.glauca_secret.ref;
|
key_secret = config.variables.glauca_secret.ref;
|
||||||
key_algorithm = "hmac-sha512";
|
key_algorithm = "hmac-sha512";
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
{ pkgs, hostsDir ? ../hosts, profiles, pkgsPath ? ../pkgs, sources ? { }
|
{ pkgs, tf, hostsDir ? ../hosts, profiles, pkgsPath ? ../pkgs, sources ? { }
|
||||||
, witch ? { } }:
|
, witch ? { } }:
|
||||||
|
|
||||||
with pkgs.lib;
|
with pkgs.lib;
|
||||||
|
|
@ -27,7 +27,7 @@ rec {
|
||||||
else
|
else
|
||||||
{ })
|
{ })
|
||||||
];
|
];
|
||||||
specialArgs = { inherit sources profiles witch hostName; };
|
specialArgs = { inherit sources tf profiles witch hostName; };
|
||||||
})) hostNames);
|
})) hostNames);
|
||||||
|
|
||||||
groupNames = unique (concatLists
|
groupNames = unique (concatLists
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./deploy
|
./deploy
|
||||||
|
./tf-glue
|
||||||
(sources.tf-nix + "/modules/nixos/secrets.nix")
|
(sources.tf-nix + "/modules/nixos/secrets.nix")
|
||||||
(sources.tf-nix + "/modules/nixos/secrets-users.nix")
|
(sources.tf-nix + "/modules/nixos/secrets-users.nix")
|
||||||
];
|
];
|
||||||
|
|
|
||||||
30
modules/nixos/tf-glue/default.nix
Normal file
30
modules/nixos/tf-glue/default.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
{ config, lib, ... }: with lib; let
|
||||||
|
cfg = config.deploy.tf;
|
||||||
|
unmergedValues = types.mkOptionType {
|
||||||
|
name = "unmergedValues";
|
||||||
|
merge = loc: defs: map (def: def.value) defs;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.deploy.tf = mkOption {
|
||||||
|
type = types.submodule {
|
||||||
|
freeformType = types.attrsOf unmergedValues;
|
||||||
|
|
||||||
|
options = {
|
||||||
|
attrs = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
|
out.set = mkOption {
|
||||||
|
type = types.unspecified;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
deploy.tf = {
|
||||||
|
attrs = [ "out" "attrs" ];
|
||||||
|
out.set = removeAttrs cfg cfg.attrs;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -124,10 +124,10 @@
|
||||||
"homepage": null,
|
"homepage": null,
|
||||||
"owner": "arcnmx",
|
"owner": "arcnmx",
|
||||||
"repo": "tf-nix",
|
"repo": "tf-nix",
|
||||||
"rev": "f8388c58aa7759dede5163a011fb1a08e7c27fc8",
|
"rev": "f4fe8c91d7048340ac5ff018c70736db4e92ce25",
|
||||||
"sha256": "0n0cp2hz00naz78dxi3b7ayrjv4l0001sc1k08w01aw2p400wpyc",
|
"sha256": "1qjpj0xwwxhc2qj8ciscqz60x7wgsaw72zza61hckh0qc9xdwx6w",
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://github.com/arcnmx/tf-nix/archive/f8388c58aa7759dede5163a011fb1a08e7c27fc8.tar.gz",
|
"url": "https://github.com/arcnmx/tf-nix/archive/f4fe8c91d7048340ac5ff018c70736db4e92ce25.tar.gz",
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue