Apply nixfmt on many files

This commit is contained in:
Robert Helgesson 2020-02-02 00:39:17 +01:00
parent 9799d3de2d
commit 45abf3d38a
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
177 changed files with 2850 additions and 3565 deletions

View file

@ -9,31 +9,35 @@ let
disableBinding = func: key: func;
enableBinding = func: key: "${func} ${toString key}";
in
{
in {
options.programs.feh = {
enable = mkEnableOption "feh - a fast and light image viewer";
buttons = mkOption {
default = {};
default = { };
type = with types; attrsOf (nullOr (either str int));
example = { zoom_in = 4; zoom_out = "C-4"; };
example = {
zoom_in = 4;
zoom_out = "C-4";
};
description = ''
Override feh's default mouse button mapping. If you want to disable an
action, set its value to null.
action, set its value to null.
See <link xlink:href="https://man.finalrewind.org/1/feh/#x425554544f4e53"/> for
default bindings and available commands.
'';
};
keybindings = mkOption {
default = {};
default = { };
type = types.attrsOf (types.nullOr types.str);
example = { zoom_in = "plus"; zoom_out = "minus"; };
example = {
zoom_in = "plus";
zoom_out = "minus";
};
description = ''
Override feh's default keybindings. If you want to disable a keybinding
set its value to null.
set its value to null.
See <link xlink:href="https://man.finalrewind.org/1/feh/#x4b455953"/> for
default bindings and available commands.
'';
@ -41,23 +45,26 @@ in
};
config = 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 = [ pkgs.feh ];
xdg.configFile."feh/buttons".text = ''
${concatStringsSep "\n" (mapAttrsToList disableBinding (filterAttrs (n: v: v == null) cfg.buttons))}
${concatStringsSep "\n" (mapAttrsToList enableBinding (filterAttrs (n: v: v != null) cfg.buttons))}
${concatStringsSep "\n" (mapAttrsToList disableBinding
(filterAttrs (n: v: v == null) cfg.buttons))}
${concatStringsSep "\n" (mapAttrsToList enableBinding
(filterAttrs (n: v: v != null) cfg.buttons))}
'';
xdg.configFile."feh/keys".text = ''
${concatStringsSep "\n" (mapAttrsToList disableBinding (filterAttrs (n: v: v == null) cfg.keybindings))}
${concatStringsSep "\n" (mapAttrsToList enableBinding (filterAttrs (n: v: v != null) cfg.keybindings))}
${concatStringsSep "\n" (mapAttrsToList disableBinding
(filterAttrs (n: v: v == null) cfg.keybindings))}
${concatStringsSep "\n" (mapAttrsToList enableBinding
(filterAttrs (n: v: v != null) cfg.keybindings))}
'';
};
}