From 8e9c9f87befd14d6a85e755d88171f295f39e7c4 Mon Sep 17 00:00:00 2001 From: clerie Date: Thu, 14 Mar 2024 20:15:08 +0100 Subject: [PATCH] modules/gre-tunnel: remove module --- modules/default.nix | 1 - modules/gre-tunnel/default.nix | 89 ---------------------------------- 2 files changed, 90 deletions(-) delete mode 100644 modules/gre-tunnel/default.nix diff --git a/modules/default.nix b/modules/default.nix index 846bfdf..5a4a258 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -7,7 +7,6 @@ ./backup ./clerie-firewall ./clerie-gc-dir - ./gre-tunnel ./minecraft-server ./monitoring ./nginx-port-forward diff --git a/modules/gre-tunnel/default.nix b/modules/gre-tunnel/default.nix deleted file mode 100644 index 8e6bc90..0000000 --- a/modules/gre-tunnel/default.nix +++ /dev/null @@ -1,89 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - cfg = config.clerie.gre-tunnel; - - generateInterfaceUnit = isIPv6: (name: tunnel: - nameValuePair "gre-tunnel-${name}" { - description = "GRE Tunnel - ${name}"; - requires = [ "network-online.target" ]; - after = [ "network.target" "network-online.target" ]; - wantedBy = [ "multi-user.target" ]; - environment.DEVICE = name; - path = with pkgs; [ iproute ]; - - serviceConfig = { - Type = "oneshot"; - RemainAfterExit = true; - }; - - script = '' - ${tunnel.preSetup} - ip${optionalString isIPv6 " -6"} tunnel add ${name} mode ${optionalString isIPv6 "ip6"}gre remote ${tunnel.remote} local ${tunnel.local} - ip link set ${name} up - ip${optionalString isIPv6 " -6"} a add ${tunnel.address} dev ${name} - ${tunnel.postSetup} - ''; - - postStop = '' - ip link set ${name} down - 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."; - }; - }; - }; - -in { - options = { - clerie.gre-tunnel = { - enable = mkEnableOption "Declarative Policy-Routing"; - ipv6 = mkOption { - type = with types; attrsOf (submodule checkOpts); - default = {}; - }; - ipv4 = mkOption { - type = with types; attrsOf (submodule checkOpts); - default = {}; - }; - }; - }; - - config = mkIf cfg.enable { - systemd.services = - (mapAttrs' (generateInterfaceUnit false) cfg.ipv4) - // (mapAttrs' (generateInterfaceUnit true) cfg.ipv6); - }; -}