nix formating, sops secrets migration, vps-init auto update
This commit is contained in:
parent
db022df80b
commit
fcee389f8e
17 changed files with 950 additions and 818 deletions
175
common.nix
175
common.nix
|
|
@ -1,102 +1,123 @@
|
|||
{ 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;
|
||||
{ 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 = "cyr-sun16";
|
||||
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" ];
|
||||
};
|
||||
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"
|
||||
i18n.defaultLocale = "ru_RU.UTF-8";
|
||||
imports = [
|
||||
./mods/pxeboot.nix
|
||||
./mods/vps-init.nix
|
||||
];
|
||||
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";
|
||||
enable = true;
|
||||
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";
|
||||
type = "wifi";
|
||||
};
|
||||
ipv4 = {
|
||||
method = "manual";
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue