mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 13:10:33 +00:00
1e95e114e5
While systemd suggests using the pre-defined graphical-session user target, I found that this interface is difficult to use. Additionally, no other major distribution, even in their unstable versions, currently use this mechanism. The window or desktop manager is supposed to run in a systemd user service which activates graphical-session.target and the user services that are binding to this target. The issue is that we can't elegantly pass the xsession environment to the window manager session, in particular whereas the PassEnvironment option does work for DISPLAY, it for some mysterious reason won't for PATH. This commit implements a new graphical user target that works just like default.target. Services which should be run in a graphical session just need to declare wantedBy graphical.target. The graphical target will be activated in the xsession before executing the window or display manager. Fixes #17858.
49 lines
1.1 KiB
Nix
49 lines
1.1 KiB
Nix
{ 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";
|
|
wantedBy = [ "graphical-session.target" ];
|
|
partOf = [ "graphical-session.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";
|
|
};
|
|
|
|
}
|