1 { config, lib, pkgs, ... }:
6 cfg = config.services.weechat;
10 options.services.weechat = {
11 enable = mkEnableOption (lib.mdDoc "weechat");
13 description = lib.mdDoc "Weechat state directory.";
15 default = "/var/lib/weechat";
17 sessionName = mkOption {
18 description = lib.mdDoc "Name of the `screen' session for weechat.";
19 default = "weechat-screen";
24 description = lib.mdDoc "Binary to execute.";
25 default = "${pkgs.weechat}/bin/weechat";
26 defaultText = literalExpression ''"''${pkgs.weechat}/bin/weechat"'';
27 example = literalExpression ''"''${pkgs.weechat}/bin/weechat-headless"'';
31 config = mkIf cfg.enable {
42 systemd.services.weechat = {
43 environment.WEECHAT_HOME = cfg.root;
47 RemainAfterExit = "yes";
49 script = "exec ${config.security.wrapperDir}/screen -Dm -S ${cfg.sessionName} ${cfg.binary}";
50 wantedBy = [ "multi-user.target" ];
51 wants = [ "network.target" ];
54 security.wrappers.screen =
58 source = "${pkgs.screen}/bin/screen";
62 meta.doc = ./weechat.xml;