about summary refs log tree commit diff
path: root/nixos/modules/services/x11/urxvtd.nix
blob: 57ad93f20174f6bfe4ef5ab45ba2d37355c7027d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{ config, lib, pkgs, ... }:

# maintainer: siddharthist

with lib;

let
  cfg = config.services.urxvtd;
in {

  options.services.urxvtd.enable = mkOption {
    type = types.bool;
    default = false;
    description = ''
      Enable urxvtd, the urxvt terminal daemon. To use urxvtd, run
      "urxvtc".
    '';
  };

  config = mkIf cfg.enable {
    systemd.user = {
      sockets.urxvtd = {
        description = "socket for urxvtd, the urxvt terminal daemon";
        after = [ "graphical.target" ];
        wants = [ "graphical.target" ];
        wantedBy = [ "sockets.target" ];
        socketConfig = {
          ListenStream = "%t/urxvtd-socket";
        };
      };

      services.urxvtd = {
        description = "urxvt terminal daemon";
        path = [ pkgs.xsel ];
        serviceConfig = {
          ExecStart = "${pkgs.rxvt_unicode-with-plugins}/bin/urxvtd -o";
          Environment = "RXVT_SOCKET=%t/urxvtd-socket";
          Restart = "on-failure";
          RestartSec = "5s";
        };
      };

    };

    environment.systemPackages = [ pkgs.rxvt_unicode-with-plugins ];
    environment.variables.RXVT_SOCKET = "/run/user/$(id -u)/urxvtd-socket";
  };

}