nixfiles/hosts/hetzner-arm/containers/vault/default.nix

70 lines
1.5 KiB
Nix
Raw Normal View History

2024-05-24 18:58:21 +01:00
{
self,
hostPath,
tree,
inputs,
config,
pkgs,
...
}: let
containerAddresses = import "${hostPath}/data/containerAddresses.nix";
hostIP = containerAddresses.host;
containerIP = containerAddresses.containers.vault;
2024-05-24 18:58:21 +01:00
in {
containers.vault = {
2024-05-24 18:58:21 +01:00
autoStart = true;
privateNetwork = true;
hostAddress = hostIP;
localAddress = containerIP;
2024-05-24 20:26:51 +01:00
additionalCapabilities = ["CAP_IPC_LOCK"];
2024-05-24 18:58:21 +01:00
specialArgs = {
inherit inputs;
inherit tree;
inherit self;
inherit hostPath;
};
config = {...}: {
nixpkgs.pkgs = pkgs;
imports = with tree;
[
presets.nixos.containerBase
./secrets.nix
]
++ (with hosts.hetzner-arm.containers.vault.profiles; [
2024-05-24 18:58:21 +01:00
vault
#internalCA
restic
]);
networking.firewall.allowedTCPPorts = [8200 8443];
home-manager.users.root.home.stateVersion = "24.05";
system.stateVersion = "24.05";
2024-05-24 18:58:21 +01:00
};
};
services.nginx.virtualHosts."vault.owo.monster" = {
forceSSL = true;
enableACME = true;
locations = {
"/".proxyPass = "http://${containerIP}:8200";
};
};
# TODO: redo this
#security.acme.certs."vault.genderfucked.monster" = {
# server = "https://internal-ca.genderfucked.monster:8443/acme/acme/directory";
#};
#services.nginx.virtualHosts."vault.genderfucked.monster" = {
# forceSSL = true;
# enableACME = true;
# locations = {
# "/".proxyPass = "http://${containerIP}:8200";
# };
#};
}