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, ... }: {
|
||||
boot = {
|
||||
extraModulePackages = [ config.boot.kernelPackages.amneziawg ];
|
||||
kernelModules = [ "amneziawg" ];
|
||||
kernelPackages = pkgs.linuxPackages_latest;
|
||||
loader.limine = {
|
||||
enable = true;
|
||||
|
|
@ -19,96 +17,24 @@
|
|||
};
|
||||
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";
|
||||
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";
|
||||
};
|
||||
};
|
||||
networking.networkmanager.enable = true;
|
||||
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;
|
||||
};
|
||||
services.swapspace.enable = true;
|
||||
sops = {
|
||||
age.keyFile = "/var/lib/sops-nix/key.txt";
|
||||
defaultSopsFile = ./.secrets.yaml;
|
||||
secrets = {
|
||||
awg-obf = { };
|
||||
root-passwd = { };
|
||||
wifi-env = { };
|
||||
};
|
||||
secrets.root-passwd = { };
|
||||
};
|
||||
system.stateVersion = "26.11";
|
||||
systemd.tmpfiles.rules = [
|
||||
|
|
|
|||
|
|
@ -2,25 +2,23 @@
|
|||
boot.kernelParams = [ "hibernate.compressor=lz4" ];
|
||||
environment.systemPackages = with pkgs; [
|
||||
android-tools
|
||||
binutils
|
||||
binwalk
|
||||
qemu
|
||||
qrencode
|
||||
];
|
||||
hardware = {
|
||||
bluetooth.enable = true;
|
||||
graphics.enable32Bit = true;
|
||||
};
|
||||
imports = [
|
||||
../common.nix
|
||||
../mods/host.nix
|
||||
./hardware.nix
|
||||
];
|
||||
networking = {
|
||||
firewall.allowedTCPPorts = [ 8000 ];
|
||||
hostName = "nixos-desktop";
|
||||
networkmanager.ensureProfiles.profiles = {
|
||||
dhcp-eth.connection = {
|
||||
id = "dhcp-eth";
|
||||
type = "ethernet";
|
||||
};
|
||||
home-wifi = {
|
||||
ipv4.addresses = "10.1.0.3/16";
|
||||
ipv6.addresses = "fc01::3/64";
|
||||
|
|
@ -37,13 +35,7 @@
|
|||
wifi.ssid = "Hello world";
|
||||
};
|
||||
};
|
||||
wg-quick.interfaces.awg0 = {
|
||||
address = [
|
||||
"10.0.0.3/32"
|
||||
"fc00::3/128"
|
||||
];
|
||||
configFile = config.sops.templates.awg2-conf.path;
|
||||
};
|
||||
wg-quick.interfaces.awg0.configFile = config.sops.templates.awg2-conf.path;
|
||||
};
|
||||
programs = {
|
||||
niri.enable = true;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
{
|
||||
home-manager = {
|
||||
extraSpecialArgs = { inherit inputs; };
|
||||
sharedModules = [ inputs.sops-nix.homeManagerModules.sops ];
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
users = {
|
||||
|
|
@ -39,6 +38,12 @@
|
|||
sops-nix.nixosModules.sops
|
||||
];
|
||||
};
|
||||
nixos-pxeboot = nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
./pxeboot/configuration.nix
|
||||
sops-nix.nixosModules.sops
|
||||
];
|
||||
};
|
||||
nixos-server = nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
./server/configuration.nix
|
||||
|
|
@ -46,7 +51,6 @@
|
|||
{
|
||||
home-manager = {
|
||||
extraSpecialArgs = { inherit inputs; };
|
||||
sharedModules = [ inputs.sops-nix.homeManagerModules.sops ];
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
users.root = ./home/root.nix;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
qbittorrent
|
||||
telegram-desktop
|
||||
thunderbird
|
||||
wl-mirror
|
||||
];
|
||||
pointerCursor = {
|
||||
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,13 +16,20 @@
|
|||
nat = {
|
||||
enable = true;
|
||||
enableIPv6 = true;
|
||||
internalInterfaces = [ "enp1s0" ];
|
||||
internalInterfaces = [ "br0" ];
|
||||
};
|
||||
networkmanager.ensureProfiles.profiles.static-eth = {
|
||||
connection = {
|
||||
id = "static-eth";
|
||||
networkmanager.ensureProfiles.profiles = {
|
||||
slave-ethernet.connection = {
|
||||
controller = "br0";
|
||||
id = "slave-ethernet";
|
||||
type = "ethernet";
|
||||
};
|
||||
static-bridge = {
|
||||
connection = {
|
||||
id = "static-bridge";
|
||||
interface-name = "br0";
|
||||
type = "bridge";
|
||||
};
|
||||
ipv4 = {
|
||||
addresses = "10.2.0.1/16";
|
||||
method = "manual";
|
||||
|
|
@ -32,17 +39,24 @@
|
|||
method = "manual";
|
||||
};
|
||||
};
|
||||
dhcp-bridge.connection = {
|
||||
id = "dhcp-bridge";
|
||||
interface-name = "br0";
|
||||
type = "bridge";
|
||||
};
|
||||
};
|
||||
};
|
||||
services = {
|
||||
dnsmasq.settings = {
|
||||
bind-dynamic = true;
|
||||
bind-interfaces = true;
|
||||
dhcp-boot = "grubx64.efi";
|
||||
dhcp-range = [
|
||||
"10.2.0.2,10.2.255.254,12h"
|
||||
"fc02::2,fc02::ffff:ffff:ffff:ffff,12h"
|
||||
];
|
||||
enable-ra = true;
|
||||
enable-tftp = true;
|
||||
interface = "enp1s0";
|
||||
interface = "br0";
|
||||
tftp-root = "/srv/tftp";
|
||||
};
|
||||
nfs.server = {
|
||||
|
|
@ -62,7 +76,7 @@
|
|||
grub2_efi
|
||||
xz
|
||||
];
|
||||
requiredBy = [ "nfs-server.service" ];
|
||||
#requiredBy = [ "nfs-server.service" ];
|
||||
script = ''
|
||||
if [ ! -e /srv/nfs/nixos ]; then
|
||||
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, ... }: {
|
||||
boot.kernelParams = [ "consoleblank=60" ];
|
||||
imports = [
|
||||
../common.nix
|
||||
../mods/host.nix
|
||||
./hardware.nix
|
||||
./mods/mail.nix
|
||||
./mods/system.nix
|
||||
|
|
@ -23,13 +23,7 @@
|
|||
ipv4.addresses = "10.1.0.2/16";
|
||||
ipv6.addresses = "fc01::2/64";
|
||||
};
|
||||
wg-quick.interfaces.awg0 = {
|
||||
address = [
|
||||
"10.0.0.2/32"
|
||||
"fc00::2/128"
|
||||
];
|
||||
configFile = config.sops.templates.awg1-conf.path;
|
||||
};
|
||||
wg-quick.interfaces.awg0.configFile = config.sops.templates.awg1-conf.path;
|
||||
};
|
||||
security.acme = {
|
||||
acceptTerms = true;
|
||||
|
|
|
|||
|
|
@ -82,8 +82,10 @@
|
|||
localNetworks = ''
|
||||
allow 10.0.0.0/16;
|
||||
allow 10.1.0.0/24;
|
||||
allow 10.2.0.0/24;
|
||||
allow fc00::/64;
|
||||
allow fc01::/96;
|
||||
allow fc02::/96;
|
||||
deny all;
|
||||
'';
|
||||
phpPool = ''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue