Fix small syntax issues and describe options
This commit is contained in:
parent
337f5824f0
commit
040b71b356
@ -1,11 +1,11 @@
|
|||||||
{ config, lib, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.clerie.gre-tunnel;
|
cfg = config.clerie.gre-tunnel;
|
||||||
|
|
||||||
generateInterfaceUnit = isIPv6: name: tunnel:
|
generateInterfaceUnit = isIPv6: (name: tunnel:
|
||||||
nameValuePair "gre-tunnel-${name}" {
|
nameValuePair "gre-tunnel-${name}" {
|
||||||
description = "GRE Tunnel - ${name}";
|
description = "GRE Tunnel - ${name}";
|
||||||
requires = [ "network-online.target" ];
|
requires = [ "network-online.target" ];
|
||||||
@ -32,30 +32,36 @@ let
|
|||||||
ip tunnel del ${name}
|
ip tunnel del ${name}
|
||||||
${tunnel.postShutdown}
|
${tunnel.postShutdown}
|
||||||
'';
|
'';
|
||||||
};
|
});
|
||||||
|
|
||||||
checkOpts = { config, ... }@moduleAttrs: {
|
checkOpts = { config, ... }@moduleAttrs: {
|
||||||
options = {
|
options = {
|
||||||
remote = mkOption {
|
remote = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
|
description = "Address of reciever.";
|
||||||
};
|
};
|
||||||
local = mkOption {
|
local = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
|
description = "Address our packets originate from.";
|
||||||
};
|
};
|
||||||
address = mkOption {
|
address = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
|
description = "Our address in this tunnel.";
|
||||||
};
|
};
|
||||||
preSetup = mkOption {
|
preSetup = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "";
|
default = "";
|
||||||
|
description = "Commands called at the start of the interface setup.";
|
||||||
};
|
};
|
||||||
postSetup = mkOption {
|
postSetup = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "";
|
default = "";
|
||||||
|
description = "Commands called at the end of the interface setup.";
|
||||||
};
|
};
|
||||||
postShutdown = mkOption {
|
postShutdown = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "";
|
default = "";
|
||||||
|
description = "Commands called after shutting down the interface.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -77,7 +83,7 @@ in {
|
|||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
systemd.services =
|
systemd.services =
|
||||||
(mapAttrsToList (generateInterfaceUnit false) cfg.ipv4)
|
(mapAttrs' (generateInterfaceUnit false) cfg.ipv4)
|
||||||
++ (mapAttrsToList (generateInterfaceUnit true) cfg.ipv6);
|
// (mapAttrs' (generateInterfaceUnit true) cfg.ipv6);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user