nix/roles/base.nix
2020-08-29 16:52:59 +02:00

92 lines
1.8 KiB
Nix

{ config, lib, pkgs, ... }:
let
unstable = import <nixos-unstable> {};
in {
environment.systemPackages = with pkgs; [
bash
bat
direnv
fd
fzf
git
gnupg
htop
jq
ncdu
openssl
ripgrep
tmux
z-lua
unstable.starship
(import ../packages/neovim.nix)
];
environment = {
etc = {
"starship.toml".source = ../dotfiles/starship.toml;
};
};
programs.bash = {
promptInit = ''
. <(starship init bash)
'';
interactiveShellInit = ''
export EDITOR=nvim
export STARSHIP_CONFIG=/etc/starship.toml
if [ -z "$SSH_AUTH_SOCK" ]; then
eval $(ssh-agent)
fi
set_win_title() {
echo -ne "\033]0;$USER@$HOSTNAME: $PWD\007"
}
starship_precmd_user_func=set_win_title
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
precmd_user_func = "title"
cd $gitroot
else
echo "gitroot not found."
return 1
fi
}
. "$(fzf-share)/key-bindings.bash"
. "$(fzf-share)/completion.bash"
. <(z --init bash)
. <(direnv hook 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 timestamp_timeout=5
Defaults env_keep+=SSH_AUTH_SOCK
'';
services.resolved.enable = true;
services.lorri.enable = true;
}