From 040b71b356f1780dfc59809ccbb48169af8ddf96 Mon Sep 17 00:00:00 2001 From: clerie Date: Sun, 10 Jan 2021 22:26:57 +0100 Subject: [PATCH] Fix small syntax issues and describe options --- modules/gre-tunnel/default.nix | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) 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); }; }