1{ config, lib, pkgs, ... }:
2
3# maintainer: siddharthist
4
5with lib;
6
7let
8 cfg = config.services.urxvtd;
9in {
10
11 options.services.urxvtd.enable = mkOption {
12 type = types.bool;
13 default = false;
14 description = ''
15 Enable urxvtd, the urxvt terminal daemon. To use urxvtd, run
16 "urxvtc".
17 '';
18 };
19
20 config = mkIf cfg.enable {
21 systemd.user = {
22 sockets.urxvtd = {
23 description = "socket for urxvtd, the urxvt terminal daemon";
24 wantedBy = [ "graphical-session.target" ];
25 partOf = [ "graphical-session.target" ];
26 socketConfig = {
27 ListenStream = "%t/urxvtd-socket";
28 };
29 };
30
31 services.urxvtd = {
32 description = "urxvt terminal daemon";
33 path = [ pkgs.xsel ];
34 serviceConfig = {
35 ExecStart = "${pkgs.rxvt_unicode-with-plugins}/bin/urxvtd -o";
36 Environment = "RXVT_SOCKET=%t/urxvtd-socket";
37 Restart = "on-failure";
38 RestartSec = "5s";
39 };
40 };
41
42 };
43
44 environment.systemPackages = [ pkgs.rxvt_unicode-with-plugins ];
45 environment.variables.RXVT_SOCKET = "/run/user/$(id -u)/urxvtd-socket";
46 };
47
48}