add crypto
This commit is contained in:
parent
90cbe489f6
commit
af6a3bce3e
120 changed files with 24616 additions and 462 deletions
50
modules/nixos/services/wg-container/default.nix
Normal file
50
modules/nixos/services/wg-container/default.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with lib.custom; let
|
||||
cfg = config.services.wg-container;
|
||||
in {
|
||||
options.services.wg-container = with types; {
|
||||
enable = mkBoolOpt false "Enable Wireguard Container";
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
sops = {
|
||||
defaultSopsFile = ../../../.sops.yaml;
|
||||
gnupg.home = "/var/lib/sops";
|
||||
gnupg.sshKeyPaths = [];
|
||||
|
||||
secrets = {
|
||||
"vpn_config_file" = {
|
||||
sopsFile = ../../../../secrets/vpn-config.yaml;
|
||||
owner = "root";
|
||||
group = "root";
|
||||
mode = "0400";
|
||||
neededForUsers = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
vpnNamespaces.wg = {
|
||||
enable = true;
|
||||
wireguardConfigFile = config.sops.secrets.vpn_config_file.path;
|
||||
accessibleFrom = [
|
||||
"192.168.0.0/24"
|
||||
];
|
||||
portMappings = [
|
||||
{
|
||||
from = 18081;
|
||||
to = 18081;
|
||||
protocol = "both";
|
||||
}
|
||||
{
|
||||
from = 9091;
|
||||
to = 9091;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue