1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 05:29:46 +01:00

powerline-go: add fish integration

This commit is contained in:
Vanilla 2021-08-03 11:16:00 +08:00 committed by Robert Helgesson
parent 7f976da068
commit ab6517d34a
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
3 changed files with 51 additions and 0 deletions

View file

@ -140,5 +140,14 @@ in {
install_powerline_precmd
fi
'';
# https://github.com/justjanne/powerline-go#fish
programs.fish.promptInit =
mkIf (cfg.enable && config.programs.fish.enable) ''
function fish_prompt
eval ${pkgs.powerline-go}/bin/powerline-go -error $status -jobs (count (jobs -p)) ${commandLineArguments}
${cfg.extraUpdatePS1}
end
'';
};
}

View file

@ -1,4 +1,5 @@
{
powerline-go-bash = ./bash.nix;
powerline-go-zsh = ./zsh.nix;
powerline-go-fish = ./fish.nix;
}

View file

@ -0,0 +1,41 @@
{ config, lib, pkgs, ... }:
with lib;
{
config = {
programs = {
fish.enable = true;
powerline-go = {
enable = true;
newline = true;
modules = [ "nix-shell" ];
pathAliases = { "\\~/project/foo" = "prj-foo"; };
settings = {
ignore-repos = [ "/home/me/project1" "/home/me/project2" ];
};
};
};
# Needed to avoid error with dummy fish package.
xdg.dataFile."fish/home-manager_generated_completions".source =
mkForce (builtins.toFile "empty" "");
nixpkgs.overlays = [
(self: super:
let dummy = pkgs.writeScriptBin "dummy" "";
in {
powerline-go = dummy;
fish = dummy;
})
];
nmt.script = ''
assertFileExists home-files/.config/fish/config.fish
assertFileContains \
home-files/.config/fish/config.fish \
'/bin/powerline-go -error $status -jobs (count (jobs -p)) -modules nix-shell -newline -path-aliases \~/project/foo=prj-foo -ignore-repos /home/me/project1,/home/me/project2'
'';
};
}