nix-infra/common/home_manager/common.nix

181 lines
5.3 KiB
Nix

{ pkgs, config, lib, ... }: {
imports = [ ../../common/home_manager/helix.nix ];
home-manager.useGlobalPkgs = true;
home-manager.users.agatha = {
home.username = "agatha";
home.homeDirectory = "/home/agatha";
home.stateVersion = config.system.stateVersion;
home.packages = with pkgs; [
bat
btop
choose
exa
fd
fzf
gnupg
ouch
ripgrep
tealdeer
zoxide
];
programs = {
home-manager.enable = true;
git = {
enable = true;
userName = "Agatha V. Lovelace";
userEmail = "agatha@technogothic.net";
signing.key = "33185E0D62AD7294379947D4C37ABADDB597BCA1";
signing.signByDefault = true;
aliases = {
plog =
"log --graph --pretty=format:'%h -%d %s -%an %n' --abbrev-commit --date=relative --branches";
pfusch = "push --force-with-lease";
stat = "diff --compact-summary";
undo = "reset --soft HEAD~";
unstage = "restore --staged";
};
extraConfig = {
init = { defaultBranch = "mistress"; };
core = { editor = "hx"; };
rebase.autosquash = true;
pull.rebase = true;
};
};
starship = {
enable = true;
settings = {
add_newline = false;
format = lib.concatStrings [
"[$hostname](bold red)"
"$character"
"$directory"
];
right_format =
lib.concatStrings [ "$git_branch" " " "$cmd_duration" ];
character = {
success_symbol = "";
error_symbol = "[ ](purple)";
};
directory = {
truncation_length = 2;
fish_style_pwd_dir_length = 1;
read_only = " ";
style = "cyan";
read_only_style = "cyan";
};
cmd_duration = { min_time = 10000; };
git_branch = {
format = "$symbol $branch";
symbol = "";
};
hostname = {
ssh_only = false;
format = "$hostname";
};
};
};
fish = {
enable = true;
plugins = [
{
name = "fzf";
src = pkgs.fetchFromGitHub {
owner = "jethrokuan";
repo = "fzf";
rev = "479fa67d7439b23095e01b64987ae79a91a4e283";
sha256 = "0k6l21j192hrhy95092dm8029p52aakvzis7jiw48wnbckyidi6v";
};
}
{
name = "pisces";
src = pkgs.fetchFromGitHub {
owner = "laughedelic";
repo = "pisces";
rev = "e45e0869855d089ba1e628b6248434b2dfa709c4";
sha256 = "073wb83qcn0hfkywjcly64k6pf0d7z5nxxwls5sa80jdwchvd2rs";
};
}
];
functions = {
expand-dot-to-parent-directory-path = ''
# expand ... to ../.. etc
# https://github.com/fish-shell/fish-shell/issues/1891#issuecomment-451961517
# Get commandline up to cursor
set -l cmd (commandline --cut-at-cursor)
# Match last line
switch $cmd[-1]
case '*..'
commandline --insert '/.'
case '*'
commandline --insert '.'
end
'';
impostor = ''
echo $argv[1] | string sub -s 13 | fold -w1 | shuf | tr -d '\n' | sed 's/^/cccccbeujtje/'
'';
};
shellInit = ''
set -Ux AWT_TOOLKIT MToolkit
set -Ux JDK_JAVA_OPTIONS "-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Djdk.gtk.version=3 -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true"
# Zoxide
set -Ux _ZO_FZF_OPTS "--no-sort --height=30% --exit-0 --select-1 --bind=ctrl-z:ignore"
# Fix locale errors in Nix
set -Ux LOCALE_ARCHIVE /usr/lib/locale/locale-archive
# PATH
set -gx fish_user_paths $fish_user_paths \
/home/agatha/.local/bin \
/home/agatha/.cargo/bin \
/home/agatha/.cabal/bin
if type -q ruby
fish_add_path -a (ruby -e 'print Gem.user_dir')/bin
end
# Aliases
alias cat bat
alias ip 'ip -color=always'
alias youtube-dl-audio 'yt-dlp --ignore-errors --output "%(title)s.%(ext)s" --extract-audio --audio-format best'
alias rsync 'rsync -az --partial --info=progress2'
bind . 'expand-dot-to-parent-directory-path'
if test -d ~/.gnupg
set -e SSH_AGENT_PID
set -x SSH_AUTH_SOCK (gpgconf --list-dirs agent-ssh-socket)
# so gpg-agent knows in what tty to prompt for key passwords
set -x GPG_TTY (tty)
gpg-connect-agent updatestartuptty /bye > /dev/null
end
'';
interactiveShellInit = ''
if type -q exa
alias ls 'exa -lFhT --group-directories-first --level 1'
end
if type -q zoxide
zoxide init --cmd v fish | source
end
'';
};
command-not-found.enable = false;
nix-index = {
enable = true;
enableFishIntegration = true;
};
};
};
}