Last active
June 27, 2023 03:40
-
-
Save PardusEidolon/6e419818e4ddd55b8203353a512898e8 to your computer and use it in GitHub Desktop.
My home-manager configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, pkgs, lib, ... }: | |
let | |
git_username = "<uname_here>"; | |
git_useremail = "<git_email_here>"; | |
git_signing_key = "<key_here>"; | |
in { | |
# Home Manager needs a bit of information about you and the paths it should manage. | |
programs.home-manager.enable = true; | |
# Don't touch this unless you need to when updating or the channel switches | |
home.stateVersion = "23.05"; | |
# home-manager manual fails to evaluate: https://github.com/NixOS/nixpkgs/issues/196651 | |
manual.manpages.enable = false; | |
# Packages that should be installed to the user profile. | |
home.packages = with pkgs;[ | |
exa | |
nix-prefetch-git | |
ffmpeg | |
zoxide | |
fzf | |
niv | |
glow | |
jq | |
niv | |
httplz | |
httpie | |
pinentry | |
gh | |
ripgrep | |
bottom | |
gping | |
wget | |
pre-commit | |
yubikey-personalization | |
m-cli | |
postgresql | |
]; | |
# Programs | |
# ============= | |
# this is actually another alternative to installing packages into your profile. | |
# you will get conflicts if you decide to place the program your configuring in | |
# the packages list so choose one or the other. | |
# Configure bat | |
programs.bat = { | |
enable = true; | |
config = { | |
theme = "Dracula"; | |
}; | |
}; | |
# Configure neovim | |
programs.neovim = { | |
enable = true; | |
viAlias = true; | |
defaultEditor = true; | |
plugins = with pkgs.vimPlugins; [ | |
vim-scriptease | |
nvim-fzf | |
nerdtree | |
]; | |
extraConfig = '' | |
nnoremap <C-p> :<C-u>FZF<CR> | |
nnoremap <C-t> :<C-u>NERDTree<CR> | |
set number | |
set autoindent | |
set expandtab | |
set shiftwidth=2 | |
set smarttab | |
set tabstop=2 | |
''; | |
}; | |
# Configure zsh | |
programs.zsh = { | |
enable = true; | |
enableCompletion = true; | |
history = { | |
path = "$HOME/.config/zsh/.zsh_history"; | |
size = 50000; | |
save = 50000; | |
}; | |
# Environment variables everytime we load a shell | |
sessionVariables = { | |
LC_CTYPE = "en_US.UTF-8"; | |
}; | |
# Useful for shorthands for common system operations | |
shellAliases = { | |
ls = "${pkgs.exa}/bin/exa -galFh --git"; | |
ds = "darwin-rebuild switch"; | |
gc = "nix-collect-garbage"; | |
}; | |
# Initialising the profile with nix env vars and adding daedalus o PATh | |
profileExtra = '' | |
eval "$(zoxide init zsh)" | |
''; | |
initExtra = '' | |
autoload -U promptinit && promptinit | |
# Integrate the prompt with git | |
autoload -Uz vcs_info | |
precmd_vcs_info() { vcs_info } | |
precmd_functions+=( precmd_vcs_info ) | |
setopt prompt_subst | |
# Default prompt | |
PROMPT='%F{green}%2~%f %# ' | |
RPROMPT=\$vcs_info_msg_0_ | |
# Set the Right-handside prompt with git info | |
zstyle ':vcs_info:git:*' formats '%F{240}(%b)%r%f' | |
zstyle ':vcs_info:*' enable git | |
''; | |
}; | |
# Direnv, load and unload environment variables depending on the current directory. | |
# https://direnv.net | |
programs.direnv.enable = true; | |
programs.direnv.nix-direnv.enable = true; | |
# Configure the dotfiles for GPG under $HOME/.gnupg/ | |
programs.gpg.enable = true; | |
# Configures the Yubikey and scdamon when NOT using GPGTools/MacGPG2. The 23 Nixpkgs build | |
# is broken, therefore disable-ccid is needed. See: | |
# | |
# 1. pkgs.gnupg https://github.com/NixOS/nixpkgs/issues/155629 | |
# 2. OSX BigSur: https://www.chrisdeluca.me/article/fixing-gpg-yubikey-macos-big-sur/ | |
# 3. For PIN Entry: https://github.com/NixOS/nixpkgs/issues/145392 | |
programs.gpg.scdaemonSettings = { | |
disable-ccid = true; | |
reader-port = "Yubico YubiKey OTP+FIDO+CCID"; | |
}; | |
# Git configuration see https://rycee.gitlab.io/home-manager/options.html#opt-programs.git.enable | |
programs.git = { | |
enable = true; | |
userName = git_username; | |
userEmail = git_useremail; | |
signing.key = git_signing_key; | |
signing.signByDefault = true; | |
signing.gpgPath = "/usr/local/MacGPG2/bin/gpg2"; | |
ignores = [ ".envrc" ".DS_Store" ]; | |
attributes = []; | |
aliases = { | |
amend = "commit --amend -C HEAD"; | |
authors = "!\"${pkgs.git}/bin/git log --pretty=format:%aN" | |
+ " | ${pkgs.coreutils}/bin/sort" | |
+ " | ${pkgs.coreutils}/bin/uniq -c" | |
+ " | ${pkgs.coreutils}/bin/sort -rn\""; | |
cm = "commit -m"; | |
lg = "log --graph"; | |
ls = "log --oneline"; | |
cb = "checkout -b"; | |
cob = "checkout --orphan -b"; | |
pf = "push -f"; | |
}; | |
diff-so-fancy.enable = true; | |
extraConfig = { | |
init = { defaultBranch = "main";}; | |
rebase = { autosquash = true; }; | |
core = { editor = "code --wait"; }; | |
url = { "git@github.com:" = { insteadOf = "https://github.com/"; }; }; | |
pull = { rebase = true; }; | |
color = { status = "always"; }; | |
github.user = git_username; | |
credential.helper = "osxkeychain"; | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment