From bbd123b4c98b29bd67d94ec85f8d0ebc9ff9f6fd Mon Sep 17 00:00:00 2001 From: pinpox Date: Thu, 5 Jun 2025 13:13:06 +0200 Subject: [PATCH] Add roles directory --- clanModules/localsend/default.nix | 62 +----------------------- clanModules/localsend/roles/default.nix | 63 +++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 61 deletions(-) create mode 100644 clanModules/localsend/roles/default.nix diff --git a/clanModules/localsend/default.nix b/clanModules/localsend/default.nix index b172e4df1..8fdf356eb 100644 --- a/clanModules/localsend/default.nix +++ b/clanModules/localsend/default.nix @@ -1,63 +1,3 @@ { - config, - pkgs, - lib, - ... -}: - -let - cfg = config.clan.localsend; -in -{ - # Integration can be improved, if the following issues get implemented: - # - cli frontend: https://github.com/localsend/localsend/issues/11 - # - ipv6 support: https://github.com/localsend/localsend/issues/549 - options.clan.localsend = { - - displayName = lib.mkOption { - type = lib.types.nullOr lib.types.str; - default = null; - description = "The name that localsend will use to display your instance."; - }; - - package = lib.mkPackageOption pkgs "localsend" { }; - - ipv4Addr = lib.mkOption { - type = lib.types.nullOr lib.types.str; - default = null; - example = "192.168.56.2/24"; - description = "Optional IPv4 address for ZeroTier network."; - }; - }; - - imports = [ - (lib.mkRemovedOptionModule [ - "clan" - "localsend" - "enable" - ] "Importing the module will already enable the service.") - ]; - config = { - clan.core.state.localsend.folders = [ - "/var/localsend" - ]; - environment.systemPackages = [ - (pkgs.callPackage ./localsend-ensure-config { - localsend = config.clan.localsend.package; - alias = config.clan.localsend.displayName; - }) - ]; - - networking.firewall.interfaces."zt+".allowedTCPPorts = [ 53317 ]; - networking.firewall.interfaces."zt+".allowedUDPPorts = [ 53317 ]; - - #TODO: This is currently needed because there is no ipv6 multicasting support yet - systemd.network.networks = lib.mkIf (cfg.ipv4Addr != null) { - "09-zerotier" = { - networkConfig = { - Address = cfg.ipv4Addr; - }; - }; - }; - }; + imports = [ ./roles/default.nix ]; } diff --git a/clanModules/localsend/roles/default.nix b/clanModules/localsend/roles/default.nix new file mode 100644 index 000000000..b172e4df1 --- /dev/null +++ b/clanModules/localsend/roles/default.nix @@ -0,0 +1,63 @@ +{ + config, + pkgs, + lib, + ... +}: + +let + cfg = config.clan.localsend; +in +{ + # Integration can be improved, if the following issues get implemented: + # - cli frontend: https://github.com/localsend/localsend/issues/11 + # - ipv6 support: https://github.com/localsend/localsend/issues/549 + options.clan.localsend = { + + displayName = lib.mkOption { + type = lib.types.nullOr lib.types.str; + default = null; + description = "The name that localsend will use to display your instance."; + }; + + package = lib.mkPackageOption pkgs "localsend" { }; + + ipv4Addr = lib.mkOption { + type = lib.types.nullOr lib.types.str; + default = null; + example = "192.168.56.2/24"; + description = "Optional IPv4 address for ZeroTier network."; + }; + }; + + imports = [ + (lib.mkRemovedOptionModule [ + "clan" + "localsend" + "enable" + ] "Importing the module will already enable the service.") + ]; + config = { + clan.core.state.localsend.folders = [ + "/var/localsend" + ]; + environment.systemPackages = [ + (pkgs.callPackage ./localsend-ensure-config { + localsend = config.clan.localsend.package; + alias = config.clan.localsend.displayName; + }) + ]; + + networking.firewall.interfaces."zt+".allowedTCPPorts = [ 53317 ]; + networking.firewall.interfaces."zt+".allowedUDPPorts = [ 53317 ]; + + #TODO: This is currently needed because there is no ipv6 multicasting support yet + systemd.network.networks = lib.mkIf (cfg.ipv4Addr != null) { + "09-zerotier" = { + networkConfig = { + Address = cfg.ipv4Addr; + }; + }; + }; + }; +}