nix/roles/base.nix
2020-06-13 23:20:39 +02:00

80 lines
1.5 KiB
Nix

{ config, lib, pkgs, ... }:
let
unstable = import <nixos-unstable> {};
in {
environment.systemPackages = with pkgs; [
bash
bat
emacs-nox
fd
fzf
git
gnupg
htop
jq
ncdu
ripgrep
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
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
}
. "$(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
'';
}