mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-03 13:30:36 +00:00
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.
(cherry picked from commit 60c62214f5)
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user