summaryrefslogtreecommitdiffstats
path: root/tv/3modules/Xresources.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2019-05-10 21:02:33 +0200
committermakefu <github@syntax-fehler.de>2019-05-10 21:02:33 +0200
commit45f2d6af58967d42dc0cd6b11daacb7878b300a8 (patch)
treeeb2ea5c218c3613168226cb8bf4b095fb2aac074 /tv/3modules/Xresources.nix
parentc07c0412418e3979e609fd5200a34dd1830e9334 (diff)
parent222160fc3a195415e859048bdef21f703154b3ee (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'tv/3modules/Xresources.nix')
-rw-r--r--tv/3modules/Xresources.nix39
1 files changed, 39 insertions, 0 deletions
diff --git a/tv/3modules/Xresources.nix b/tv/3modules/Xresources.nix
new file mode 100644
index 000000000..983b8bc2e
--- /dev/null
+++ b/tv/3modules/Xresources.nix
@@ -0,0 +1,39 @@
+with import <stockholm/lib>;
+{ config, pkgs, ... }: let
+ cfg = {
+ enable = config.tv.Xresources != {};
+ user = config.krebs.build.user;
+ };
+in {
+ options.tv.Xresources = mkOption {
+ default = {};
+ type = types.attrsOf types.str;
+ };
+ config = {
+ nixpkgs.overlays = singleton (self: super: {
+ tv = super.tv or {} // {
+ Xresources =
+ self.writeText "Xresources"
+ (concatStrings (mapAttrsToList (name: value: /* xdefaults */ ''
+ ${name}: ${value}
+ '') config.tv.Xresources));
+ };
+ });
+ systemd.services.${if cfg.enable then "Xresources" else null} = {
+ wantedBy = [ "graphical.target" ];
+ after = [ "xserver.service" ];
+ requires = [ "xserver.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;
+ };
+ };
+ };
+}