Skip to content

Instantly share code, notes, and snippets.

@srhb
Created November 28, 2020 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srhb/b5180c51ab0742559d70bd08bbd04940 to your computer and use it in GitHub Desktop.
Save srhb/b5180c51ab0742559d70bd08bbd04940 to your computer and use it in GitHub Desktop.
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