nixos-hypervisor/services/minimalConfig/default.nix

125 lines
2.5 KiB
Nix
Raw Permalink Normal View History

{ config, pkgs, lib, inputs, modulesPath, ... }:
2024-09-09 10:48:56 +02:00
{
imports = [
./lxc.nix
./vm.nix
];
2024-09-09 10:48:56 +02:00
nix = {
settings.experimental-features = [ "nix-command" "flakes" ];
2024-10-13 12:59:53 +02:00
settings.trusted-users = [ "root" "@wheel" ];
2024-09-09 10:48:56 +02:00
};
networking = {
firewall = {
enable = true;
allowedTCPPorts = [ 22 9002 ];
};
};
time.timeZone = "Europe/Paris";
console.keyMap = "fr";
i18n.defaultLocale = "fr_FR.UTF-8";
environment.sessionVariables = rec {
TERM = "xterm-256color";
};
nix.gc = {
automatic = true;
2024-12-12 11:14:01 +01:00
dates = "daily";
options = "--delete-old";
2024-09-09 10:48:56 +02:00
};
security.sudo.wheelNeedsPassword = false;
users = {
users.tbarnouin = {
isNormalUser = true;
extraGroups = [ "wheel" ];
shell = pkgs.zsh;
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAxccGxdfOFXeEClqz3ULl94ubzaJnk4pUus+ek18G0B tbarnouin@nixos"
2024-10-23 18:11:37 +02:00
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICf1B0nxNMvPWSR9pStdtx2x6Iw+JUeCCt1CKWoD8dsr"
2024-09-09 10:48:56 +02:00
];
};
users.root = {
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAxccGxdfOFXeEClqz3ULl94ubzaJnk4pUus+ek18G0B tbarnouin@nixos"
];
};
};
programs = {
zsh = {
enable = true;
shellAliases = {
ll = "ls -l";
lla = "ls -lah";
};
ohMyZsh = {
enable = true;
plugins = [ "git" ];
theme = "bira";
};
};
tmux = {
enable = true;
};
};
nixpkgs.config.allowUnfree = true;
environment = {
localBinInPath = true;
systemPackages = with pkgs; [
vim
bash
wget
curl
git
htop
tree
dig
ncdu
nmap
iperf3
netcat-openbsd
];
};
services = {
openssh = {
enable = true;
settings.PasswordAuthentication = false;
settings.KbdInteractiveAuthentication = false;
settings.PermitRootLogin = "prohibit-password";
hostKeys = [
{
path = "/etc/ssh/ssh_host_ed25519_key";
2024-09-09 10:48:56 +02:00
type = "ed25519";
}
];
};
fail2ban = {
enable = true;
};
rsyslogd = {
enable = true;
2024-10-24 10:50:34 +02:00
extraConfig = "*.*@192.168.1.27:514;RSYSLOG_SyslogProtocol23Format";
2024-09-09 10:48:56 +02:00
};
prometheus = {
exporters = {
node = {
enable = true;
enabledCollectors = [ "systemd" ];
port = 9002;
};
};
};
};
system = {
2025-01-08 10:02:38 +01:00
stateVersion = "24.11";
activationScripts.ensure-ssh-key-dir.text = "mkdir -p /etc/ssh";
2024-09-09 10:48:56 +02:00
};
}