Add nix shell
detection to tide
This commit is contained in:
parent
a4acdec715
commit
091897fbca
|
@ -1,73 +1,87 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
programs.fish = {
|
imports = [
|
||||||
enable = true;
|
./tide/nix-shell.nix
|
||||||
package = pkgs.unstable.fish;
|
];
|
||||||
functions = {
|
|
||||||
};
|
|
||||||
|
|
||||||
shellAliases = {
|
programs.fish = {
|
||||||
cat = "bat --theme=GitHub ";
|
enable = true;
|
||||||
l = "exa -l --color=always ";
|
package = pkgs.unstable.fish;
|
||||||
htop = "btm --color nord-light -b --tree";
|
functions = { };
|
||||||
Htop = "btm --color nord-light --tree";
|
|
||||||
|
|
||||||
# My own commands for easy access
|
tide = {
|
||||||
thisterm = "cd ~/Projects/uw/$CURRENT_TERM";
|
nix-shell.enable = true;
|
||||||
today = "date +%F";
|
|
||||||
};
|
|
||||||
|
|
||||||
interactiveShellInit = ''
|
|
||||||
set fish_greeting
|
|
||||||
|
|
||||||
# Set up an editor alias
|
|
||||||
if test -n "$EDITOR"
|
|
||||||
alias e="$EDITOR"
|
|
||||||
else
|
|
||||||
alias e="kak"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Source iTerm2 integration
|
|
||||||
test -e ~/.iterm2_shell_integration.fish && source ~/.iterm2_shell_integration.fish
|
|
||||||
|
|
||||||
# Enable vi keybindings
|
|
||||||
fish_vi_key_bindings
|
|
||||||
## Set some kak-focused keybindings
|
|
||||||
bind -M default gi beginning-of-line
|
|
||||||
bind -M default gl end-of-line
|
|
||||||
'';
|
|
||||||
plugins = [
|
|
||||||
{
|
|
||||||
name = "tide";
|
|
||||||
src = pkgs.fetchFromGitHub {
|
|
||||||
owner = "IlanCosman";
|
|
||||||
repo = "tide";
|
|
||||||
rev = "3787c725f7f6a0253f59a2c0e9fde03202689c6c";
|
|
||||||
sha256 = "00zsib1q21bgxffjlyxf5rgcyq3h1ixwznwvid9k6mkkmwixv9lj";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "fzf";
|
|
||||||
src = pkgs.fetchFromGitHub {
|
|
||||||
owner = "jethrokuan";
|
|
||||||
repo = "fzf";
|
|
||||||
rev = "479fa67d7439b23095e01b64987ae79a91a4e283";
|
|
||||||
sha256 = "0k6l21j192hrhy95092dm8029p52aakvzis7jiw48wnbckyidi6v";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Source files
|
shellAliases = {
|
||||||
home.file = {
|
cat = "bat --theme=GitHub ";
|
||||||
"fish/change_cmd.fish" = {
|
l = "exa -l --color=always ";
|
||||||
source = ./. + "/change_cmd.fish";
|
htop = "btm --color nord-light -b --tree";
|
||||||
target = ".config/fish/conf.d/change_cmd.fish";
|
Htop = "btm --color nord-light --tree";
|
||||||
};
|
|
||||||
"fish/pls.fish" = {
|
# My own commands for easy access
|
||||||
source = ./. + "/pls.fish";
|
thisterm = "cd ~/Projects/uw/$CURRENT_TERM";
|
||||||
target = ".config/fish/conf.d/pls.fish";
|
today = "date +%F";
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
shellInit = ''
|
||||||
|
# Source brew integration
|
||||||
|
if test -e /opt/homebrew/bin/brew
|
||||||
|
/opt/homebrew/bin/brew shellenv | source
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
|
interactiveShellInit = ''
|
||||||
|
set fish_greeting
|
||||||
|
|
||||||
|
# Set up an editor alias
|
||||||
|
if test -n "$EDITOR"
|
||||||
|
alias e="$EDITOR"
|
||||||
|
else
|
||||||
|
alias e="kak"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Source iTerm2 integration
|
||||||
|
test -e ~/.iterm2_shell_integration.fish && source ~/.iterm2_shell_integration.fish
|
||||||
|
|
||||||
|
# Enable vi keybindings
|
||||||
|
fish_vi_key_bindings
|
||||||
|
## Set some kak-focused keybindings
|
||||||
|
bind -M default gi beginning-of-line
|
||||||
|
bind -M default gl end-of-line
|
||||||
|
'';
|
||||||
|
plugins = [
|
||||||
|
{
|
||||||
|
name = "tide";
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "IlanCosman";
|
||||||
|
repo = "tide";
|
||||||
|
rev = "3787c725f7f6a0253f59a2c0e9fde03202689c6c";
|
||||||
|
sha256 = "00zsib1q21bgxffjlyxf5rgcyq3h1ixwznwvid9k6mkkmwixv9lj";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "fzf";
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "jethrokuan";
|
||||||
|
repo = "fzf";
|
||||||
|
rev = "479fa67d7439b23095e01b64987ae79a91a4e283";
|
||||||
|
sha256 = "0k6l21j192hrhy95092dm8029p52aakvzis7jiw48wnbckyidi6v";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Source files
|
||||||
|
home.file = {
|
||||||
|
"fish/change_cmd.fish" = {
|
||||||
|
source = ./. + "/change_cmd.fish";
|
||||||
|
target = ".config/fish/conf.d/change_cmd.fish";
|
||||||
|
};
|
||||||
|
"fish/pls.fish" = {
|
||||||
|
source = ./. + "/pls.fish";
|
||||||
|
target = ".config/fish/conf.d/pls.fish";
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
21
home/fish/tide/nix-shell.nix
Normal file
21
home/fish/tide/nix-shell.nix
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.programs.fish.tide.nix-shell;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.programs.fish.tide.nix-shell = {
|
||||||
|
enable = mkEnableOption "An indicator of having a `nix shell` environment";
|
||||||
|
};
|
||||||
|
|
||||||
|
config.programs.fish = mkIf cfg.enable {
|
||||||
|
functions._tide_item_nix_shell = ''
|
||||||
|
if string match -q "/nix/store/*" $PATH
|
||||||
|
set -U tide_nix_shell_color blue
|
||||||
|
set -U tide_nix_shell_bg_color normal
|
||||||
|
_tide_print_item nix_shell "❄"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue