summaryrefslogtreecommitdiffstats
path: root/tv/3modules
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-04-24 23:44:37 +0200
committertv <tv@krebsco.de>2019-04-24 23:44:37 +0200
commitf775d3a7e643d8432b867632c10e000d40b051c7 (patch)
tree40a5c67fc9a214b51dac4e98fb00d51c1a562430 /tv/3modules
parentc195713bc283d2a378f4c5c23d57df9d222add48 (diff)
tv: add Xresources module
Diffstat (limited to 'tv/3modules')
-rw-r--r--tv/3modules/Xresources.nix39
-rw-r--r--tv/3modules/default.nix1
2 files changed, 40 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;
+ };
+ };
+ };
+}
diff --git a/tv/3modules/default.nix b/tv/3modules/default.nix
index 67fb3f650..edaf50f03 100644
--- a/tv/3modules/default.nix
+++ b/tv/3modules/default.nix
@@ -7,5 +7,6 @@
./iptables.nix
./slock.nix
./x0vncserver.nix
+ ./Xresources.nix
];
}