From 7e81e7ae2b66d3d059c75914b867575921a0b05a Mon Sep 17 00:00:00 2001 From: mat ess Date: Sun, 4 Dec 2022 20:51:03 -0500 Subject: [PATCH] fish: always run fish_indent --- modules/programs/fish.nix | 23 ++++--------------- tests/modules/programs/atuin/fish.nix | 1 - tests/modules/programs/atuin/no-shell.nix | 1 - tests/modules/programs/fish/functions.nix | 6 ++--- tests/modules/programs/fish/no-functions.nix | 2 -- tests/modules/programs/fish/plugins.nix | 16 ++++++------- .../nix-index/assert-on-command-not-found.nix | 5 +--- .../programs/nix-index/integrations.nix | 5 +--- tests/modules/programs/oh-my-posh/fish.nix | 5 +--- tests/modules/programs/pls/fish.nix | 5 +--- tests/modules/programs/powerline-go/fish.nix | 5 +--- tests/modules/programs/scmpuff/fish.nix | 1 - tests/modules/programs/scmpuff/no-fish.nix | 1 - 13 files changed, 19 insertions(+), 57 deletions(-) diff --git a/modules/programs/fish.nix b/modules/programs/fish.nix index 50c7c5bb..55a7c1cc 100644 --- a/modules/programs/fish.nix +++ b/modules/programs/fish.nix @@ -146,14 +146,11 @@ let (mapAttrsToList (k: v: "alias ${k} ${escapeShellArg v}") cfg.shellAliases); fishIndent = name: text: - if cfg.formatFishScripts then - pkgs.runCommand name { - nativeBuildInputs = [ cfg.package ]; - inherit text; - passAsFile = [ "text" ]; - } "fish_indent < $textPath > $out" - else - pkgs.writeText name text; + pkgs.runCommand name { + nativeBuildInputs = [ cfg.package ]; + inherit text; + passAsFile = [ "text" ]; + } "fish_indent < $textPath > $out"; in { imports = [ @@ -288,16 +285,6 @@ in { . ''; }; - - programs.fish.formatFishScripts = mkOption { - type = types.bool; - default = false; - description = '' - Whether to process fish configuration and scripts with - fish_indent. - ''; - }; - }; config = mkIf cfg.enable (mkMerge [ diff --git a/tests/modules/programs/atuin/fish.nix b/tests/modules/programs/atuin/fish.nix index 77232dba..527943d6 100644 --- a/tests/modules/programs/atuin/fish.nix +++ b/tests/modules/programs/atuin/fish.nix @@ -13,7 +13,6 @@ test.stubs = { atuin = { }; bash-preexec = { }; - fish = { }; }; nmt.script = '' diff --git a/tests/modules/programs/atuin/no-shell.nix b/tests/modules/programs/atuin/no-shell.nix index b636f7c0..381bcc0c 100644 --- a/tests/modules/programs/atuin/no-shell.nix +++ b/tests/modules/programs/atuin/no-shell.nix @@ -20,7 +20,6 @@ test.stubs = { atuin = { }; bash-preexec = { }; - fish = { }; }; nmt.script = '' diff --git a/tests/modules/programs/fish/functions.nix b/tests/modules/programs/fish/functions.nix index 67f8ba0d..b8b5793a 100644 --- a/tests/modules/programs/fish/functions.nix +++ b/tests/modules/programs/fish/functions.nix @@ -6,13 +6,13 @@ let func = pkgs.writeText "func.fish" '' function func - echo "Hello" + echo Hello end ''; funcEvent = pkgs.writeText "func-event.fish" '' function func-event --on-event="fish_command_not_found" - echo "Not found!" + echo "Not found!" end ''; @@ -34,8 +34,6 @@ in { xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs.fish = { }; - nmt = { description = "if fish.function is set, check file exists and contents match"; diff --git a/tests/modules/programs/fish/no-functions.nix b/tests/modules/programs/fish/no-functions.nix index 0ab38a09..125ed884 100644 --- a/tests/modules/programs/fish/no-functions.nix +++ b/tests/modules/programs/fish/no-functions.nix @@ -14,8 +14,6 @@ with lib; xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs.fish = { }; - nmt = { description = "if fish.functions is blank, the functions folder should not exist."; diff --git a/tests/modules/programs/fish/plugins.nix b/tests/modules/programs/fish/plugins.nix index 6b02dd46..88684b3b 100644 --- a/tests/modules/programs/fish/plugins.nix +++ b/tests/modules/programs/fish/plugins.nix @@ -12,26 +12,26 @@ let # Set paths to import plugin components if test -d $plugin_dir/functions - set fish_function_path $fish_function_path[1] $plugin_dir/functions $fish_function_path[2..-1] + set fish_function_path $fish_function_path[1] $plugin_dir/functions $fish_function_path[2..-1] end if test -d $plugin_dir/completions - set fish_complete_path $fish_complete_path[1] $plugin_dir/completions $fish_complete_path[2..-1] + set fish_complete_path $fish_complete_path[1] $plugin_dir/completions $fish_complete_path[2..-1] end # Source initialization code if it exists. if test -d $plugin_dir/conf.d - for f in $plugin_dir/conf.d/*.fish - source $f - end + for f in $plugin_dir/conf.d/*.fish + source $f + end end if test -f $plugin_dir/key_bindings.fish - source $plugin_dir/key_bindings.fish + source $plugin_dir/key_bindings.fish end if test -f $plugin_dir/init.fish - source $plugin_dir/init.fish + source $plugin_dir/init.fish end ''; @@ -50,8 +50,6 @@ in { xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs.fish = { }; - nmt = { description = "if fish.plugins set, check conf.d file exists and contents match"; diff --git a/tests/modules/programs/nix-index/assert-on-command-not-found.nix b/tests/modules/programs/nix-index/assert-on-command-not-found.nix index 0fa6ee79..94d7efc3 100644 --- a/tests/modules/programs/nix-index/assert-on-command-not-found.nix +++ b/tests/modules/programs/nix-index/assert-on-command-not-found.nix @@ -12,10 +12,7 @@ xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs = { - zsh = { }; - fish = { }; - }; + test.stubs.zsh = { }; programs.nix-index.enable = true; diff --git a/tests/modules/programs/nix-index/integrations.nix b/tests/modules/programs/nix-index/integrations.nix index 1ae46df5..2fd5253a 100644 --- a/tests/modules/programs/nix-index/integrations.nix +++ b/tests/modules/programs/nix-index/integrations.nix @@ -16,10 +16,7 @@ in { xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs = { - zsh = { }; - fish = { }; - }; + test.stubs.zsh = { }; programs.nix-index.enable = true; diff --git a/tests/modules/programs/oh-my-posh/fish.nix b/tests/modules/programs/oh-my-posh/fish.nix index 69dd9ac1..07137b98 100644 --- a/tests/modules/programs/oh-my-posh/fish.nix +++ b/tests/modules/programs/oh-my-posh/fish.nix @@ -14,10 +14,7 @@ xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs = { - oh-my-posh = { }; - fish = { }; - }; + test.stubs.oh-my-posh = { }; nmt.script = '' assertFileExists home-files/.config/fish/config.fish diff --git a/tests/modules/programs/pls/fish.nix b/tests/modules/programs/pls/fish.nix index f4b94b73..d555a11c 100644 --- a/tests/modules/programs/pls/fish.nix +++ b/tests/modules/programs/pls/fish.nix @@ -18,10 +18,7 @@ with lib; xdg.dataFile."fish/home-manager_generated_completions".source = mkForce (builtins.toFile "empty" ""); - test.stubs = { - pls = { }; - fish = { }; - }; + test.stubs.pls = { }; nmt.script = '' assertFileExists home-files/.config/fish/config.fish diff --git a/tests/modules/programs/powerline-go/fish.nix b/tests/modules/programs/powerline-go/fish.nix index b7891bbf..4861d1ba 100644 --- a/tests/modules/programs/powerline-go/fish.nix +++ b/tests/modules/programs/powerline-go/fish.nix @@ -22,10 +22,7 @@ with lib; xdg.dataFile."fish/home-manager_generated_completions".source = mkForce (builtins.toFile "empty" ""); - test.stubs = { - powerline-go = { }; - fish = { }; - }; + test.stubs.powerline-go = { }; nmt.script = '' assertFileExists home-files/.config/fish/config.fish diff --git a/tests/modules/programs/scmpuff/fish.nix b/tests/modules/programs/scmpuff/fish.nix index f6abb1c7..5326995f 100644 --- a/tests/modules/programs/scmpuff/fish.nix +++ b/tests/modules/programs/scmpuff/fish.nix @@ -8,7 +8,6 @@ xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs.fish = { }; test.stubs.scmpuff = { }; nmt.script = '' diff --git a/tests/modules/programs/scmpuff/no-fish.nix b/tests/modules/programs/scmpuff/no-fish.nix index d9f7e36f..94666a59 100644 --- a/tests/modules/programs/scmpuff/no-fish.nix +++ b/tests/modules/programs/scmpuff/no-fish.nix @@ -11,7 +11,6 @@ xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs.fish = { }; test.stubs.scmpuff = { }; nmt.script = ''