scmpuff: add fish integration flag
This commit is contained in:
parent
3ce1c4787a
commit
f7641a3ff3
|
@ -31,6 +31,14 @@ in {
|
||||||
Whether to enable Zsh integration.
|
Whether to enable Zsh integration.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enableFishIntegration = mkOption {
|
||||||
|
default = true;
|
||||||
|
type = types.bool;
|
||||||
|
description = ''
|
||||||
|
Whether to enable fish integration.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
@ -43,5 +51,10 @@ in {
|
||||||
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
|
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
|
||||||
eval "$(${cfg.package}/bin/scmpuff init -s)"
|
eval "$(${cfg.package}/bin/scmpuff init -s)"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration
|
||||||
|
(mkAfter ''
|
||||||
|
${cfg.package}/bin/scmpuff init -s --shell=fish | source
|
||||||
|
'');
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,4 +4,6 @@
|
||||||
scmpuff-no-shell = ./no-shell.nix;
|
scmpuff-no-shell = ./no-shell.nix;
|
||||||
scmpuff-no-zsh = ./no-zsh.nix;
|
scmpuff-no-zsh = ./no-zsh.nix;
|
||||||
scmpuff-zsh = ./zsh.nix;
|
scmpuff-zsh = ./zsh.nix;
|
||||||
|
scmpuff-fish = ./fish.nix;
|
||||||
|
scmpuff-no-fish = ./no-fish.nix;
|
||||||
}
|
}
|
||||||
|
|
20
tests/modules/programs/scmpuff/fish.nix
Normal file
20
tests/modules/programs/scmpuff/fish.nix
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{ pkgs, lib, ... }: {
|
||||||
|
programs = {
|
||||||
|
scmpuff.enable = true;
|
||||||
|
fish.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Needed to avoid error with dummy fish package.
|
||||||
|
xdg.dataFile."fish/home-manager_generated_completions".source =
|
||||||
|
lib.mkForce (builtins.toFile "empty" "");
|
||||||
|
|
||||||
|
test.stubs.fish = { };
|
||||||
|
test.stubs.scmpuff = { };
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.config/fish/config.fish
|
||||||
|
assertFileContains \
|
||||||
|
home-files/.config/fish/config.fish \
|
||||||
|
'@scmpuff@/bin/scmpuff init -s --shell=fish | source'
|
||||||
|
'';
|
||||||
|
}
|
20
tests/modules/programs/scmpuff/no-fish.nix
Normal file
20
tests/modules/programs/scmpuff/no-fish.nix
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{ pkgs, lib, ... }: {
|
||||||
|
programs = {
|
||||||
|
scmpuff = {
|
||||||
|
enable = true;
|
||||||
|
enableFishIntegration = false;
|
||||||
|
};
|
||||||
|
fish.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Needed to avoid error with dummy fish package.
|
||||||
|
xdg.dataFile."fish/home-manager_generated_completions".source =
|
||||||
|
lib.mkForce (builtins.toFile "empty" "");
|
||||||
|
|
||||||
|
test.stubs.fish = { };
|
||||||
|
test.stubs.scmpuff = { };
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileNotRegex home-files/.config/fish/config.fish '@scmpuff@'
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in a new issue