🐟 shell

This commit is contained in:
Andrea Ciceri 2023-10-22 10:15:46 +02:00
parent c8bd8acd8b
commit 19f999514e
Signed by: aciceri
SSH key fingerprint: SHA256:/AagBweyV4Hlfg9u092n8hbHwD5fcB6A3qhDiDA65Rg
2 changed files with 169 additions and 137 deletions

View file

@ -15,157 +15,188 @@
nix-direnv.enable = true; nix-direnv.enable = true;
}; };
programs.exa = { # programs.exa = {
enable = true; # enable = false;
enableAliases = true; # enableAliases = true;
}; # };
programs.fzf.enable = true; # programs.fzf.enable = false;
programs.vim.enable = true; programs.vim.enable = true;
programs.command-not-found.enable = true; programs.ssh = {
programs.starship = {
enable = true; enable = true;
settings = { controlMaster = "auto";
character = { controlPersist = "10m";
success_symbol = "[👌](bold green)";
error_symbol = "[🤌](bold red)";
};
nix_shell = {
symbol = " ";
};
};
}; };
# programs.starship = {
# enable = false;
# settings = {
# character = {
# success_symbol = "[👌](bold green)";
# error_symbol = "[🤌](bold red)";
# };
# nix_shell = {
# symbol = "❄ ";
# };
# };
# };
# Playing with it sometimes # Playing with it sometimes
programs.nushell = { # programs.nushell = {
enable = false; # enable = false;
configFile.text = '' # configFile.text = ''
let carapace_completer = {|spans| # let carapace_completer = {|spans|
carapace $spans.0 nushell $spans | from json # carapace $spans.0 nushell $spans | from json
} # }
let-env config = { # let-env config = {
show_banner: false # show_banner: false
ls: { # ls: {
use_ls_colors: true # use the LS_COLORS environment variable to colorize output # use_ls_colors: true # use the LS_COLORS environment variable to colorize output
clickable_links: true # enable or disable clickable links. Your terminal has to support links. # clickable_links: true # enable or disable clickable links. Your terminal has to support links.
} # }
rm: { # rm: {
always_trash: true # always act as if -t was given. Can be overridden with -p # always_trash: true # always act as if -t was given. Can be overridden with -p
} # }
cd: { # cd: {
abbreviations: true # allows `cd s/o/f` to expand to `cd some/other/folder` # abbreviations: true # allows `cd s/o/f` to expand to `cd some/other/folder`
} # }
table: { # table: {
mode: compact # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other # mode: compact # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other
index_mode: always # "always" show indexes, "never" show indexes, "auto" = show indexes when a table has "index" column # index_mode: always # "always" show indexes, "never" show indexes, "auto" = show indexes when a table has "index" column
trim: { # trim: {
methodology: wrapping # wrapping or truncating # methodology: wrapping # wrapping or truncating
wrapping_try_keep_words: true # A strategy used by the 'wrapping' methodology # wrapping_try_keep_words: true # A strategy used by the 'wrapping' methodology
truncating_suffix: "..." # A suffix used by the 'truncating' methodology # truncating_suffix: "..." # A suffix used by the 'truncating' methodology
} # }
} # }
history: { # history: {
max_size: 10000 # Session has to be reloaded for this to take effect # max_size: 10000 # Session has to be reloaded for this to take effect
sync_on_enter: true # Enable to share history between multiple sessions, else you have to close the session to write history to file # sync_on_enter: true # Enable to share history between multiple sessions, else you have to close the session to write history to file
file_format: "plaintext" # "sqlite" or "plaintext" # file_format: "plaintext" # "sqlite" or "plaintext"
} # }
completions: { # completions: {
case_sensitive: false # set to true to enable case-sensitive completions # case_sensitive: false # set to true to enable case-sensitive completions
quick: true # set this to false to prevent auto-selecting completions when only one remains # quick: true # set this to false to prevent auto-selecting completions when only one remains
partial: true # set this to false to prevent partial filling of the prompt # partial: true # set this to false to prevent partial filling of the prompt
algorithm: "fuzzy" # prefix or fuzzy # algorithm: "fuzzy" # prefix or fuzzy
external: { # external: {
enable: true # set to false to prevent nushell looking into $env.PATH to find more suggestions, `false` recommended for WSL users as this look up my be very slow # enable: true # set to false to prevent nushell looking into $env.PATH to find more suggestions, `false` recommended for WSL users as this look up my be very slow
max_results: 100 # setting it lower can improve completion performance at the cost of omitting some options # max_results: 100 # setting it lower can improve completion performance at the cost of omitting some options
completer: $carapace_completer # check 'carapace_completer' above as an example # completer: $carapace_completer # check 'carapace_completer' above as an example
} # }
} # }
filesize: { # filesize: {
metric: true # true => KB, MB, GB (ISO standard), false => KiB, MiB, GiB (Windows standard) # metric: true # true => KB, MB, GB (ISO standard), false => KiB, MiB, GiB (Windows standard)
format: "auto" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, zb, zib, auto # format: "auto" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, zb, zib, auto
} # }
buffer_editor: "${config.programs.helix.package}/bin/helix" # buffer_editor: "${config.programs.helix.package}/bin/helix"
} # }
''; # '';
# };
xdg.configFile."dracula-theme" = {
target = "fish/themes/dracula.theme";
source = let
theme = pkgs.fetchFromGitHub {
owner = "dracula";
repo = "fish";
rev = "269cd7d76d5104fdc2721db7b8848f6224bdf554";
hash = "sha256-Hyq4EfSmWmxwCYhp3O8agr7VWFAflcUe8BUKh50fNfY=";
};
in "${theme}/themes/Dracula\ Official.theme";
}; };
programs.zsh = { programs.fish = {
enable = true; enable = true;
enableAutosuggestions = true; loginShellInit = ''
enableCompletion = true; if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]
enableSyntaxHighlighting = true; exec dbus-run-session Hyprland
enableVteIntegration = true; end
autocd = true; fish_config theme choose "dracula"
oh-my-zsh = { export CACHIX_AUTH_TOKEN=$(cat ${age.secrets.cachix-personal-token.path})
enable = true; '';
plugins = [
"ag"
"cabal"
"colored-man-pages"
"colorize"
"command-not-found"
"fzf"
"git"
"nomad"
"pass"
"python"
"sudo"
"terraform"
"thefuck"
];
};
plugins = [
{
name = "fzf-tab";
src = pkgs.fetchFromGitHub {
owner = "Aloxaf";
repo = "fzf-tab";
rev = "c2b4aa5ad2532cca91f23908ac7f00efb7ff09c9";
sha256 = "sha256-gvZp8P3quOtcy1Xtt1LAW1cfZ/zCtnAmnWqcwrKel6w=";
};
}
{
name = "fzf-tab";
src = pkgs.fetchFromGitHub {
owner = "Aloxaf";
repo = "fzf-tab";
rev = "c2b4aa5ad2532cca91f23908ac7f00efb7ff09c9";
sha256 = "sha256-gvZp8P3quOtcy1Xtt1LAW1cfZ/zCtnAmnWqcwrKel6w=";
};
}
{
name = "fast-syntax-highlighting";
src = pkgs.fetchFromGitHub {
owner = "zdharma-continuum";
repo = "fast-syntax-highlighting";
rev = "13d7b4e63468307b6dcb2dadf6150818f242cbff";
sha256 = "sha256-AmsexwVombgVmRvl4O9Kd/WbnVJHPTXETxBv18PDHz4=";
};
}
];
shellAliases = { shellAliases = {
"cat" = "bat"; "cat" = "bat";
"em" = "TERM=wezterm emacsclient -nw"; "em" = "TERM=wezterm emacsclient -nw";
}; };
loginExtra = "[[ -z $DISPLAY && $TTY = /dev/tty1 ]] && exec dbus-run-session Hyprland";
envExtra = ''
# [ $TERM = "dumb" ] && unsetopt zle && PS1='$ ' # for Emacs TRAMP mode
'';
initExtra = ''
export CACHIX_AUTH_TOKEN=$(cat ${age.secrets.cachix-personal-token.path})
# Don't enable VIM emulation when in Emacs
[[ -z $INSIDE_EMACS ]] && source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh
# When enabling starship, home-manager add an `initExtra` rule to disable it when in Emacs but not with VTerm,
# since I use also `eat` besides `vterm` the following line is needed
[[ "$INSIDE_EMACS" =~ "eat" ]] && eval "$(${config.home.profileDirectory}/bin/starship init zsh)"
'';
}; };
# programs.zsh = {
# enable = false; # Playing xswith fish at the moment
# enableAutosuggestions = true;
# enableCompletion = true;
# enableSyntaxHighlighting = true;
# enableVteIntegration = true;
# autocd = true;
# oh-my-zsh = {
# enable = true;
# plugins = [
# "ag"
# "cabal"
# "colored-man-pages"
# "colorize"
# "command-not-found"
# "fzf"
# "git"
# "nomad"
# "pass"
# "python"
# "sudo"
# "terraform"
# "thefuck"
# ];
# };
# plugins = [
# {
# name = "fzf-tab";
# src = pkgs.fetchFromGitHub {
# owner = "Aloxaf";
# repo = "fzf-tab";
# rev = "c2b4aa5ad2532cca91f23908ac7f00efb7ff09c9";
# sha256 = "sha256-gvZp8P3quOtcy1Xtt1LAW1cfZ/zCtnAmnWqcwrKel6w=";
# };
# }
# {
# name = "fzf-tab";
# src = pkgs.fetchFromGitHub {
# owner = "Aloxaf";
# repo = "fzf-tab";
# rev = "c2b4aa5ad2532cca91f23908ac7f00efb7ff09c9";
# sha256 = "sha256-gvZp8P3quOtcy1Xtt1LAW1cfZ/zCtnAmnWqcwrKel6w=";
# };
# }
# {
# name = "fast-syntax-highlighting";
# src = pkgs.fetchFromGitHub {
# owner = "zdharma-continuum";
# repo = "fast-syntax-highlighting";
# rev = "13d7b4e63468307b6dcb2dadf6150818f242cbff";
# sha256 = "sha256-AmsexwVombgVmRvl4O9Kd/WbnVJHPTXETxBv18PDHz4=";
# };
# }
# ];
# shellAliases = {
# "cat" = "bat";
# "em" = "TERM=wezterm emacsclient -nw";
# };
# loginExtra = "[[ -z $DISPLAY && $TTY = /dev/tty1 ]] && exec dbus-run-session Hyprland";
# envExtra = ''
# # [ $TERM = "dumb" ] && unsetopt zle && PS1='$ ' # for Emacs TRAMP mode
# '';
# initExtra = ''
# export CACHIX_AUTH_TOKEN=$(cat ${age.secrets.cachix-personal-token.path})
# # Don't enable VIM emulation when in Emacs
# [[ -z $INSIDE_EMACS ]] && source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh
# # When enabling starship, home-manager add an `initExtra` rule to disable it when in Emacs but not with VTerm,
# # since I use also `eat` besides `vterm` the following line is needed
# [[ "$INSIDE_EMACS" =~ "eat" ]] && eval "$(${config.home.profileDirectory}/bin/starship init zsh)"
# '';
# };
home.packages = with pkgs; [ home.packages = with pkgs; [
thefuck thefuck
htop-vim htop-vim

View file

@ -14,7 +14,7 @@
modules = lib.mkOption { modules = lib.mkOption {
type = with lib.types; listOf str; type = with lib.types; listOf str;
default = ["shell" "git" "nix-index"]; default = [];
}; };
packages = lib.mkOption { packages = lib.mkOption {
@ -45,6 +45,7 @@
config = lib.mkIf config.ccr.enable { config = lib.mkIf config.ccr.enable {
ccr.extraGroups = ["wheel" "fuse" "networkmanager" "dialout"]; ccr.extraGroups = ["wheel" "fuse" "networkmanager" "dialout"];
ccr.modules = ["shell" "git" "nix-index"];
users.users.ccr = { users.users.ccr = {
uid = 1000; uid = 1000;
@ -52,11 +53,11 @@
description = "Andrea Ciceri"; description = "Andrea Ciceri";
isNormalUser = true; isNormalUser = true;
inherit (config.ccr) extraGroups; inherit (config.ccr) extraGroups;
shell = pkgs.zsh; shell = pkgs.fish;
openssh.authorizedKeys.keys = config.ccr.authorizedKeys; openssh.authorizedKeys.keys = config.ccr.authorizedKeys;
}; };
programs.zsh.enable = true; programs.fish.enable = true;
services.getty.autologinUser = services.getty.autologinUser =
if config.ccr.autologin if config.ccr.autologin