2017-01-12 01:01:15 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.xresources;
|
|
|
|
|
|
|
|
formatLine = n: v:
|
|
|
|
let
|
|
|
|
v' =
|
|
|
|
if isBool v then (if v then "true" else "false")
|
|
|
|
else toString v;
|
|
|
|
in
|
|
|
|
"${n}: ${v'}";
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
2017-09-26 23:40:31 +02:00
|
|
|
meta.maintainers = [ maintainers.rycee ];
|
|
|
|
|
2017-01-12 01:01:15 +01:00
|
|
|
options = {
|
|
|
|
xresources.properties = mkOption {
|
|
|
|
type = types.nullOr types.attrs;
|
|
|
|
default = null;
|
2017-01-15 20:03:55 +01:00
|
|
|
example = {
|
|
|
|
"XTerm*faceName" = "dejavu sans mono";
|
|
|
|
"Emacs*toolBar" = 0;
|
|
|
|
};
|
2017-01-12 01:01:15 +01:00
|
|
|
description = ''
|
2018-03-25 14:59:05 +02:00
|
|
|
X server resources that should be set.
|
|
|
|
If this and all other xresources options are
|
|
|
|
<code>null</code>, then this feature is disabled and no
|
|
|
|
<filename>~/.Xresources</filename> link is produced.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
xresources.extraConfig = mkOption {
|
|
|
|
type = types.lines;
|
|
|
|
default = "";
|
|
|
|
example = literalExample ''
|
|
|
|
builtins.readFile (
|
|
|
|
pkgs.fetchFromGitHub {
|
|
|
|
owner = "solarized";
|
|
|
|
repo = "xresources";
|
|
|
|
rev = "025ceddbddf55f2eb4ab40b05889148aab9699fc";
|
|
|
|
sha256 = "0lxv37gmh38y9d3l8nbnsm1mskcv10g3i83j0kac0a2qmypv1k9f";
|
|
|
|
} + "/Xresources.dark"
|
|
|
|
)
|
|
|
|
'';
|
|
|
|
description = ''
|
|
|
|
Additional X server resources contents.
|
|
|
|
If this and all other xresources options are
|
|
|
|
<code>null</code>, then this feature is disabled and no
|
2017-01-15 20:03:55 +01:00
|
|
|
<filename>~/.Xresources</filename> link is produced.
|
2017-01-12 01:01:15 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-03-25 14:59:05 +02:00
|
|
|
config = mkIf (cfg.properties != null || cfg.extraConfig != "") {
|
2017-01-12 01:01:15 +01:00
|
|
|
home.file.".Xresources".text =
|
2018-03-25 14:59:05 +02:00
|
|
|
concatStringsSep "\n" ([]
|
|
|
|
++ (optional (cfg.extraConfig != "") cfg.extraConfig)
|
|
|
|
++ (optionals (cfg.properties != null) (mapAttrsToList formatLine cfg.properties))
|
2017-01-13 01:12:26 +01:00
|
|
|
) + "\n";
|
2017-01-12 01:01:15 +01:00
|
|
|
};
|
|
|
|
}
|