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