xresources: Add path configuration option (#2141)

* xresources: Add path configuration option

This allows the user to move .Xresources somewhere else, which can help
with decluttering the home directory.

* xresources: Update xresources.path docs

* xresources: Fix formatting
This commit is contained in:
Lava 2021-06-28 13:50:40 +07:00 committed by GitHub
parent a17bc3217f
commit dc4337d9fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,7 +23,7 @@ let
toString v; toString v;
in "${n}: ${formatValue v}"; in "${n}: ${formatValue v}";
xrdbMerge = "${pkgs.xorg.xrdb}/bin/xrdb -merge ~/.Xresources"; xrdbMerge = "${pkgs.xorg.xrdb}/bin/xrdb -merge ${cfg.path}";
in { in {
meta.maintainers = [ maintainers.rycee ]; meta.maintainers = [ maintainers.rycee ];
@ -75,11 +75,19 @@ in {
<filename>~/.Xresources</filename> link is produced. <filename>~/.Xresources</filename> link is produced.
''; '';
}; };
xresources.path = mkOption {
type = types.str;
default = "${config.home.homeDirectory}/.Xresources";
defaultText = "$HOME/.Xresources";
description =
"Path where Home Manager should link the <filename>.Xresources</filename> file.";
};
}; };
config = mkIf ((cfg.properties != null && cfg.properties != { }) config = mkIf ((cfg.properties != null && cfg.properties != { })
|| cfg.extraConfig != "") { || cfg.extraConfig != "") {
home.file.".Xresources" = { home.file.${cfg.path} = {
text = concatStringsSep "\n" ([ ] text = concatStringsSep "\n" ([ ]
++ optional (cfg.extraConfig != "") cfg.extraConfig ++ optional (cfg.extraConfig != "") cfg.extraConfig
++ optionals (cfg.properties != null) ++ optionals (cfg.properties != null)