From f775d3a7e643d8432b867632c10e000d40b051c7 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 24 Apr 2019 23:44:37 +0200 Subject: tv: add Xresources module --- tv/3modules/Xresources.nix | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tv/3modules/Xresources.nix (limited to 'tv/3modules/Xresources.nix') 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 ; +{ 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; + }; + }; + }; +} -- cgit v1.2.3