Created
November 28, 2020 20:19
-
-
Save srhb/b5180c51ab0742559d70bd08bbd04940 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
eval = (import <nixpkgs/lib/modules.nix> { inherit lib; }).evalModules; | |
lib = (import <nixpkgs> {}).lib; | |
module = { config, lib, ... }: | |
with lib; | |
let cfg = config.perso.vpn; | |
in { | |
options.perso.vpn = mkOption { | |
type = with types; attrsOf (submodule | |
{ | |
options = { | |
peers = mkOption { | |
default = [ { name = "Machine A"; vpnIP = "10.10.1.2"; } ]; | |
type = with types; listOf (submodule | |
{ | |
options = { | |
name = mkOption { | |
type = types.str; | |
default = "fake"; | |
}; | |
vpnIP = mkOption { | |
type = types.str; | |
description = "IP address of the node in the VPN."; | |
}; | |
}; | |
} | |
); | |
}; | |
}; | |
} | |
); | |
}; | |
}; | |
in | |
(eval { | |
modules = [ | |
module | |
{ config.perso.vpn.foo = {}; } | |
]; | |
}).config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment