blob: 3f9bc116780adfde45b32aaf96637e8c5c341048 (
plain)
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
|
{ config, lib, pkgs, ... }: let
cfg = {
enable = config.services.xserver.enable && config.tv.Xresources != {};
user = config.krebs.build.user;
};
local.types.Xresources = lib.types.attrsOf lib.types.str;
mapAttrNames = f: lib.mapAttrs' (name: lib.nameValuePair (f name));
mapAttrValues = f: lib.mapAttrs (_: f);
in {
options.tv.Xresources = lib.mkOption {
default = {};
type = lib.types.attrsOf lib.types.str;
};
config = {
nixpkgs.overlays = lib.singleton (self: super: {
tv = super.tv or {} // {
Xresources =
self.writeText "Xresources"
(lib.concatStrings
(lib.mapAttrsToList
(name: value: /* xdefaults */ ''
${name}: ${value}
'')
config.tv.Xresources));
};
});
systemd.services.${if cfg.enable then "Xresources" else null} = {
wantedBy = [ "graphical.target" ];
after = [ "xmonad.service" ];
environment = {
DISPLAY = ":${toString config.services.xserver.display}";
};
serviceConfig = {
ExecStart = "${pkgs.xorg.xrdb}/bin/xrdb ${pkgs.tv.Xresources}";
RemainAfterExit = true;
SyslogIdentifier = "Xresources";
Type = "oneshot";
User = cfg.user.name;
WorkingDirectory = cfg.user.home;
};
};
};
}
|