nixos/common.nix

123 lines
2.7 KiB
Nix

{ config, pkgs, ... }: {
boot = {
extraModulePackages = [ config.boot.kernelPackages.amneziawg ];
kernelModules = [ "amneziawg" ];
kernelPackages = pkgs.linuxPackages_latest;
loader.limine = {
enable = true;
panicOnChecksumMismatch = true;
secureBoot.enable = true;
};
zswap = {
enable = true;
maxPoolPercent = 15;
};
};
console = {
font = "${pkgs.kbd}/share/consolefonts/cyr-sun16.psfu.gz";
keyMap = "ruwin_alt_sh-UTF-8";
};
environment.systemPackages = with pkgs; [
_7zz
binutils
file
jq
openssl
python314
qrencode
sbctl
sops
speedtest-go
];
fileSystems = {
"/".options = [ "noatime" ];
"/boot".options = [ "noatime" ];
};
i18n.defaultLocale = "ru_RU.UTF-8";
imports = [
./mods/pxeboot.nix
./mods/vps-init.nix
];
networking = {
networkmanager = {
dns = "dnsmasq";
enable = true;
ensureProfiles = {
environmentFiles = [ config.sops.secrets.wifi-env.path ];
profiles.home-wifi = {
connection = {
id = "home-wifi";
type = "wifi";
};
ipv4 = {
gateway = "10.1.0.1";
method = "manual";
};
ipv6 = {
gateway = "fc01::1";
method = "manual";
};
wifi-security.key-mgmt = "sae";
};
};
};
wg-quick.interfaces.awg0 = {
peers = [
{
allowedIPs = [
"::/0"
"0.0.0.0/0"
];
endpoint = "bogaledev.ru";
}
];
type = "amneziawg";
};
};
nix.settings.experimental-features = [
"flakes"
"nix-command"
];
services = {
dnsmasq = {
enable = true;
settings = {
bogus-priv = true;
cache-size = 4096;
domain-needed = true;
enable-ra = true;
no-resolv = true;
server = [
"1.0.0.2"
"1.1.1.2"
"2606:4700:4700::1002"
"2606:4700:4700::1112"
];
};
};
swapspace.enable = true;
};
sops = {
age = {
generateKey = true;
keyFile = "/var/lib/sops-nix/key.txt";
sshKeyPaths = [ "/root/.ssh/sops" ];
};
defaultSopsFile = ./.secrets.yaml;
secrets = {
awg-obf = { };
root-passwd = { };
wifi-env = { };
};
};
system.stateVersion = "26.11";
systemd.tmpfiles.rules = [
"L /root/backup/base/nixos - - - - /etc/nixos"
"L /root/backup/base/root - - - - /root"
"L /root/backup/base/sbctl - - - - /var/lib/sbctl"
"d /root/backup"
"d /root/backup/base"
];
time.timeZone = "Asia/Chita";
users.users.root.hashedPasswordFile = config.sops.secrets.root-passwd.path;
}