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,25 +1,39 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) filterAttrs mapAttrsToList mkOption types;
|
||||
inherit (lib)
|
||||
filterAttrs
|
||||
mapAttrsToList
|
||||
mkOption
|
||||
types
|
||||
;
|
||||
|
||||
cfg = config.programs.feh;
|
||||
|
||||
bindingsOf = t: with types; attrsOf (nullOr (either t (listOf t)));
|
||||
|
||||
renderThemes = options:
|
||||
renderThemes =
|
||||
options:
|
||||
let
|
||||
render = mapAttrsToList
|
||||
(theme: options: "${theme} ${lib.escapeShellArgs options}");
|
||||
in lib.concatStringsSep "\n" (render options);
|
||||
render = mapAttrsToList (theme: options: "${theme} ${lib.escapeShellArgs options}");
|
||||
in
|
||||
lib.concatStringsSep "\n" (render options);
|
||||
|
||||
renderBindings = bindings:
|
||||
renderBindings =
|
||||
bindings:
|
||||
let
|
||||
enabled = filterAttrs (n: v: v != null) bindings;
|
||||
disabled = filterAttrs (n: v: v == null) bindings;
|
||||
render = mapAttrsToList renderBinding;
|
||||
in lib.concatStringsSep "\n" (render disabled ++ render enabled);
|
||||
in
|
||||
lib.concatStringsSep "\n" (render disabled ++ render enabled);
|
||||
|
||||
renderBinding = func: key:
|
||||
renderBinding =
|
||||
func: key:
|
||||
if key == null then
|
||||
func
|
||||
else if lib.isList key then
|
||||
|
|
@ -27,7 +41,8 @@ let
|
|||
else
|
||||
"${func} ${toString key}";
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.programs.feh = {
|
||||
enable = lib.mkEnableOption "feh - a fast and light image viewer";
|
||||
|
||||
|
|
@ -39,7 +54,10 @@ in {
|
|||
example = {
|
||||
zoom_in = 4;
|
||||
zoom_out = "C-4";
|
||||
prev_img = [ 3 "C-3" ];
|
||||
prev_img = [
|
||||
3
|
||||
"C-3"
|
||||
];
|
||||
};
|
||||
description = ''
|
||||
Override feh's default mouse button mapping. If you want to disable an
|
||||
|
|
@ -56,7 +74,10 @@ in {
|
|||
example = {
|
||||
zoom_in = "plus";
|
||||
zoom_out = "minus";
|
||||
prev_img = [ "h" "Left" ];
|
||||
prev_img = [
|
||||
"h"
|
||||
"Left"
|
||||
];
|
||||
};
|
||||
description = ''
|
||||
Override feh's default keybindings. If you want to disable a keybinding
|
||||
|
|
@ -71,10 +92,27 @@ in {
|
|||
default = { };
|
||||
type = with types; attrsOf (listOf str);
|
||||
example = {
|
||||
feh = [ "--image-bg" "black" ];
|
||||
webcam = [ "--multiwindow" "--reload" "20" ];
|
||||
present = [ "--full-screen" "--sort" "name" "--hide-pointer" ];
|
||||
booth = [ "--full-screen" "--hide-pointer" "--slideshow-delay" "20" ];
|
||||
feh = [
|
||||
"--image-bg"
|
||||
"black"
|
||||
];
|
||||
webcam = [
|
||||
"--multiwindow"
|
||||
"--reload"
|
||||
"20"
|
||||
];
|
||||
present = [
|
||||
"--full-screen"
|
||||
"--sort"
|
||||
"name"
|
||||
"--hide-pointer"
|
||||
];
|
||||
booth = [
|
||||
"--full-screen"
|
||||
"--hide-pointer"
|
||||
"--slideshow-delay"
|
||||
"20"
|
||||
];
|
||||
imagemap = [
|
||||
"-rVq"
|
||||
"--thumb-width"
|
||||
|
|
@ -84,7 +122,10 @@ in {
|
|||
"--index-info"
|
||||
"%n\\n%wx%h"
|
||||
];
|
||||
example = [ "--info" "foo bar" ];
|
||||
example = [
|
||||
"--info"
|
||||
"foo bar"
|
||||
];
|
||||
};
|
||||
description = ''
|
||||
Define themes for feh.
|
||||
|
|
@ -96,11 +137,12 @@ in {
|
|||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
assertions = [{
|
||||
assertion = ((filterAttrs (n: v: v == "") cfg.keybindings) == { });
|
||||
message =
|
||||
"To disable a keybinding, use `null` instead of an empty string.";
|
||||
}];
|
||||
assertions = [
|
||||
{
|
||||
assertion = ((filterAttrs (n: v: v == "") cfg.keybindings) == { });
|
||||
message = "To disable a keybinding, use `null` instead of an empty string.";
|
||||
}
|
||||
];
|
||||
|
||||
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
||||
|
||||
|
|
@ -112,7 +154,8 @@ in {
|
|||
text = renderBindings cfg.keybindings + "\n";
|
||||
};
|
||||
|
||||
xdg.configFile."feh/themes" =
|
||||
lib.mkIf (cfg.themes != { }) { text = renderThemes cfg.themes + "\n"; };
|
||||
xdg.configFile."feh/themes" = lib.mkIf (cfg.themes != { }) {
|
||||
text = renderThemes cfg.themes + "\n";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue