mirror of
https://github.com/Blah-IM/blahrs.git
synced 2025-07-13 01:15:32 +00:00
Update nix module and config examples for socket activation
This commit is contained in:
parent
348c35720b
commit
13a3b25ee8
2 changed files with 20 additions and 3 deletions
|
@ -47,6 +47,17 @@ in
|
|||
defaultText = literalMD "blahd package from its flake output";
|
||||
};
|
||||
|
||||
listen = mkOption {
|
||||
description = mdDoc ''
|
||||
The address:port or an absolute UNIX socket path to listen on.
|
||||
|
||||
If not null, it sets {option}`services.blahd.settings.listen.systemd`
|
||||
to `true`, and systemd socket activation is configured.
|
||||
'';
|
||||
type = types.nullOr types.str;
|
||||
default = "/run/blahd/blahd.sock";
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
description = ''
|
||||
blahd configuration.
|
||||
|
@ -70,14 +81,22 @@ in
|
|||
systemd.packages = [ cfg.package ];
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
systemd.sockets."blahd" = lib.mkIf (cfg.listen != null) {
|
||||
wantedBy = [ "sockets.target" ];
|
||||
listenStreams = [ cfg.listen ];
|
||||
};
|
||||
|
||||
systemd.services."blahd" = lib.mkDefault {
|
||||
overrideStrategy = "asDropin";
|
||||
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
restartIfChanged = true; # We support graceful shutdown.
|
||||
stopIfChanged = false;
|
||||
};
|
||||
|
||||
environment.etc."blahd/blahd.toml".source = cfg.settingsFile;
|
||||
|
||||
services.blahd.settings = lib.mkIf (cfg.listen != null) {
|
||||
listen.systemd = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue