nixos-config/modules/cli/powerline.nix

36 lines
838 B
Nix
Raw Normal View History

2023-06-05 18:42:32 +00:00
{ config, lib, pkgs, ... }:
2021-10-11 17:08:18 +00:00
let
2023-06-14 07:25:10 +00:00
theme = {
BoldForeground = true;
CwdFg = 15;
PathBg = 24;
PathFg = 15;
SeparatorFg = 16;
};
2023-06-05 18:42:32 +00:00
args = [
"-modules=\${remote:+'user,host,'}nix-shell,git,jobs,cwd"
"-git-assume-unchanged-size 0"
2023-06-14 07:23:52 +00:00
"-theme /etc/powerline-theme.json"
2023-06-05 18:42:32 +00:00
"-path-aliases '~/git=~/git'"
"-jobs $(jobs -p | wc -l)"
];
2021-10-11 17:08:18 +00:00
in
{
2023-06-05 18:42:32 +00:00
environment.systemPackages = [ pkgs.powerline-go ];
2021-10-11 17:08:18 +00:00
2023-06-14 07:23:52 +00:00
environment.etc."powerline-theme.json".text = builtins.toJSON theme;
2023-06-05 18:42:32 +00:00
programs.bash.interactiveShellInit = ''
function _update_ps1() {
local remote=y
[ "$XDG_SESSION_TYPE" = "x11" ] && unset remote
[ "$XDG_SESSION_TYPE" = "wayland" ] && unset remote
PS1="$(powerline-go ${toString args})"
}
[ "$TERM" = "linux" ] || PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
'';
2021-10-11 17:08:18 +00:00
}