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:
parent
747e36476f
commit
7e81e7ae2b
13 changed files with 19 additions and 57 deletions
|
@ -146,14 +146,11 @@ let
|
||||||
(mapAttrsToList (k: v: "alias ${k} ${escapeShellArg v}") cfg.shellAliases);
|
(mapAttrsToList (k: v: "alias ${k} ${escapeShellArg v}") cfg.shellAliases);
|
||||||
|
|
||||||
fishIndent = name: text:
|
fishIndent = name: text:
|
||||||
if cfg.formatFishScripts then
|
|
||||||
pkgs.runCommand name {
|
pkgs.runCommand name {
|
||||||
nativeBuildInputs = [ cfg.package ];
|
nativeBuildInputs = [ cfg.package ];
|
||||||
inherit text;
|
inherit text;
|
||||||
passAsFile = [ "text" ];
|
passAsFile = [ "text" ];
|
||||||
} "fish_indent < $textPath > $out"
|
} "fish_indent < $textPath > $out";
|
||||||
else
|
|
||||||
pkgs.writeText name text;
|
|
||||||
|
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
|
@ -288,16 +285,6 @@ in {
|
||||||
<link xlink:href="https://fishshell.com/docs/current/cmds/function.html"/>.
|
<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 [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
test.stubs = {
|
test.stubs = {
|
||||||
atuin = { };
|
atuin = { };
|
||||||
bash-preexec = { };
|
bash-preexec = { };
|
||||||
fish = { };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
test.stubs = {
|
test.stubs = {
|
||||||
atuin = { };
|
atuin = { };
|
||||||
bash-preexec = { };
|
bash-preexec = { };
|
||||||
fish = { };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
|
|
|
@ -6,7 +6,7 @@ let
|
||||||
|
|
||||||
func = pkgs.writeText "func.fish" ''
|
func = pkgs.writeText "func.fish" ''
|
||||||
function func
|
function func
|
||||||
echo "Hello"
|
echo Hello
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -34,8 +34,6 @@ in {
|
||||||
xdg.dataFile."fish/home-manager_generated_completions".source =
|
xdg.dataFile."fish/home-manager_generated_completions".source =
|
||||||
lib.mkForce (builtins.toFile "empty" "");
|
lib.mkForce (builtins.toFile "empty" "");
|
||||||
|
|
||||||
test.stubs.fish = { };
|
|
||||||
|
|
||||||
nmt = {
|
nmt = {
|
||||||
description =
|
description =
|
||||||
"if fish.function is set, check file exists and contents match";
|
"if fish.function is set, check file exists and contents match";
|
||||||
|
|
|
@ -14,8 +14,6 @@ with lib;
|
||||||
xdg.dataFile."fish/home-manager_generated_completions".source =
|
xdg.dataFile."fish/home-manager_generated_completions".source =
|
||||||
lib.mkForce (builtins.toFile "empty" "");
|
lib.mkForce (builtins.toFile "empty" "");
|
||||||
|
|
||||||
test.stubs.fish = { };
|
|
||||||
|
|
||||||
nmt = {
|
nmt = {
|
||||||
description =
|
description =
|
||||||
"if fish.functions is blank, the functions folder should not exist.";
|
"if fish.functions is blank, the functions folder should not exist.";
|
||||||
|
|
|
@ -50,8 +50,6 @@ in {
|
||||||
xdg.dataFile."fish/home-manager_generated_completions".source =
|
xdg.dataFile."fish/home-manager_generated_completions".source =
|
||||||
lib.mkForce (builtins.toFile "empty" "");
|
lib.mkForce (builtins.toFile "empty" "");
|
||||||
|
|
||||||
test.stubs.fish = { };
|
|
||||||
|
|
||||||
nmt = {
|
nmt = {
|
||||||
description =
|
description =
|
||||||
"if fish.plugins set, check conf.d file exists and contents match";
|
"if fish.plugins set, check conf.d file exists and contents match";
|
||||||
|
|
|
@ -12,10 +12,7 @@
|
||||||
xdg.dataFile."fish/home-manager_generated_completions".source =
|
xdg.dataFile."fish/home-manager_generated_completions".source =
|
||||||
lib.mkForce (builtins.toFile "empty" "");
|
lib.mkForce (builtins.toFile "empty" "");
|
||||||
|
|
||||||
test.stubs = {
|
test.stubs.zsh = { };
|
||||||
zsh = { };
|
|
||||||
fish = { };
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.nix-index.enable = true;
|
programs.nix-index.enable = true;
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,7 @@ in {
|
||||||
xdg.dataFile."fish/home-manager_generated_completions".source =
|
xdg.dataFile."fish/home-manager_generated_completions".source =
|
||||||
lib.mkForce (builtins.toFile "empty" "");
|
lib.mkForce (builtins.toFile "empty" "");
|
||||||
|
|
||||||
test.stubs = {
|
test.stubs.zsh = { };
|
||||||
zsh = { };
|
|
||||||
fish = { };
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.nix-index.enable = true;
|
programs.nix-index.enable = true;
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,7 @@
|
||||||
xdg.dataFile."fish/home-manager_generated_completions".source =
|
xdg.dataFile."fish/home-manager_generated_completions".source =
|
||||||
lib.mkForce (builtins.toFile "empty" "");
|
lib.mkForce (builtins.toFile "empty" "");
|
||||||
|
|
||||||
test.stubs = {
|
test.stubs.oh-my-posh = { };
|
||||||
oh-my-posh = { };
|
|
||||||
fish = { };
|
|
||||||
};
|
|
||||||
|
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
assertFileExists home-files/.config/fish/config.fish
|
assertFileExists home-files/.config/fish/config.fish
|
||||||
|
|
|
@ -18,10 +18,7 @@ with lib;
|
||||||
xdg.dataFile."fish/home-manager_generated_completions".source =
|
xdg.dataFile."fish/home-manager_generated_completions".source =
|
||||||
mkForce (builtins.toFile "empty" "");
|
mkForce (builtins.toFile "empty" "");
|
||||||
|
|
||||||
test.stubs = {
|
test.stubs.pls = { };
|
||||||
pls = { };
|
|
||||||
fish = { };
|
|
||||||
};
|
|
||||||
|
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
assertFileExists home-files/.config/fish/config.fish
|
assertFileExists home-files/.config/fish/config.fish
|
||||||
|
|
|
@ -22,10 +22,7 @@ with lib;
|
||||||
xdg.dataFile."fish/home-manager_generated_completions".source =
|
xdg.dataFile."fish/home-manager_generated_completions".source =
|
||||||
mkForce (builtins.toFile "empty" "");
|
mkForce (builtins.toFile "empty" "");
|
||||||
|
|
||||||
test.stubs = {
|
test.stubs.powerline-go = { };
|
||||||
powerline-go = { };
|
|
||||||
fish = { };
|
|
||||||
};
|
|
||||||
|
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
assertFileExists home-files/.config/fish/config.fish
|
assertFileExists home-files/.config/fish/config.fish
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
xdg.dataFile."fish/home-manager_generated_completions".source =
|
xdg.dataFile."fish/home-manager_generated_completions".source =
|
||||||
lib.mkForce (builtins.toFile "empty" "");
|
lib.mkForce (builtins.toFile "empty" "");
|
||||||
|
|
||||||
test.stubs.fish = { };
|
|
||||||
test.stubs.scmpuff = { };
|
test.stubs.scmpuff = { };
|
||||||
|
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
xdg.dataFile."fish/home-manager_generated_completions".source =
|
xdg.dataFile."fish/home-manager_generated_completions".source =
|
||||||
lib.mkForce (builtins.toFile "empty" "");
|
lib.mkForce (builtins.toFile "empty" "");
|
||||||
|
|
||||||
test.stubs.fish = { };
|
|
||||||
test.stubs.scmpuff = { };
|
test.stubs.scmpuff = { };
|
||||||
|
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
|
|
Loading…
Reference in a new issue