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,6 +1,16 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) literalExpression mkDefault mkOption types;
|
||||
inherit (lib)
|
||||
literalExpression
|
||||
mkDefault
|
||||
mkOption
|
||||
types
|
||||
;
|
||||
|
||||
cfg = config.programs.i3status;
|
||||
|
||||
|
|
@ -8,30 +18,45 @@ let
|
|||
|
||||
formatOrder = n: ''order += "${n}"'';
|
||||
|
||||
formatModule = n: v:
|
||||
formatModule =
|
||||
n: v:
|
||||
let
|
||||
formatLine = n: v:
|
||||
formatLine =
|
||||
n: v:
|
||||
let
|
||||
formatValue = v:
|
||||
formatValue =
|
||||
v:
|
||||
if lib.isBool v then
|
||||
(if v then "true" else "false")
|
||||
else if lib.isString v then
|
||||
''"${v}"''
|
||||
else
|
||||
toString v;
|
||||
in "${n} = ${formatValue v}";
|
||||
in ''
|
||||
in
|
||||
"${n} = ${formatValue v}";
|
||||
in
|
||||
''
|
||||
${n} {
|
||||
${lib.concatStringsSep "\n " (lib.mapAttrsToList formatLine v)}
|
||||
}
|
||||
'';
|
||||
|
||||
settingsType = with types; attrsOf (oneOf [ bool int str ]);
|
||||
settingsType =
|
||||
with types;
|
||||
attrsOf (oneOf [
|
||||
bool
|
||||
int
|
||||
str
|
||||
]);
|
||||
|
||||
sortAttrNamesByPosition = comparator: set:
|
||||
let pos = n: set."${n}".position;
|
||||
in lib.sort (a: b: comparator (pos a) (pos b)) (lib.attrNames set);
|
||||
in {
|
||||
sortAttrNamesByPosition =
|
||||
comparator: set:
|
||||
let
|
||||
pos = n: set."${n}".position;
|
||||
in
|
||||
lib.sort (a: b: comparator (pos a) (pos b)) (lib.attrNames set);
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ lib.hm.maintainers.justinlovinger ];
|
||||
|
||||
options.programs.i3status = {
|
||||
|
|
@ -68,40 +93,42 @@ in {
|
|||
};
|
||||
|
||||
modules = mkOption {
|
||||
type = types.attrsOf (types.submodule {
|
||||
options = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether or not to enable this module.
|
||||
'';
|
||||
type = types.attrsOf (
|
||||
types.submodule {
|
||||
options = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether or not to enable this module.
|
||||
'';
|
||||
};
|
||||
position = mkOption {
|
||||
type = with types; either int float;
|
||||
description = ''
|
||||
Position of this module in i3status `order`.
|
||||
'';
|
||||
};
|
||||
settings = mkOption {
|
||||
type = settingsType;
|
||||
default = { };
|
||||
description = ''
|
||||
Configuration to add to this i3status module.
|
||||
See
|
||||
{manpage}`i3status(1)`
|
||||
for options.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
{
|
||||
format = "♪ %volume";
|
||||
format_muted = "♪ muted (%volume)";
|
||||
device = "pulse:1";
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
position = mkOption {
|
||||
type = with types; either int float;
|
||||
description = ''
|
||||
Position of this module in i3status `order`.
|
||||
'';
|
||||
};
|
||||
settings = mkOption {
|
||||
type = settingsType;
|
||||
default = { };
|
||||
description = ''
|
||||
Configuration to add to this i3status module.
|
||||
See
|
||||
{manpage}`i3status(1)`
|
||||
for options.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
{
|
||||
format = "♪ %volume";
|
||||
format_muted = "♪ muted (%volume)";
|
||||
device = "pulse:1";
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
default = { };
|
||||
description = ''
|
||||
Modules to add to i3status {file}`config` file.
|
||||
|
|
@ -140,7 +167,9 @@ in {
|
|||
};
|
||||
|
||||
modules = {
|
||||
ipv6 = { position = mkDefault 1; };
|
||||
ipv6 = {
|
||||
position = mkDefault 1;
|
||||
};
|
||||
|
||||
"wireless _first_" = {
|
||||
position = mkDefault 2;
|
||||
|
|
@ -160,17 +189,23 @@ in {
|
|||
|
||||
"battery all" = {
|
||||
position = mkDefault 4;
|
||||
settings = { format = mkDefault "%status %percentage %remaining"; };
|
||||
settings = {
|
||||
format = mkDefault "%status %percentage %remaining";
|
||||
};
|
||||
};
|
||||
|
||||
"disk /" = {
|
||||
position = mkDefault 5;
|
||||
settings = { format = mkDefault "%avail"; };
|
||||
settings = {
|
||||
format = mkDefault "%avail";
|
||||
};
|
||||
};
|
||||
|
||||
load = {
|
||||
position = mkDefault 6;
|
||||
settings = { format = mkDefault "%1min"; };
|
||||
settings = {
|
||||
format = mkDefault "%1min";
|
||||
};
|
||||
};
|
||||
|
||||
memory = {
|
||||
|
|
@ -184,17 +219,20 @@ in {
|
|||
|
||||
"tztime local" = {
|
||||
position = mkDefault 8;
|
||||
settings = { format = mkDefault "%Y-%m-%d %H:%M:%S"; };
|
||||
settings = {
|
||||
format = mkDefault "%Y-%m-%d %H:%M:%S";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
||||
|
||||
xdg.configFile."i3status/config".text = lib.concatStringsSep "\n" ([ ]
|
||||
xdg.configFile."i3status/config".text = lib.concatStringsSep "\n" (
|
||||
[ ]
|
||||
++ lib.optional (cfg.general != { }) (formatModule "general" cfg.general)
|
||||
++ map formatOrder (sortAttrNamesByPosition lib.lessThan enabledModules)
|
||||
++ lib.mapAttrsToList formatModule
|
||||
(lib.mapAttrs (n: v: v.settings) enabledModules));
|
||||
++ lib.mapAttrsToList formatModule (lib.mapAttrs (n: v: v.settings) enabledModules)
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue