2024-11-15 22:00:01 -09:00
|
|
|
{
|
|
|
|
|
config,
|
|
|
|
|
pkgs,
|
|
|
|
|
username,
|
|
|
|
|
nix-index-database,
|
|
|
|
|
lib,
|
|
|
|
|
homeDirectory,
|
|
|
|
|
...
|
|
|
|
|
}: let
|
|
|
|
|
unstable-packages = with pkgs.unstable; [
|
|
|
|
|
coreutils
|
|
|
|
|
curl
|
|
|
|
|
findutils
|
|
|
|
|
git
|
|
|
|
|
git-crypt
|
|
|
|
|
jq
|
|
|
|
|
killall
|
|
|
|
|
tmux
|
|
|
|
|
unzip
|
|
|
|
|
vim
|
|
|
|
|
wget
|
|
|
|
|
zip
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
stable-packages = with pkgs; [
|
|
|
|
|
rustup
|
|
|
|
|
go
|
|
|
|
|
nodejs
|
|
|
|
|
python3
|
2026-05-08 20:38:37 -08:00
|
|
|
clojure
|
2024-11-15 22:00:01 -09:00
|
|
|
alejandra # nix formatter
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
dir = builtins.toString ../../keys/known_hosts;
|
|
|
|
|
files = builtins.attrNames (builtins.readDir dir);
|
2024-11-16 00:04:48 -09:00
|
|
|
pubKeys = map (file: builtins.readFile (dir + "/" + file)) files;
|
2024-11-15 22:00:01 -09:00
|
|
|
joinedString = lib.concatStringsSep " " pubKeys;
|
|
|
|
|
in {
|
|
|
|
|
imports = [
|
2026-05-04 06:09:38 -08:00
|
|
|
nix-index-database.homeModules.nix-index
|
2024-11-15 22:00:01 -09:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
home = {
|
|
|
|
|
stateVersion = "22.11";
|
|
|
|
|
username = lib.mkDefault "${username}";
|
|
|
|
|
homeDirectory = homeDirectory;
|
|
|
|
|
|
|
|
|
|
sessionVariables.EDITOR = "vim";
|
|
|
|
|
sessionVariables.SHELL = "/etc/profiles/per-user/${username}/bin/zsh";
|
|
|
|
|
|
2026-05-08 21:27:42 -08:00
|
|
|
packages = stable-packages ++ unstable-packages;
|
2024-11-15 22:00:01 -09:00
|
|
|
|
2026-05-08 20:47:38 -08:00
|
|
|
file.".ssh/known_hosts" = {
|
|
|
|
|
text = joinedString;
|
|
|
|
|
force = true;
|
|
|
|
|
};
|
2024-11-15 22:00:01 -09:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
programs = {
|
|
|
|
|
home-manager.enable = true;
|
|
|
|
|
nix-index.enable = true;
|
|
|
|
|
nix-index.enableZshIntegration = true;
|
|
|
|
|
nix-index-database.comma.enable = true;
|
|
|
|
|
|
|
|
|
|
# FIXME: disable this if you don't want to use the starship prompt
|
|
|
|
|
starship.enable = true;
|
|
|
|
|
starship.settings = {
|
|
|
|
|
aws.disabled = true;
|
|
|
|
|
gcloud.disabled = true;
|
|
|
|
|
kubernetes.disabled = false;
|
|
|
|
|
git_branch.style = "242";
|
|
|
|
|
directory.style = "blue";
|
|
|
|
|
directory.truncate_to_repo = false;
|
|
|
|
|
directory.truncation_length = 8;
|
|
|
|
|
python.disabled = true;
|
|
|
|
|
ruby.disabled = true;
|
|
|
|
|
hostname.ssh_only = false;
|
|
|
|
|
hostname.style = "bold green";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# FIXME: disable whatever you don't want
|
|
|
|
|
fzf.enable = true;
|
|
|
|
|
fzf.enableZshIntegration = true;
|
|
|
|
|
lsd.enable = true;
|
|
|
|
|
lsd.enableAliases = true;
|
|
|
|
|
zoxide.enable = true;
|
|
|
|
|
zoxide.enableZshIntegration = true;
|
|
|
|
|
broot.enable = true;
|
|
|
|
|
broot.enableZshIntegration = true;
|
|
|
|
|
|
|
|
|
|
direnv.enable = true;
|
|
|
|
|
direnv.enableZshIntegration = true;
|
|
|
|
|
direnv.nix-direnv.enable = true;
|
|
|
|
|
|
|
|
|
|
git = {
|
|
|
|
|
enable = true;
|
|
|
|
|
package = pkgs.unstable.git;
|
|
|
|
|
delta.enable = true;
|
|
|
|
|
delta.options = {
|
|
|
|
|
line-numbers = true;
|
|
|
|
|
side-by-side = true;
|
|
|
|
|
navigate = true;
|
|
|
|
|
};
|
|
|
|
|
userEmail = "1326208+philip-peterson@users.noreply.github.com";
|
|
|
|
|
userName = "philip-peterson";
|
|
|
|
|
extraConfig = {
|
|
|
|
|
push = {
|
|
|
|
|
default = "current";
|
|
|
|
|
autoSetupRemote = true;
|
|
|
|
|
};
|
|
|
|
|
merge = {
|
|
|
|
|
conflictstyle = "diff3";
|
|
|
|
|
};
|
|
|
|
|
diff = {
|
|
|
|
|
colorMoved = "default";
|
|
|
|
|
};
|
|
|
|
|
safe = {
|
|
|
|
|
directory = "/var/petersweb-infra";
|
|
|
|
|
};
|
|
|
|
|
};
|
2026-05-28 22:17:24 -08:00
|
|
|
includes = [{path = toString ../../gitconfig;}];
|
2024-11-15 22:00:01 -09:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
zsh = {
|
|
|
|
|
enable = true;
|
|
|
|
|
autocd = true;
|
2026-05-04 06:09:38 -08:00
|
|
|
autosuggestion.enable = true;
|
2024-11-15 22:00:01 -09:00
|
|
|
enableCompletion = true;
|
|
|
|
|
defaultKeymap = "emacs";
|
|
|
|
|
history.size = 10000;
|
|
|
|
|
history.save = 10000;
|
|
|
|
|
history.expireDuplicatesFirst = true;
|
|
|
|
|
history.ignoreDups = true;
|
|
|
|
|
history.ignoreSpace = true;
|
|
|
|
|
historySubstringSearch.enable = true;
|
|
|
|
|
|
|
|
|
|
plugins = [
|
|
|
|
|
{
|
|
|
|
|
name = "fast-syntax-highlighting";
|
|
|
|
|
src = "${pkgs.zsh-fast-syntax-highlighting}/share/zsh/site-functions";
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
name = "zsh-nix-shell";
|
|
|
|
|
file = "nix-shell.plugin.zsh";
|
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
|
owner = "chisui";
|
|
|
|
|
repo = "zsh-nix-shell";
|
|
|
|
|
rev = "v0.5.0";
|
|
|
|
|
sha256 = "0za4aiwwrlawnia4f29msk822rj9bgcygw6a8a6iikiwzjjz0g91";
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
shellAliases = {
|
|
|
|
|
gc = "nix-collect-garbage --delete-old";
|
|
|
|
|
refresh = "source ~/.zshrc";
|
|
|
|
|
show_path = "echo $PATH | tr ':' '\n'";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
envExtra = ''
|
|
|
|
|
export PATH=$PATH:$HOME/.local/bin
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
initExtra = ''
|
2026-05-28 22:58:50 -08:00
|
|
|
${builtins.readFile ../../aliases.zsh}
|
2024-11-15 22:00:01 -09:00
|
|
|
bindkey '^p' history-search-backward
|
|
|
|
|
bindkey '^n' history-search-forward
|
|
|
|
|
bindkey '^e' end-of-line
|
|
|
|
|
bindkey '^w' forward-word
|
|
|
|
|
bindkey "^[[3~" delete-char
|
|
|
|
|
bindkey ";5C" forward-word
|
|
|
|
|
bindkey ";5D" backward-word
|
|
|
|
|
|
|
|
|
|
zstyle ':completion:*:*:*:*:*' menu select
|
|
|
|
|
|
|
|
|
|
# Complete . and .. special directories
|
|
|
|
|
zstyle ':completion:*' special-dirs true
|
|
|
|
|
|
|
|
|
|
zstyle ':completion:*' list-colors ""
|
|
|
|
|
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
|
|
|
|
|
|
|
|
|
|
# disable named-directories autocompletion
|
|
|
|
|
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
|
|
|
|
|
|
|
|
|
|
# Use caching so that commands like apt and dpkg complete are useable
|
|
|
|
|
zstyle ':completion:*' use-cache on
|
|
|
|
|
zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/.zcompcache"
|
|
|
|
|
|
|
|
|
|
# Don't complete uninteresting users
|
|
|
|
|
zstyle ':completion:*:*:*:users' ignored-patterns \
|
|
|
|
|
adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna \
|
|
|
|
|
clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm \
|
|
|
|
|
gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm \
|
|
|
|
|
ldap lp mail mailman mailnull man messagebus mldonkey mysql nagios \
|
|
|
|
|
named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \
|
|
|
|
|
operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \
|
|
|
|
|
rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \
|
|
|
|
|
usbmux uucp vcsa wwwrun xfs '_*'
|
|
|
|
|
# ... unless we really want to.
|
|
|
|
|
zstyle '*' single-ignored complete
|
|
|
|
|
|
|
|
|
|
# https://thevaluable.dev/zsh-completion-guide-examples/
|
|
|
|
|
zstyle ':completion:*' completer _extensions _complete _approximate
|
|
|
|
|
zstyle ':completion:*:descriptions' format '%F{green}-- %d --%f'
|
|
|
|
|
zstyle ':completion:*' group-name ""
|
|
|
|
|
zstyle ':completion:*:*:-command-:*:*' group-order alias builtins functions commands
|
|
|
|
|
zstyle ':completion:*' squeeze-slashes true
|
|
|
|
|
zstyle ':completion:*' matcher-list "" 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
|
|
|
|
|
|
|
|
|
# mkcd is equivalent to takedir
|
|
|
|
|
function mkcd takedir() {
|
|
|
|
|
mkdir -p $@ && cd ''${@:$#}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function takeurl() {
|
|
|
|
|
local data thedir
|
|
|
|
|
data="$(mktemp)"
|
|
|
|
|
curl -L "$1" > "$data"
|
|
|
|
|
tar xf "$data"
|
|
|
|
|
thedir="$(tar tf "$data" | head -n 1)"
|
|
|
|
|
rm "$data"
|
|
|
|
|
cd "$thedir"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function takegit() {
|
|
|
|
|
git clone "$1"
|
|
|
|
|
cd "$(basename ''${1%%.git})"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function take() {
|
|
|
|
|
if [[ $1 =~ ^(https?|ftp).*\.(tar\.(gz|bz2|xz)|tgz)$ ]]; then
|
|
|
|
|
takeurl "$1"
|
|
|
|
|
elif [[ $1 =~ ^([A-Za-z0-9]\+@|https?|git|ssh|ftps?|rsync).*\.git/?$ ]]; then
|
|
|
|
|
takegit "$1"
|
|
|
|
|
else
|
|
|
|
|
takedir "$@"
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WORDCHARS='*?[]~=&;!#$%^(){}<>'
|
|
|
|
|
|
|
|
|
|
# fixes duplication of commands when using tab-completion
|
|
|
|
|
export LANG=C.UTF-8
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
}
|