From 29e5846dca31431a576f864146666c880021a34a Mon Sep 17 00:00:00 2001 From: xvrqt Date: Tue, 2 Sep 2025 13:21:34 -0700 Subject: [PATCH] Added globalExtraConfig option to the NixOS Module Added in an option, 'services.copyparty.globalExtraConfig', with default value and description to the NixOS Module. The option type is 'str' and the default value is the empty string. This string is appened verbatim to the [global] section of the config. This allows the use of settings which rely on repeated values to be correctly used. For example, the: 'ipu: 255.255.255.1/32=user' key which allows automatic sign in for users of a CIDR subnet. Because attribute sets in Nix must have unique keys, it is not possible to set more than one CIDR subnet/user pair. 'extraConfig' options are common in many Nix modules, providing a simple and familiar configuration which is also flexible for future options. --- contrib/nixos/modules/copyparty.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/contrib/nixos/modules/copyparty.nix b/contrib/nixos/modules/copyparty.nix index 994b2575..a125b685 100644 --- a/contrib/nixos/modules/copyparty.nix +++ b/contrib/nixos/modules/copyparty.nix @@ -50,6 +50,7 @@ let configStr = '' ${mkSection "global" cfg.settings} + ${cfg.globalExtraConfig} ${mkSection "accounts" (accountsWithPlaceholders cfg.accounts)} ${concatStringsSep "\n" (mapAttrsToList mkVolume cfg.volumes)} ''; @@ -131,6 +132,12 @@ in ''; }; + globalExtraConfig = mkOption { + type = types.str; + default = ""; + description = "Appened to the end of the [global] section verbatim. This is useful for flags which are used in a repeating manner (e.g. ipu: 255.255.255.1=user) which can't be repeated in the settings = {} attribute set."; + }; + accounts = mkOption { type = types.attrsOf ( types.submodule ( @@ -373,3 +380,4 @@ in } ); } +