pxeboot rewrite, bridge for qemu
This commit is contained in:
parent
ba91796c3e
commit
1dd7fac8ed
10 changed files with 129 additions and 112 deletions
80
common.nix
80
common.nix
|
|
@ -1,7 +1,5 @@
|
||||||
{ config, pkgs, ... }: {
|
{ config, pkgs, ... }: {
|
||||||
boot = {
|
boot = {
|
||||||
extraModulePackages = [ config.boot.kernelPackages.amneziawg ];
|
|
||||||
kernelModules = [ "amneziawg" ];
|
|
||||||
kernelPackages = pkgs.linuxPackages_latest;
|
kernelPackages = pkgs.linuxPackages_latest;
|
||||||
loader.limine = {
|
loader.limine = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
@ -19,96 +17,24 @@
|
||||||
};
|
};
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
_7zz
|
_7zz
|
||||||
binutils
|
|
||||||
file
|
file
|
||||||
jq
|
jq
|
||||||
openssl
|
|
||||||
python314
|
python314
|
||||||
qrencode
|
|
||||||
sbctl
|
sbctl
|
||||||
sops
|
sops
|
||||||
speedtest-go
|
speedtest-go
|
||||||
];
|
];
|
||||||
fileSystems = {
|
|
||||||
"/".options = [ "noatime" ];
|
|
||||||
"/boot".options = [ "noatime" ];
|
|
||||||
};
|
|
||||||
i18n.defaultLocale = "ru_RU.UTF-8";
|
i18n.defaultLocale = "ru_RU.UTF-8";
|
||||||
imports = [
|
networking.networkmanager.enable = true;
|
||||||
./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";
|
|
||||||
psk = "$BOGALE_5_PSK";
|
|
||||||
};
|
|
||||||
wifi.ssid = "bogale_5";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
wg-quick.interfaces.awg0 = {
|
|
||||||
peers = [
|
|
||||||
{
|
|
||||||
allowedIPs = [
|
|
||||||
"::/0"
|
|
||||||
"0.0.0.0/0"
|
|
||||||
];
|
|
||||||
endpoint = "bogaledev.ru";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
type = "amneziawg";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
nix.settings.experimental-features = [
|
nix.settings.experimental-features = [
|
||||||
"flakes"
|
"flakes"
|
||||||
"nix-command"
|
"nix-command"
|
||||||
];
|
];
|
||||||
services = {
|
services.swapspace.enable = true;
|
||||||
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 = {
|
sops = {
|
||||||
age.keyFile = "/var/lib/sops-nix/key.txt";
|
age.keyFile = "/var/lib/sops-nix/key.txt";
|
||||||
defaultSopsFile = ./.secrets.yaml;
|
defaultSopsFile = ./.secrets.yaml;
|
||||||
secrets = {
|
secrets.root-passwd = { };
|
||||||
awg-obf = { };
|
|
||||||
root-passwd = { };
|
|
||||||
wifi-env = { };
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
system.stateVersion = "26.11";
|
system.stateVersion = "26.11";
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
|
|
|
||||||
|
|
@ -2,25 +2,23 @@
|
||||||
boot.kernelParams = [ "hibernate.compressor=lz4" ];
|
boot.kernelParams = [ "hibernate.compressor=lz4" ];
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
android-tools
|
android-tools
|
||||||
|
binutils
|
||||||
binwalk
|
binwalk
|
||||||
qemu
|
qemu
|
||||||
|
qrencode
|
||||||
];
|
];
|
||||||
hardware = {
|
hardware = {
|
||||||
bluetooth.enable = true;
|
bluetooth.enable = true;
|
||||||
graphics.enable32Bit = true;
|
graphics.enable32Bit = true;
|
||||||
};
|
};
|
||||||
imports = [
|
imports = [
|
||||||
../common.nix
|
../mods/host.nix
|
||||||
./hardware.nix
|
./hardware.nix
|
||||||
];
|
];
|
||||||
networking = {
|
networking = {
|
||||||
firewall.allowedTCPPorts = [ 8000 ];
|
firewall.allowedTCPPorts = [ 8000 ];
|
||||||
hostName = "nixos-desktop";
|
hostName = "nixos-desktop";
|
||||||
networkmanager.ensureProfiles.profiles = {
|
networkmanager.ensureProfiles.profiles = {
|
||||||
dhcp-eth.connection = {
|
|
||||||
id = "dhcp-eth";
|
|
||||||
type = "ethernet";
|
|
||||||
};
|
|
||||||
home-wifi = {
|
home-wifi = {
|
||||||
ipv4.addresses = "10.1.0.3/16";
|
ipv4.addresses = "10.1.0.3/16";
|
||||||
ipv6.addresses = "fc01::3/64";
|
ipv6.addresses = "fc01::3/64";
|
||||||
|
|
@ -37,13 +35,7 @@
|
||||||
wifi.ssid = "Hello world";
|
wifi.ssid = "Hello world";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
wg-quick.interfaces.awg0 = {
|
wg-quick.interfaces.awg0.configFile = config.sops.templates.awg2-conf.path;
|
||||||
address = [
|
|
||||||
"10.0.0.3/32"
|
|
||||||
"fc00::3/128"
|
|
||||||
];
|
|
||||||
configFile = config.sops.templates.awg2-conf.path;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
programs = {
|
programs = {
|
||||||
niri.enable = true;
|
niri.enable = true;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
{
|
{
|
||||||
home-manager = {
|
home-manager = {
|
||||||
extraSpecialArgs = { inherit inputs; };
|
extraSpecialArgs = { inherit inputs; };
|
||||||
sharedModules = [ inputs.sops-nix.homeManagerModules.sops ];
|
|
||||||
useGlobalPkgs = true;
|
useGlobalPkgs = true;
|
||||||
useUserPackages = true;
|
useUserPackages = true;
|
||||||
users = {
|
users = {
|
||||||
|
|
@ -39,6 +38,12 @@
|
||||||
sops-nix.nixosModules.sops
|
sops-nix.nixosModules.sops
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
nixos-pxeboot = nixpkgs.lib.nixosSystem {
|
||||||
|
modules = [
|
||||||
|
./pxeboot/configuration.nix
|
||||||
|
sops-nix.nixosModules.sops
|
||||||
|
];
|
||||||
|
};
|
||||||
nixos-server = nixpkgs.lib.nixosSystem {
|
nixos-server = nixpkgs.lib.nixosSystem {
|
||||||
modules = [
|
modules = [
|
||||||
./server/configuration.nix
|
./server/configuration.nix
|
||||||
|
|
@ -46,7 +51,6 @@
|
||||||
{
|
{
|
||||||
home-manager = {
|
home-manager = {
|
||||||
extraSpecialArgs = { inherit inputs; };
|
extraSpecialArgs = { inherit inputs; };
|
||||||
sharedModules = [ inputs.sops-nix.homeManagerModules.sops ];
|
|
||||||
useGlobalPkgs = true;
|
useGlobalPkgs = true;
|
||||||
useUserPackages = true;
|
useUserPackages = true;
|
||||||
users.root = ./home/root.nix;
|
users.root = ./home/root.nix;
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
qbittorrent
|
qbittorrent
|
||||||
telegram-desktop
|
telegram-desktop
|
||||||
thunderbird
|
thunderbird
|
||||||
|
wl-mirror
|
||||||
];
|
];
|
||||||
pointerCursor = {
|
pointerCursor = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
||||||
62
mods/host.nix
Normal file
62
mods/host.nix
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
{ config, pkgs, ... }: {
|
||||||
|
boot = {
|
||||||
|
extraModulePackages = [ config.boot.kernelPackages.amneziawg ];
|
||||||
|
kernelModules = [ "amneziawg" ];
|
||||||
|
};
|
||||||
|
fileSystems = {
|
||||||
|
"/".options = [ "noatime" ];
|
||||||
|
"/boot".options = [ "noatime" ];
|
||||||
|
};
|
||||||
|
imports = [
|
||||||
|
../common.nix
|
||||||
|
./pxeboot.nix
|
||||||
|
./vps-init.nix
|
||||||
|
];
|
||||||
|
networking = {
|
||||||
|
networkmanager = {
|
||||||
|
dns = "dnsmasq";
|
||||||
|
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";
|
||||||
|
psk = "$BOGALE_5_PSK";
|
||||||
|
};
|
||||||
|
wifi.ssid = "bogale_5";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
wg-quick.interfaces.awg0.type = "amneziawg";
|
||||||
|
};
|
||||||
|
services.dnsmasq = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
bogus-priv = true;
|
||||||
|
cache-size = 4096;
|
||||||
|
domain-needed = true;
|
||||||
|
no-resolv = true;
|
||||||
|
server = [
|
||||||
|
"1.0.0.2"
|
||||||
|
"1.1.1.2"
|
||||||
|
"2606:4700:4700::1002"
|
||||||
|
"2606:4700:4700::1112"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
sops.secrets = {
|
||||||
|
awg-obf = { };
|
||||||
|
wifi-env = { };
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -16,33 +16,47 @@
|
||||||
nat = {
|
nat = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableIPv6 = true;
|
enableIPv6 = true;
|
||||||
internalInterfaces = [ "enp1s0" ];
|
internalInterfaces = [ "br0" ];
|
||||||
};
|
};
|
||||||
networkmanager.ensureProfiles.profiles.static-eth = {
|
networkmanager.ensureProfiles.profiles = {
|
||||||
connection = {
|
slave-ethernet.connection = {
|
||||||
id = "static-eth";
|
controller = "br0";
|
||||||
|
id = "slave-ethernet";
|
||||||
type = "ethernet";
|
type = "ethernet";
|
||||||
};
|
};
|
||||||
ipv4 = {
|
static-bridge = {
|
||||||
addresses = "10.2.0.1/16";
|
connection = {
|
||||||
method = "manual";
|
id = "static-bridge";
|
||||||
|
interface-name = "br0";
|
||||||
|
type = "bridge";
|
||||||
|
};
|
||||||
|
ipv4 = {
|
||||||
|
addresses = "10.2.0.1/16";
|
||||||
|
method = "manual";
|
||||||
|
};
|
||||||
|
ipv6 = {
|
||||||
|
addresses = "fc02::1/64";
|
||||||
|
method = "manual";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
ipv6 = {
|
dhcp-bridge.connection = {
|
||||||
addresses = "fc02::1/64";
|
id = "dhcp-bridge";
|
||||||
method = "manual";
|
interface-name = "br0";
|
||||||
|
type = "bridge";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
services = {
|
services = {
|
||||||
dnsmasq.settings = {
|
dnsmasq.settings = {
|
||||||
bind-dynamic = true;
|
bind-interfaces = true;
|
||||||
dhcp-boot = "grubx64.efi";
|
dhcp-boot = "grubx64.efi";
|
||||||
dhcp-range = [
|
dhcp-range = [
|
||||||
"10.2.0.2,10.2.255.254,12h"
|
"10.2.0.2,10.2.255.254,12h"
|
||||||
"fc02::2,fc02::ffff:ffff:ffff:ffff,12h"
|
"fc02::2,fc02::ffff:ffff:ffff:ffff,12h"
|
||||||
];
|
];
|
||||||
|
enable-ra = true;
|
||||||
enable-tftp = true;
|
enable-tftp = true;
|
||||||
interface = "enp1s0";
|
interface = "br0";
|
||||||
tftp-root = "/srv/tftp";
|
tftp-root = "/srv/tftp";
|
||||||
};
|
};
|
||||||
nfs.server = {
|
nfs.server = {
|
||||||
|
|
@ -62,7 +76,7 @@
|
||||||
grub2_efi
|
grub2_efi
|
||||||
xz
|
xz
|
||||||
];
|
];
|
||||||
requiredBy = [ "nfs-server.service" ];
|
#requiredBy = [ "nfs-server.service" ];
|
||||||
script = ''
|
script = ''
|
||||||
if [ ! -e /srv/nfs/nixos ]; then
|
if [ ! -e /srv/nfs/nixos ]; then
|
||||||
mkdir -p /srv/nfs/nixos
|
mkdir -p /srv/nfs/nixos
|
||||||
|
|
|
||||||
7
pxeboot/configuration.nix
Normal file
7
pxeboot/configuration.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
{ config, pkgs, ... }: {
|
||||||
|
imports = [
|
||||||
|
../common.nix
|
||||||
|
./hardware.nix
|
||||||
|
];
|
||||||
|
networking.hostName = "nixos-pxeboot";
|
||||||
|
}
|
||||||
15
pxeboot/hardware.nix
Normal file
15
pxeboot/hardware.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
modulesPath,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
boot.initrd.network.enable = true;
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = "";
|
||||||
|
fsType = "nfs";
|
||||||
|
};
|
||||||
|
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||||
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{ config, pkgs, ... }: {
|
{ config, pkgs, ... }: {
|
||||||
boot.kernelParams = [ "consoleblank=60" ];
|
boot.kernelParams = [ "consoleblank=60" ];
|
||||||
imports = [
|
imports = [
|
||||||
../common.nix
|
../mods/host.nix
|
||||||
./hardware.nix
|
./hardware.nix
|
||||||
./mods/mail.nix
|
./mods/mail.nix
|
||||||
./mods/system.nix
|
./mods/system.nix
|
||||||
|
|
@ -23,13 +23,7 @@
|
||||||
ipv4.addresses = "10.1.0.2/16";
|
ipv4.addresses = "10.1.0.2/16";
|
||||||
ipv6.addresses = "fc01::2/64";
|
ipv6.addresses = "fc01::2/64";
|
||||||
};
|
};
|
||||||
wg-quick.interfaces.awg0 = {
|
wg-quick.interfaces.awg0.configFile = config.sops.templates.awg1-conf.path;
|
||||||
address = [
|
|
||||||
"10.0.0.2/32"
|
|
||||||
"fc00::2/128"
|
|
||||||
];
|
|
||||||
configFile = config.sops.templates.awg1-conf.path;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
security.acme = {
|
security.acme = {
|
||||||
acceptTerms = true;
|
acceptTerms = true;
|
||||||
|
|
|
||||||
|
|
@ -82,8 +82,10 @@
|
||||||
localNetworks = ''
|
localNetworks = ''
|
||||||
allow 10.0.0.0/16;
|
allow 10.0.0.0/16;
|
||||||
allow 10.1.0.0/24;
|
allow 10.1.0.0/24;
|
||||||
|
allow 10.2.0.0/24;
|
||||||
allow fc00::/64;
|
allow fc00::/64;
|
||||||
allow fc01::/96;
|
allow fc01::/96;
|
||||||
|
allow fc02::/96;
|
||||||
deny all;
|
deny all;
|
||||||
'';
|
'';
|
||||||
phpPool = ''
|
phpPool = ''
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue