infrastructure/nixos/common/users/default.nix

72 lines
2 KiB
Nix
Raw Normal View History

2022-09-26 13:52:32 +02:00
{ config, pkgs, lib, inputs, ... }:
2021-10-13 18:17:45 +02:00
{
# Setup ZSH to use grml config
programs.zsh = {
enable = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
interactiveShellInit = ''
source "${pkgs.grml-zsh-config}/etc/zsh/zshrc"
2021-10-17 23:34:05 +02:00
export FZF_DEFAULT_COMMAND="${pkgs.ripgrep}/bin/rg --files --follow"
2021-10-13 18:17:45 +02:00
source "${pkgs.fzf}/share/fzf/key-bindings.zsh"
source "${pkgs.fzf}/share/fzf/completion.zsh"
eval "$(${pkgs.zoxide}/bin/zoxide init zsh)"
'';
# otherwise it'll override the grml prompt
promptInit = "";
};
2022-07-30 12:22:08 +02:00
2021-10-13 18:17:45 +02:00
environment.pathsToLink = [ "/share/zsh" ];
2021-11-03 00:52:39 +01:00
# Install Neovim and set it as alias for vi(m)
2022-08-30 22:38:00 +02:00
programs.neovim = {
enable = true;
viAlias = true;
};
2021-11-03 00:52:39 +01:00
2021-10-13 18:17:45 +02:00
# Disable sudo prompt for `wheel` users.
2022-08-30 22:38:00 +02:00
security.sudo.wheelNeedsPassword = lib.mkDefault false;
2021-10-13 18:17:45 +02:00
# The block that specifies my user account.
users.extraUsers.victor = {
# This account is intended for a non-system user.
isNormalUser = true;
# My default shell
shell = pkgs.zsh;
# My SSH keys.
openssh.authorizedKeys.keys = [
2022-08-20 11:51:40 +02:00
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKME+A5zu36tMIsY+PBoboizgAzt6xReUNrKRBkxvl3i victor@null"
2021-10-17 13:00:47 +02:00
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC8llUcEBHsLqotFZc++LNP2fjItuuzeUsu5ObXecYNj victor@eevee"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICBhJAp7NWlHgwDYd2z6VNROy5RkeZHRINFLsFvwT4b3 victor@bastion"
2022-07-30 12:22:08 +02:00
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIM3TqXaApX2JZsgfZd7PKVFMecDgqTHKibpSzgdXNpYAAAAABHNzaDo= solov2-le"
2021-10-13 18:17:45 +02:00
];
# Make me admin
2022-08-20 12:16:29 +02:00
extraGroups = [ "systemd-journal" "wheel" "networkmanager" ];
2021-10-13 18:17:45 +02:00
};
# Configure the root account
users.extraUsers.root = {
# Allow my SSH keys for logging in as root.
2022-07-30 23:35:52 +02:00
openssh.authorizedKeys.keys = config.users.extraUsers.victor.openssh.authorizedKeys.keys;
2021-10-13 18:17:45 +02:00
# Also use zsh for root
shell = pkgs.zsh;
};
# Setup packages available everywhere
2022-09-05 14:52:11 +02:00
environment.systemPackages = with pkgs; [
fzf
git
helix
htop
ncdu
ripgrep
rsync
zoxide
];
2021-10-13 18:17:45 +02:00
}