nixos/common.nix
2026-10-24 17:18:06 +09:00

102 lines
2.5 KiB
Nix

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