mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
treewide: reformat nixfmt-rfc-style
Reformat repository using new nixfmt-rfc-style.
This commit is contained in:
parent
5df48c4255
commit
cba2f9ce95
1051 changed files with 37028 additions and 26594 deletions
|
|
@ -1,39 +1,56 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
|
||||
cfg = config.xresources;
|
||||
|
||||
formatLine = n: v:
|
||||
formatLine =
|
||||
n: v:
|
||||
let
|
||||
formatList = x:
|
||||
formatList =
|
||||
x:
|
||||
if lib.isList x then
|
||||
throw "can not convert 2-dimensional lists to Xresources format"
|
||||
else
|
||||
formatValue x;
|
||||
|
||||
formatValue = v:
|
||||
formatValue =
|
||||
v:
|
||||
if lib.isBool v then
|
||||
(if v then "true" else "false")
|
||||
else if lib.isList v then
|
||||
lib.concatMapStringsSep ", " formatList v
|
||||
else
|
||||
toString v;
|
||||
in "${n}: ${formatValue v}";
|
||||
in
|
||||
"${n}: ${formatValue v}";
|
||||
|
||||
xrdbMerge = "${pkgs.xorg.xrdb}/bin/xrdb -merge ${cfg.path}";
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ lib.maintainers.rycee ];
|
||||
|
||||
options = {
|
||||
xresources.properties = mkOption {
|
||||
type = with types;
|
||||
type =
|
||||
with types;
|
||||
let
|
||||
prim = oneOf [ bool int float str ];
|
||||
prim = oneOf [
|
||||
bool
|
||||
int
|
||||
float
|
||||
str
|
||||
];
|
||||
entry = either prim (listOf prim);
|
||||
in nullOr (attrsOf entry);
|
||||
in
|
||||
nullOr (attrsOf entry);
|
||||
default = null;
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
|
|
@ -79,25 +96,26 @@ in {
|
|||
type = types.str;
|
||||
default = "${config.home.homeDirectory}/.Xresources";
|
||||
defaultText = "$HOME/.Xresources";
|
||||
description =
|
||||
"Path where Home Manager should link the {file}`.Xresources` file.";
|
||||
description = "Path where Home Manager should link the {file}`.Xresources` file.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf ((cfg.properties != null && cfg.properties != { })
|
||||
|| cfg.extraConfig != "") {
|
||||
home.file.${cfg.path} = {
|
||||
text = lib.concatStringsSep "\n" ([ ]
|
||||
config = lib.mkIf ((cfg.properties != null && cfg.properties != { }) || cfg.extraConfig != "") {
|
||||
home.file.${cfg.path} = {
|
||||
text =
|
||||
lib.concatStringsSep "\n" (
|
||||
[ ]
|
||||
++ lib.optional (cfg.extraConfig != "") cfg.extraConfig
|
||||
++ lib.optionals (cfg.properties != null)
|
||||
(lib.mapAttrsToList formatLine cfg.properties)) + "\n";
|
||||
onChange = ''
|
||||
if [[ -v DISPLAY ]]; then
|
||||
${xrdbMerge}
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
xsession.profileExtra = xrdbMerge;
|
||||
++ lib.optionals (cfg.properties != null) (lib.mapAttrsToList formatLine cfg.properties)
|
||||
)
|
||||
+ "\n";
|
||||
onChange = ''
|
||||
if [[ -v DISPLAY ]]; then
|
||||
${xrdbMerge}
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
xsession.profileExtra = xrdbMerge;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue