nix/roles/base.nix
2020-06-11 19:56:28 +02:00

77 lines
1.7 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
bash
bat
emacs-nox
fd
fzf
git
htop
jq
ripgrep
z-lua
(import ../packages/neovim.nix)
];
programs.bash = {
interactiveShellInit = ''
export EDITOR=nvim
if [ -z "$SSH_AUTH_SOCK" ]; then
eval $(ssh-agent)
fi
pw () {
len=''${1:-$(( $RANDOM % 24 + 8 ))}
tr -dc a-zA-Z0-9 < /dev/urandom | head -c $len
echo
}
cdg() {
gitroot=$(until [ -d .git ]; do [ "$PWD" == "/" ] && exit 1; cd ..; done; echo $PWD)
if [ $? == 0 ]; then
cd $gitroot
else
echo "gitroot not found."
return 1
fi
}
git_branch(){
branch=$(git branch 2> /dev/null) || exit 0
branch=$(sed -n '/^*/ s/* \(.*\)/\1/p' <<< $branch)
status=$(git status 2> /dev/null \
| grep -q "nothing to commit, working tree clean" || e cho -n '*')
echo "$branch$status "
}
. "$(fzf-share)/key-bindings.bash"
. "$(fzf-share)/completion.bash"
. <(z --init bash)
'';
shellAliases = {
cat = "bat -pp";
less = "bat -p";
ls = "ls --color=auto";
vim = "nvim";
};
};
users.users.stefan = {
extraGroups = [ "wheel" ];
home = "/home/stefan";
isNormalUser = true;
uid = 1000;
};
security.sudo.extraConfig = ''
Defaults env_keep+=SSH_AUTH_SOCK
'';
}