Merge pull request #299987 from r-vdp/mycelium-args

nixos/mycelium: allow specifying extra args to mycelium
This commit is contained in:
lassulus 2024-03-29 14:41:10 +01:00 committed by GitHub
commit b4a4b9e565
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 2 deletions

View File

@ -1,4 +1,4 @@
{ config, pkgs, lib, ... }:
{ config, pkgs, lib, utils, ... }:
let
cfg = config.services.mycelium;
@ -46,6 +46,15 @@ in
Adds the hosted peers from https://github.com/threefoldtech/mycelium#hosted-public-nodes.
'';
};
extraArgs = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
description = ''
Extra command-line arguments to pass to mycelium.
See `mycelium --help` for all available options.
'';
};
};
config = lib.mkIf cfg.enable {
networking.firewall.allowedTCPPorts = lib.optionals cfg.openFirewall [ 9651 ];
@ -87,6 +96,7 @@ in
)
"--tun-name"
"mycelium"
"${utils.escapeSystemdExecArgs cfg.extraArgs}"
] ++
(lib.optional (cfg.addHostedPublicNodes || cfg.peers != [ ]) "--peers")
++ cfg.peers ++ (lib.optionals cfg.addHostedPublicNodes [
@ -130,4 +140,3 @@ in
maintainers = with lib.maintainers; [ flokli lassulus ];
};
}