aboutsummaryrefslogtreecommitdiff
path: root/home-manager/modules/programs/broot.nix
diff options
context:
space:
mode:
Diffstat (limited to 'home-manager/modules/programs/broot.nix')
-rw-r--r--home-manager/modules/programs/broot.nix97
1 files changed, 46 insertions, 51 deletions
diff --git a/home-manager/modules/programs/broot.nix b/home-manager/modules/programs/broot.nix
index f6d3cd7f920..eac31b56801 100644
--- a/home-manager/modules/programs/broot.nix
+++ b/home-manager/modules/programs/broot.nix
@@ -7,29 +7,23 @@ let
cfg = config.programs.broot;
configFile = config:
- pkgs.runCommand "conf.toml"
- {
- buildInputs = [ pkgs.remarshal ];
- preferLocalBuild = true;
- allowSubstitutes = false;
- }
- ''
- remarshal -if json -of toml \
- < ${pkgs.writeText "verbs.json" (builtins.toJSON config)} \
- > $out
- '';
+ pkgs.runCommand "conf.toml" {
+ buildInputs = [ pkgs.remarshal ];
+ preferLocalBuild = true;
+ allowSubstitutes = false;
+ } ''
+ remarshal -if json -of toml \
+ < ${pkgs.writeText "verbs.json" (builtins.toJSON config)} \
+ > $out
+ '';
brootConf = {
verbs =
- mapAttrsToList
- (name: value: value // { invocation = name; })
- cfg.verbs;
+ mapAttrsToList (name: value: value // { invocation = name; }) cfg.verbs;
skin = cfg.skin;
};
-in
-
-{
+in {
meta.maintainers = [ maintainers.aheaume ];
options.programs.broot = {
@@ -63,7 +57,10 @@ in
type = with types; attrsOf (attrsOf (either bool str));
default = {
"p" = { execution = ":parent"; };
- "edit" = { shortcut = "e"; execution = "$EDITOR {file}" ; };
+ "edit" = {
+ shortcut = "e";
+ execution = "$EDITOR {file}";
+ };
"create {subpath}" = { execution = "$EDITOR {directory}/{subpath}"; };
"view" = { execution = "less {file}"; };
};
@@ -114,7 +111,7 @@ in
skin = mkOption {
type = types.attrsOf types.str;
- default = {};
+ default = { };
example = literalExample ''
{
status_normal_fg = "grayscale(18)";
@@ -177,38 +174,36 @@ in
# Dummy file to prevent broot from trying to reinstall itself
xdg.configFile."broot/launcher/installed".text = "";
- programs.bash.initExtra =
- mkIf cfg.enableBashIntegration (
- # Using mkAfter to make it more likely to appear after other
- # manipulations of the prompt.
- mkAfter ''
- # This script was automatically generated by the broot function
- # More information can be found in https://github.com/Canop/broot
- # This function starts broot and executes the command
- # it produces, if any.
- # It's needed because some shell commands, like `cd`,
- # have no useful effect if executed in a subshell.
- function br {
- f=$(mktemp)
- (
- set +e
- broot --outcmd "$f" "$@"
- code=$?
- if [ "$code" != 0 ]; then
- rm -f "$f"
- exit "$code"
- fi
- )
- code=$?
- if [ "$code" != 0 ]; then
- return "$code"
- fi
- d=$(cat "$f")
- rm -f "$f"
- eval "$d"
- }
- ''
- );
+ programs.bash.initExtra = mkIf cfg.enableBashIntegration (
+ # Using mkAfter to make it more likely to appear after other
+ # manipulations of the prompt.
+ mkAfter ''
+ # This script was automatically generated by the broot function
+ # More information can be found in https://github.com/Canop/broot
+ # This function starts broot and executes the command
+ # it produces, if any.
+ # It's needed because some shell commands, like `cd`,
+ # have no useful effect if executed in a subshell.
+ function br {
+ f=$(mktemp)
+ (
+ set +e
+ broot --outcmd "$f" "$@"
+ code=$?
+ if [ "$code" != 0 ]; then
+ rm -f "$f"
+ exit "$code"
+ fi
+ )
+ code=$?
+ if [ "$code" != 0 ]; then
+ return "$code"
+ fi
+ d=$(cat "$f")
+ rm -f "$f"
+ eval "$d"
+ }
+ '');
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
# This script was automatically generated by the broot function