diff --git a/modules/gre-tunnel/default.nix b/modules/gre-tunnel/default.nix index 5c1b6d1..7a63ac4 100644 --- a/modules/gre-tunnel/default.nix +++ b/modules/gre-tunnel/default.nix @@ -1,11 +1,11 @@ -{ config, lib, ... }: +{ config, lib, pkgs, ... }: with lib; let cfg = config.clerie.gre-tunnel; - generateInterfaceUnit = isIPv6: name: tunnel: + generateInterfaceUnit = isIPv6: (name: tunnel: nameValuePair "gre-tunnel-${name}" { description = "GRE Tunnel - ${name}"; requires = [ "network-online.target" ]; @@ -32,30 +32,36 @@ let ip tunnel del ${name} ${tunnel.postShutdown} ''; - }; + }); checkOpts = { config, ... }@moduleAttrs: { options = { remote = mkOption { type = types.str; + description = "Address of reciever."; }; local = mkOption { type = types.str; + description = "Address our packets originate from."; }; address = mkOption { type = types.str; + description = "Our address in this tunnel."; }; preSetup = mkOption { type = types.str; default = ""; + description = "Commands called at the start of the interface setup."; }; postSetup = mkOption { type = types.str; default = ""; + description = "Commands called at the end of the interface setup."; }; postShutdown = mkOption { type = types.str; default = ""; + description = "Commands called after shutting down the interface."; }; }; }; @@ -77,7 +83,7 @@ in { config = mkIf cfg.enable { systemd.services = - (mapAttrsToList (generateInterfaceUnit false) cfg.ipv4) - ++ (mapAttrsToList (generateInterfaceUnit true) cfg.ipv6); + (mapAttrs' (generateInterfaceUnit false) cfg.ipv4) + // (mapAttrs' (generateInterfaceUnit true) cfg.ipv6); }; }