diff options
author | Martin Weinelt <hexa@darmstadt.ccc.de> | 2021-05-31 03:21:51 +0200 |
---|---|---|
committer | Martin Weinelt <hexa@darmstadt.ccc.de> | 2021-06-16 00:19:35 +0200 |
commit | 60c62214f5a3c7db6aa30d8a8e02c863b6abcf0a (patch) | |
tree | b42c0b054ed694ee2193b110a3cb61580cedb337 /nixos/modules/services | |
parent | ff06400b7d8d633f0576b2b192039308f5755079 (diff) | |
download | nixpkgs-60c62214f5a3c7db6aa30d8a8e02c863b6abcf0a.tar nixpkgs-60c62214f5a3c7db6aa30d8a8e02c863b6abcf0a.tar.gz nixpkgs-60c62214f5a3c7db6aa30d8a8e02c863b6abcf0a.tar.bz2 nixpkgs-60c62214f5a3c7db6aa30d8a8e02c863b6abcf0a.tar.lz nixpkgs-60c62214f5a3c7db6aa30d8a8e02c863b6abcf0a.tar.xz nixpkgs-60c62214f5a3c7db6aa30d8a8e02c863b6abcf0a.tar.zst nixpkgs-60c62214f5a3c7db6aa30d8a8e02c863b6abcf0a.zip |
nixos/solanum: implement reload and allow config changes
Reload only works with a static configuration path as there is no way to pass the dynamically generated config path to a running solanum instance, therefore we symlink the configuration to /etc/solanum/ircd.conf. But that will prevent reloads of the ircd, because the systemd unit wouldn't change when the configuration changes. That is why we add the actual location of the config file to restartTriggers and enable reloadIfChanged, so changes will not restart, but reload on changes.
Diffstat (limited to 'nixos/modules/services')
-rw-r--r-- | nixos/modules/services/networking/solanum.nix | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/nixos/modules/services/networking/solanum.nix b/nixos/modules/services/networking/solanum.nix index b6496fb8b35..dc066a24549 100644 --- a/nixos/modules/services/networking/solanum.nix +++ b/nixos/modules/services/networking/solanum.nix @@ -2,7 +2,7 @@ let inherit (lib) mkEnableOption mkIf mkOption types; - inherit (pkgs) solanum; + inherit (pkgs) solanum util-linux; cfg = config.services.solanum; configFile = pkgs.writeText "solanum.conf" cfg.config; @@ -78,12 +78,20 @@ in config = mkIf cfg.enable (lib.mkMerge [ { + + environment.etc."solanum/ircd.conf".source = configFile; + systemd.services.solanum = { description = "Solanum IRC daemon"; after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; + reloadIfChanged = true; + restartTriggers = [ + configFile + ]; serviceConfig = { - ExecStart = "${solanum}/bin/solanum -foreground -logfile /dev/stdout -configfile ${configFile} -pidfile /run/solanum/ircd.pid"; + ExecStart = "${solanum}/bin/solanum -foreground -logfile /dev/stdout -configfile /etc/solanum/ircd.conf -pidfile /run/solanum/ircd.pid"; + ExecReload = "${util-linux}/bin/kill -HUP $MAINPID"; DynamicUser = true; User = "solanum"; StateDirectory = "solanum"; |