nixos-config/components/network/tinc/default.nix

38 lines
939 B
Nix
Raw Permalink Normal View History

2024-06-07 09:42:26 +02:00
{ lib, config, factsGenerator, clanLib, ... }:
2023-01-26 21:29:47 +01:00
with lib;
2022-10-13 10:51:21 +02:00
{
2023-01-26 21:29:47 +01:00
options.tinc = {
private = {
enable = mkEnableOption "private tinc setup";
ipv4 = mkOption { type = types.str; };
subnet = mkOption {
type = types.str;
default = "10.23.42.0/24";
};
};
secret = {
enable = mkEnableOption "secret tinc setup";
ipv4 = mkOption {
type = types.str;
};
};
};
2022-10-13 10:51:21 +02:00
2023-01-26 21:29:47 +01:00
config = mkMerge [
(mkIf config.tinc.private.enable (import ./private.nix {
ipv4 = config.tinc.private.ipv4;
ipv6 = null;
inherit (lib) optionalString concatStringsSep mapAttrsToList;
2024-06-07 09:42:26 +02:00
inherit config factsGenerator clanLib;
2023-01-26 21:29:47 +01:00
}))
(mkIf config.tinc.secret.enable (import ./secret.nix {
ipv4 = config.tinc.secret.ipv4;
ipv6 = null;
inherit (lib) optionalString concatStringsSep mapAttrsToList;
2024-06-07 09:42:26 +02:00
inherit config factsGenerator clanLib;
2023-01-26 21:29:47 +01:00
}))
];
2022-10-13 10:51:21 +02:00
}