1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-14 11:57:55 +00:00

xresources: add module

This module adds basic support for configuring X resources.
This commit is contained in:
Robert Helgesson 2017-01-12 01:01:15 +01:00
parent bd951cda66
commit 3d3a3f6d13
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86
2 changed files with 44 additions and 0 deletions

View file

@ -27,6 +27,7 @@ let
./services/udiskie.nix
./services/xscreensaver.nix
./systemd.nix
./xresources.nix
./xsession.nix
];

43
modules/xresources.nix Normal file
View file

@ -0,0 +1,43 @@
{ 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
{
options = {
xresources.properties = mkOption {
type = types.nullOr types.attrs;
default = null;
example = ''
{
"XTerm*faceName" = "dejavu sans mono";
"Emacs*toolBar" = 0;
}
'';
description = ''
X server resources that should be set. If null, then this
feature is disabled and no ~/.Xresources link is produced.
'';
};
};
config = mkIf (cfg.properties != null) {
home.file.".Xresources".text =
concatStringsSep "\n" (
mapAttrsToList formatLine cfg.properties
);
};
}