feat(shell): migrate to fish
This commit is contained in:
@@ -2,9 +2,6 @@
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
username,
|
||||
userfullname,
|
||||
useremail,
|
||||
...
|
||||
}:
|
||||
lib.my.makeSwitch {
|
||||
@@ -48,6 +45,10 @@ lib.my.makeSwitch {
|
||||
|
||||
programs.dconf.enable = true;
|
||||
|
||||
my.persist.homeDirs = [
|
||||
".local/share/zoxide"
|
||||
".config/television/cable"
|
||||
];
|
||||
my.hm = {
|
||||
home.packages = with pkgs; [
|
||||
lsd
|
||||
@@ -86,6 +87,12 @@ lib.my.makeSwitch {
|
||||
programs.television = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
programs.zoxide = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
xdg.configFile."fastfetch/config.jsonc".text = ''
|
||||
{
|
||||
|
||||
@@ -10,6 +10,8 @@ lib.my.makeSwitch {
|
||||
config' = {
|
||||
my.cli.shell = {
|
||||
zsh.enable = true;
|
||||
fish.enable = true;
|
||||
starship.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
56
modules/cli/shell/fish.nix
Normal file
56
modules/cli/shell/fish.nix
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
lib.my.makeSwitch {
|
||||
inherit config;
|
||||
default = true;
|
||||
optionName = "default fish settings";
|
||||
optionPath = [
|
||||
"cli"
|
||||
"shell"
|
||||
"fish"
|
||||
];
|
||||
config' = {
|
||||
my.persist.homeDirs = [
|
||||
".local/share/fish"
|
||||
];
|
||||
my.hm = {
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
plugins = [
|
||||
{
|
||||
name = "extract";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "hexclover";
|
||||
repo = "fish-extract-ng";
|
||||
tag = "v0.1";
|
||||
hash = "sha256-yef5NX4HdZ3ab/2AzNrvvhi0CbeTvXYKZmyH76gIpyk=";
|
||||
};
|
||||
}
|
||||
];
|
||||
shellAliases = {
|
||||
la = "lsd -lah";
|
||||
ls = "lsd";
|
||||
svim = "sudoedit";
|
||||
nf = "fastfetch";
|
||||
tmux = "tmux -T RGB,focus,overline,mouse,clipboard,usstyle";
|
||||
};
|
||||
interactiveShellInit = ''
|
||||
fish_vi_key_bindings
|
||||
source ${
|
||||
builtins.fetchurl {
|
||||
url = "https://raw.githubusercontent.com/folke/tokyonight.nvim/refs/tags/v4.14.1/extras/fish/tokyonight_storm.fish";
|
||||
sha256 = "0a2pg78k8cv0hx8p02lxnb7giblwn7z9hnb6i6mdx4w5lg4wfg40";
|
||||
}
|
||||
}
|
||||
'';
|
||||
functions = {
|
||||
fish_greeting = "";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
21
modules/cli/shell/starship.nix
Normal file
21
modules/cli/shell/starship.nix
Normal file
@@ -0,0 +1,21 @@
|
||||
{ config, lib, ... }:
|
||||
lib.my.makeSwitch {
|
||||
inherit config;
|
||||
optionName = "starship prompt";
|
||||
optionPath = [
|
||||
"cli"
|
||||
"shell"
|
||||
"starship"
|
||||
];
|
||||
config' = {
|
||||
my.hm = {
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
settings = lib.recursiveUpdate (with builtins; fromTOML (readFile ./starship-preset.toml)) {
|
||||
add_newline = false;
|
||||
nix_shell.disabled = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -14,84 +14,28 @@ lib.my.makeSwitch {
|
||||
"zsh"
|
||||
];
|
||||
config' = {
|
||||
my.persist.homeDirs = [ ".local/share/zoxide" ];
|
||||
my.hm =
|
||||
let
|
||||
stateHome = config.my.hm.xdg.stateHome;
|
||||
zsh-syntax-highlighting = pkgs.fetchFromGitHub {
|
||||
owner = "zsh-users";
|
||||
repo = "zsh-syntax-highlighting";
|
||||
rev = "0.8.0";
|
||||
hash = "sha256-iJdWopZwHpSyYl5/FQXEW7gl/SrKaYDEtTH9cGP7iPo=";
|
||||
};
|
||||
fzf-tab = pkgs.fetchFromGitHub {
|
||||
owner = "Aloxaf";
|
||||
repo = "fzf-tab";
|
||||
rev = "v1.2.0";
|
||||
hash = "sha256-q26XVS/LcyZPRqDNwKKA9exgBByE0muyuNb0Bbar2lY=";
|
||||
};
|
||||
in
|
||||
{
|
||||
my.hm = {
|
||||
home.packages = with pkgs; [
|
||||
fzf
|
||||
zoxide
|
||||
];
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
settings = lib.recursiveUpdate (with builtins; fromTOML (readFile ./starship-preset.toml)) {
|
||||
add_newline = false;
|
||||
custom = {
|
||||
jj = {
|
||||
ignore_timeout = true;
|
||||
description = "The current jj status";
|
||||
when = true;
|
||||
command = ''
|
||||
jj log --revisions @ --no-graph --ignore-working-copy --color always --limit 1 --template '
|
||||
separate(" ",
|
||||
" ",
|
||||
change_id.shortest(4),
|
||||
bookmarks,
|
||||
"|",
|
||||
concat(
|
||||
if(conflict, "💥"),
|
||||
if(divergent, "🚧"),
|
||||
if(hidden, "👻"),
|
||||
if(immutable, "🔒"),
|
||||
),
|
||||
raw_escape_sequence("\x1b[1;32m") ++ if(empty, "(empty)"),
|
||||
raw_escape_sequence("\x1b[1;32m") ++ coalesce(
|
||||
truncate_end(29, description.first_line(), "…"),
|
||||
"(no description set)",
|
||||
) ++ raw_escape_sequence("\x1b[0m"),
|
||||
)
|
||||
' || (starship module git_branch && starship module git_status)
|
||||
'';
|
||||
};
|
||||
};
|
||||
git_state.disabled = true;
|
||||
git_commit.disabled = true;
|
||||
git_metrics.disabled = true;
|
||||
git_branch.disabled = true;
|
||||
git_status.disabled = true;
|
||||
nix_shell.disabled = true;
|
||||
};
|
||||
};
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
dotDir = "${config.my.hm.xdg.configHome}/zsh";
|
||||
history = {
|
||||
path = "${stateHome}/zsh_history";
|
||||
path = "${config.my.hm.xdg.stateHome}/zsh_history";
|
||||
ignorePatterns = [
|
||||
"la"
|
||||
];
|
||||
};
|
||||
initContent = lib.mkAfter ''
|
||||
source ${fzf-tab}/fzf-tab.plugin.zsh
|
||||
|
||||
eval "$(zoxide init zsh)"
|
||||
source ${zsh-syntax-highlighting}/zsh-syntax-highlighting.plugin.zsh
|
||||
source ${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
'';
|
||||
autosuggestion.enable = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
plugins = [
|
||||
{
|
||||
name = "fzf-tab";
|
||||
src = pkgs.zsh-fzf-tab;
|
||||
file = "share/fzf-tab/fzf-tab.plugin.zsh";
|
||||
}
|
||||
];
|
||||
oh-my-zsh = {
|
||||
enable = true;
|
||||
theme = "gentoo";
|
||||
@@ -100,7 +44,6 @@ lib.my.makeSwitch {
|
||||
"git-extras"
|
||||
"extract"
|
||||
"sudo"
|
||||
"dotenv"
|
||||
];
|
||||
};
|
||||
shellAliases = {
|
||||
@@ -109,8 +52,15 @@ lib.my.makeSwitch {
|
||||
svim = "sudoedit";
|
||||
nf = "fastfetch";
|
||||
tmux = "tmux -T RGB,focus,overline,mouse,clipboard,usstyle";
|
||||
pastart = "pasuspender true";
|
||||
};
|
||||
|
||||
# https://wiki.nixos.org/wiki/Fish#Setting_fish_as_default_shell
|
||||
initContent = lib.mkBefore ''
|
||||
if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" ]]
|
||||
then
|
||||
exec fish -l
|
||||
fi
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -41,6 +41,43 @@ lib.my.makeHomeProgramConfig {
|
||||
};
|
||||
};
|
||||
home.packages = [ pkgs.lazyjj ];
|
||||
programs.starship = {
|
||||
settings = {
|
||||
custom = {
|
||||
jj = {
|
||||
ignore_timeout = true;
|
||||
description = "The current jj status";
|
||||
when = true;
|
||||
command = ''
|
||||
jj log --revisions @ --no-graph --ignore-working-copy --color always --limit 1 --template '
|
||||
separate(" ",
|
||||
" ",
|
||||
change_id.shortest(4),
|
||||
bookmarks,
|
||||
"|",
|
||||
concat(
|
||||
if(conflict, "💥"),
|
||||
if(divergent, "🚧"),
|
||||
if(hidden, "👻"),
|
||||
if(immutable, "🔒"),
|
||||
),
|
||||
raw_escape_sequence("\x1b[1;32m") ++ if(empty, "(empty)"),
|
||||
raw_escape_sequence("\x1b[1;32m") ++ coalesce(
|
||||
truncate_end(29, description.first_line(), "…"),
|
||||
"(no description set)",
|
||||
) ++ raw_escape_sequence("\x1b[0m"),
|
||||
)
|
||||
' || {starship module git_branch && starship module git_status}
|
||||
'';
|
||||
};
|
||||
};
|
||||
git_state.disabled = true;
|
||||
git_commit.disabled = true;
|
||||
git_metrics.disabled = true;
|
||||
git_branch.disabled = true;
|
||||
git_status.disabled = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user