nixos-servers/modules/default.nix

167 lines
3.5 KiB
Nix
Raw Normal View History

2024-10-28 13:12:06 +00:00
{
self,
pkgs,
config,
lib,
inputs,
machine,
...
}: {
imports =
[
./storage.nix
./backups.nix
./networking
./data-sharing.nix
./monitoring
./k3s
./tailscale.nix
machine.nixosModule
inputs.disko.nixosModules.disko
inputs.sops-nix.nixosModules.sops
inputs.nix-snapshotter.nixosModules.nix-snapshotter
]
++ lib.lists.optional (machine.isRaspberryPi) inputs.nixos-hardware.nixosModules.raspberry-pi-4;
2024-01-28 10:48:13 +00:00
config = {
time.timeZone = "Europe/Amsterdam";
2024-04-13 13:43:01 +00:00
hardware.cpu.intel.updateMicrocode = lib.mkIf (! machine.isRaspberryPi) config.hardware.enableRedistributableFirmware;
2024-06-13 17:46:21 +00:00
nixpkgs = {
config.allowUnfree = true;
overlays = [
(final: _prev: {
unstable = import inputs.nixpkgs-unstable {
system = machine.arch;
};
})
];
};
2024-01-28 10:48:13 +00:00
i18n = {
defaultLocale = "en_US.UTF-8";
2024-10-28 13:12:06 +00:00
extraLocaleSettings = let
extraLocale = "nl_NL.UTF-8";
in {
2024-02-29 19:13:28 +00:00
LC_ADDRESS = extraLocale;
LC_IDENTIFICATION = extraLocale;
LC_MEASUREMENT = extraLocale;
LC_MONETARY = extraLocale;
LC_NAME = extraLocale;
LC_NUMERIC = extraLocale;
LC_PAPER = extraLocale;
LC_TELEPHONE = extraLocale;
LC_TIME = extraLocale;
2024-01-28 10:48:13 +00:00
};
};
services = {
openssh = {
enable = true;
openFirewall = true;
settings = {
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
GSSAPIAuthentication = false;
UseDns = false;
2024-01-28 10:48:13 +00:00
};
};
};
users.users.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOodpLr+FDRyKyHjucHizNLVFHZ5AQmE9GmxMnOsSoaw pimkunis@thinkpadpim"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINUZp4BCxf7uLa1QWonx/Crf8tYZ5MKIZ+EuaBa82LrV user@user-laptop"
];
2024-04-13 13:43:01 +00:00
programs.neovim = {
enable = true;
vimAlias = true;
viAlias = true;
2024-01-28 10:48:13 +00:00
};
environment.systemPackages = with pkgs; [
wget
git
btop
htop
ripgrep
dig
tree
file
tcpdump
lsof
parted
radvd
2024-01-29 21:21:15 +00:00
minicom
socat
pciutils
dmidecode
2024-03-19 21:56:52 +00:00
openssl
2024-03-22 21:19:44 +00:00
nfs-utils
rsync
2024-05-02 14:21:52 +00:00
fio
2024-05-11 13:16:41 +00:00
libva-utils
jq
tmux
fastfetch
2024-01-28 10:48:13 +00:00
];
2024-04-13 13:43:01 +00:00
boot = lib.mkIf (! machine.isRaspberryPi) {
2024-10-28 13:12:06 +00:00
kernelModules = ["kvm-intel"];
extraModulePackages = [];
kernel.sysctl."fs.inotify.max_user_instances" = 256;
2024-04-13 13:43:01 +00:00
initrd = {
2024-10-28 13:12:06 +00:00
kernelModules = [];
2024-04-13 13:43:01 +00:00
availableKernelModules = [
"ahci"
"xhci_pci"
"nvme"
"usbhid"
"usb_storage"
"sd_mod"
"sdhci_pci"
];
};
loader = {
systemd-boot.enable = lib.mkDefault true;
2024-04-13 13:43:01 +00:00
efi.canTouchEfiVariables = true;
};
};
nix = {
package = pkgs.nixFlakes;
extraOptions = ''
experimental-features = nix-command flakes
'';
2024-09-01 09:39:53 +00:00
gc = {
automatic = true;
persistent = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
2024-04-13 13:43:01 +00:00
};
system = {
stateVersion = "23.05";
activationScripts.diff = ''
if [[ -e /run/current-system ]]; then
${pkgs.nix}/bin/nix store diff-closures /run/current-system "$systemConfig"
fi
'';
};
2024-06-15 20:27:07 +00:00
sops = {
age.keyFile = "/root/.config/sops/age/keys.txt";
2024-09-07 11:59:04 +00:00
defaultSopsFile = "${self}/secrets/nixos.yaml";
2024-06-15 20:27:07 +00:00
};
2024-01-28 10:48:13 +00:00
};
}