mirror of
https://github.com/nmasur/dotfiles
synced 2024-12-24 02:34:52 +00:00
split out starship, fzf, direnv
This commit is contained in:
parent
e215ef6428
commit
6f2fff80ed
@ -1 +1,11 @@
|
||||
{ ... }: { imports = [ ./fish.nix ./git.nix ./github.nix ./utilities.nix ]; }
|
||||
{ ... }: {
|
||||
imports = [
|
||||
./fish.nix
|
||||
./starship.nix
|
||||
./fzf.nix
|
||||
./direnv.nix
|
||||
./git.nix
|
||||
./github.nix
|
||||
./utilities.nix
|
||||
];
|
||||
}
|
||||
|
13
modules/shell/direnv.nix
Normal file
13
modules/shell/direnv.nix
Normal file
@ -0,0 +1,13 @@
|
||||
{ config, ... }: {
|
||||
|
||||
home-manager.users.${config.user}.programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
config = {
|
||||
whitelist = {
|
||||
prefix = [ "/home/${config.user}/dev/personal/dotfiles/" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
{ config, pkgs, ... }: {
|
||||
{ config, pkgs, lib, ... }: {
|
||||
|
||||
users.users.${config.user}.shell = pkgs.fish;
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
|
||||
home.packages = with pkgs; [ exa fd bat ripgrep ];
|
||||
home.packages = with pkgs; [ exa fd bat ripgrep curl ];
|
||||
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
@ -48,14 +48,6 @@
|
||||
argumentNames = "filename";
|
||||
body = builtins.readFile ../../fish.configlink/functions/note.fish;
|
||||
};
|
||||
projects = {
|
||||
description = "Jump to a project";
|
||||
body = ''
|
||||
set projdir (ls $PROJ | fzf)
|
||||
and cd $PROJ/$projdir
|
||||
and commandline -f execute
|
||||
'';
|
||||
};
|
||||
recent = {
|
||||
description = "Open a recent file in Vim";
|
||||
body = builtins.readFile ../../fish.configlink/functions/recent.fish;
|
||||
@ -86,7 +78,6 @@
|
||||
lh = "ls -lh";
|
||||
ll = "ls -alhF";
|
||||
la = "ls -a";
|
||||
lf = "ls -lh | fzf";
|
||||
c = "cd";
|
||||
"-" = "cd -";
|
||||
mkd = "mkdir -pv";
|
||||
@ -95,9 +86,7 @@
|
||||
s = "sudo";
|
||||
sc = "systemctl";
|
||||
scs = "systemctl status";
|
||||
reb = "nixos-rebuild switch -I nixos-config=${
|
||||
builtins.toString ../../nixos/.
|
||||
}/configuration.nix";
|
||||
m = "make";
|
||||
|
||||
# Tmux
|
||||
ta = "tmux attach-session";
|
||||
@ -111,10 +100,6 @@
|
||||
# Notes
|
||||
sn = "syncnotes";
|
||||
|
||||
# CLI Tools
|
||||
h = "http -Fh --all"; # Curl site for headers
|
||||
m = "make"; # For makefiles
|
||||
|
||||
# Fun CLI Tools
|
||||
weather = "curl wttr.in/$WEATHER_CITY";
|
||||
moon = "curl wttr.in/Moon";
|
||||
@ -154,37 +139,11 @@
|
||||
shellInit = "";
|
||||
};
|
||||
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
home.sessionVariables.fish_greeting = "";
|
||||
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
programs.starship.enableFishIntegration = true;
|
||||
programs.zoxide.enableFishIntegration = true;
|
||||
programs.fzf.enableFishIntegration = true;
|
||||
|
||||
home.sessionVariables = let fzfCommand = "fd --type file";
|
||||
in {
|
||||
fish_greeting = "";
|
||||
FZF_DEFAULT_COMMAND = fzfCommand;
|
||||
FZF_CTRL_T_COMMAND = fzfCommand;
|
||||
FZF_DEFAULT_OPTS = "-m --height 50% --border";
|
||||
};
|
||||
|
||||
programs.zoxide = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
|
||||
xdg.configFile = {
|
||||
"starship.toml".source = ../../starship/starship.toml.configlink;
|
||||
};
|
||||
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
config = { whitelist = { prefix = [ "${builtins.toString ../.}/" ]; }; };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
30
modules/shell/fzf.nix
Normal file
30
modules/shell/fzf.nix
Normal file
@ -0,0 +1,30 @@
|
||||
{ config, ... }: {
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
|
||||
programs.fzf.enable = true;
|
||||
|
||||
programs.fish = {
|
||||
functions = {
|
||||
projects = {
|
||||
description = "Jump to a project";
|
||||
body = ''
|
||||
set projdir (ls $PROJ | fzf)
|
||||
and cd $PROJ/$projdir
|
||||
and commandline -f execute
|
||||
'';
|
||||
};
|
||||
};
|
||||
shellAbbrs = { lf = "ls -lh | fzf"; };
|
||||
};
|
||||
|
||||
home.sessionVariables = let fzfCommand = "fd --type file";
|
||||
in {
|
||||
FZF_DEFAULT_COMMAND = fzfCommand;
|
||||
FZF_CTRL_T_COMMAND = fzfCommand;
|
||||
FZF_DEFAULT_OPTS = "-m --height 50% --border";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
54
modules/shell/starship.nix
Normal file
54
modules/shell/starship.nix
Normal file
@ -0,0 +1,54 @@
|
||||
{ config, lib, ... }: {
|
||||
|
||||
home-manager.users.${config.user}.programs.starship = {
|
||||
enable = true;
|
||||
settings = {
|
||||
add_newline = false; # Don't print new line at the start of the prompt
|
||||
format = lib.concatStrings [
|
||||
"$directory"
|
||||
"$git_branch"
|
||||
"$git_commit"
|
||||
"$git_status"
|
||||
"$python"
|
||||
"$cmd_duration"
|
||||
"$character"
|
||||
];
|
||||
character = {
|
||||
success_symbol = "[❯](bold green)";
|
||||
error_symbol = "[❯](bold red)";
|
||||
vicmd_symbol = "[❮](bold green)";
|
||||
};
|
||||
cmd_duration = {
|
||||
min_time = 5000;
|
||||
show_notifications = true;
|
||||
min_time_to_notify = 30000;
|
||||
format = "[$duration]($style) ";
|
||||
};
|
||||
directory = {
|
||||
truncate_to_repo = true;
|
||||
truncation_length = 100;
|
||||
};
|
||||
git_branch = { format = "[$symbol$branch]($style)"; };
|
||||
git_commit = {
|
||||
format = "( @ [$hash]($style) )";
|
||||
only_detached = false;
|
||||
};
|
||||
git_status = {
|
||||
format = "([$all_status$ahead_behind]($style) )";
|
||||
conflicted = "=";
|
||||
ahead = "⇡";
|
||||
behind = "⇣";
|
||||
diverged = "⇕";
|
||||
untracked = "⋄";
|
||||
stashed = "⩮";
|
||||
modified = "∽";
|
||||
staged = "+";
|
||||
renamed = "»";
|
||||
deleted = "✘";
|
||||
style = "red";
|
||||
};
|
||||
python = { format = "[\\($virtualenv\\)]($style)"; };
|
||||
};
|
||||
};
|
||||
|
||||
}
|
@ -35,6 +35,8 @@ in {
|
||||
# pass
|
||||
];
|
||||
|
||||
programs.zoxide.enable = true; # Shortcut jump command
|
||||
|
||||
home.file = {
|
||||
".rgignore".text = ignorePatterns;
|
||||
".fdignore".text = ignorePatterns;
|
||||
|
@ -1,57 +0,0 @@
|
||||
# Don't print a new line at the start of the prompt
|
||||
add_newline = false
|
||||
format = """\
|
||||
$directory\
|
||||
$git_branch\
|
||||
$git_commit\
|
||||
$git_status\
|
||||
$python\
|
||||
$character\
|
||||
"""
|
||||
|
||||
[character]
|
||||
success_symbol = "[❯](bold green)"
|
||||
error_symbol = "[❯](bold red)"
|
||||
vicmd_symbol = "[❮](bold green)"
|
||||
|
||||
[cmd_duration]
|
||||
min_time = 3_000
|
||||
show_notifications = true
|
||||
min_time_to_notify = 30_000
|
||||
format = "[$duration]($style) "
|
||||
|
||||
[directory]
|
||||
truncate_to_repo = true
|
||||
truncation_length = 100
|
||||
|
||||
[git_branch]
|
||||
format = "[$symbol$branch]($style)"
|
||||
|
||||
[git_commit]
|
||||
format = "( @ [$hash]($style) )"
|
||||
only_detached = false
|
||||
|
||||
[git_status]
|
||||
format = "([$all_status$ahead_behind]($style) )"
|
||||
conflicted = "="
|
||||
ahead = "⇡"
|
||||
behind = "⇣"
|
||||
diverged = "⇕"
|
||||
untracked = "⋄"
|
||||
stashed = "⩮"
|
||||
modified = "∽"
|
||||
staged = "+"
|
||||
renamed = "»"
|
||||
deleted = "✘"
|
||||
style = "red"
|
||||
|
||||
[python]
|
||||
symbol = ""
|
||||
format = '[\($virtualenv\)]($style)'
|
||||
|
||||
[custom.virtualenv]
|
||||
command = "echo (basename $VIRTUAL_ENV)" # shows output of command
|
||||
format = "[$output]($style) "
|
||||
when = "true"
|
||||
# prefix = "("
|
||||
# suffix = ") "
|
Loading…
Reference in New Issue
Block a user