1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-30 06:59:45 +01:00

fish: always run fish_indent

This commit is contained in:
mat ess 2022-12-04 20:51:03 -05:00 committed by Robert Helgesson
parent 747e36476f
commit 7e81e7ae2b
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
13 changed files with 19 additions and 57 deletions

View file

@ -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 {
<link xlink:href="https://fishshell.com/docs/current/cmds/function.html"/>.
'';
};
programs.fish.formatFishScripts = mkOption {
type = types.bool;
default = false;
description = ''
Whether to process fish configuration and scripts with
<literal>fish_indent</literal>.
'';
};
};
config = mkIf cfg.enable (mkMerge [

View file

@ -13,7 +13,6 @@
test.stubs = {
atuin = { };
bash-preexec = { };
fish = { };
};
nmt.script = ''

View file

@ -20,7 +20,6 @@
test.stubs = {
atuin = { };
bash-preexec = { };
fish = { };
};
nmt.script = ''

View file

@ -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";

View file

@ -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.";

View file

@ -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";

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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 = ''

View file

@ -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 = ''