dns refactor

This commit is contained in:
ari committed 2026-09-26 02:41:43 -04:00
1 parent 09e2e03423
commit 045702e909
19 files changed
+118 -385

No files matched your search

@@ -1,46 +0,0 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{
device = "/dev/disk/by-uuid/6302dadf-57b7-4213-a7a5-2ba97f941e49";
fsType = "ext4";
};
fileSystems."/mnt/Data" =
{
device = "/dev/disk/by-uuid/b1c83d70-4d81-4d0f-a61a-38a78b943bd8";
fsType = "ext4";
};
fileSystems."/boot" =
{
device = "/dev/disk/by-uuid/BBF9-1744";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
swapDevices = [{
device = "/var/lib/swapfile";
size = 32 * 1024;
}];
boot.kernel.sysctl =
{
"kernel.unprivileged_userns_clone" = 1;
};
zramSwap.enable = true;
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
+4 -1
View File
@@ -27,7 +27,10 @@
};
networkDrives.enable = true;
};
skyg.nixos.common.containers.networks.ipvlanLab = {
enable = true;
parent = "enp6s0";
};
services.displayManager.defaultSession = "gnome";
services.displayManager.autoLogin = {
enable = true;
+12 -1
View File
@@ -1,8 +1,14 @@
{ ... }:
{ config, ... }:
let
app = config.skyg.internalNetworkingMap.apps.jellyfin;
in
{
skyg.nixos.common.container-services.jellyfin = {
enable = true;
autoUpdate.enable = true;
# networks = {
# lan = config.skyg.nixos.common.containers.networks.ipvlanLab.compose;
# };
services.jellyfin = {
image = "jellyfin/jellyfin";
deploy.resources.reservations.devices = [
@@ -17,6 +23,11 @@
"torrents:/torrents"
"family-videos:/family-videos"
];
# networks = {
# lan = {
# ipv4_address = app.ip;
# };
# };
devices = [ "/dev/dri:/dev/dri" ];
restart = "always";
healthcheck = {
@@ -1,64 +0,0 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "ahci" "ohci_pci" "ehci_pci" "pata_atiixp" "xhci_pci" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
boot.loader.grub = {
enable = true;
device = "/dev/sda"; # install GRUB to MBR
efiSupport = false;
};
fileSystems."/" =
{
device = "/dev/disk/by-uuid/5bf4a352-412f-47e1-9455-68f3aa629722";
fsType = "btrfs";
options = [ "subvol=@root" "compress=zstd" "noatime" ];
};
fileSystems."/boot" =
{
device = "/dev/disk/by-uuid/ccc80fd2-b38b-412b-9988-12a3194a5b57";
fsType = "ext4";
};
fileSystems."/var" =
{
device = "/dev/disk/by-uuid/5bf4a352-412f-47e1-9455-68f3aa629722";
fsType = "btrfs";
options = [ "compress=zstd" "subvol=@var" "noatime" ];
};
fileSystems."/nix" =
{
device = "/dev/disk/by-uuid/8cd6e560-4db9-4cf1-8048-27a7c6308965";
fsType = "btrfs";
options = [ "compress=zstd" "subvol=@nix" "noatime" ];
};
fileSystems."/home" =
{
device = "/dev/disk/by-uuid/6f4b2adc-5818-41ea-a4ba-720fb96b8f98";
fsType = "btrfs";
options = [ "compress=zstd" "subvol=@home" "noatime" ];
};
fileSystems."/data/fourTerra" =
{
device = "/dev/sde1";
fsType = "btrfs";
options = [ "compress=zstd" "subvol=@data" "noatime" ];
};
swapDevices = [ ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
@@ -1,62 +0,0 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{
device = "/dev/disk/by-uuid/e903eb56-160d-4b77-ba66-ef54a18207f2";
fsType = "btrfs";
options = [ "subvol=root" ];
};
fileSystems."/home" =
{
device = "/dev/disk/by-uuid/e903eb56-160d-4b77-ba66-ef54a18207f2";
fsType = "btrfs";
options = [ "subvol=home" ];
};
fileSystems."/nix" =
{
device = "/dev/disk/by-uuid/e903eb56-160d-4b77-ba66-ef54a18207f2";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/boot" =
{
device = "/dev/disk/by-uuid/1D9A-20EC";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
fileSystems."/data" =
{
device = "/dev/disk/by-uuid/f241ec6e-939c-4f10-bc72-3094b99de4eb";
fsType = "btrfs";
options = [ "subvol=data" ];
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp191s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp192s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
@@ -1,36 +0,0 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, modulesPath, ... }:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.initrd.availableKernelModules =
[ "ahci" "xhci_pci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-uuid/142c88f4-b1bc-4ed9-92ee-2c52cdfa4274";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/01FE-EDCC";
fsType = "vfat";
};
fileSystems."/nix" = {
device = "/dev/disk/by-uuid/ee4a60a8-b0d1-4f5c-a554-1d1d84c89e34";
fsType = "ext4";
neededForBoot = true;
options = [ "noatime" ];
};
swapDevices = [ ];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
}
-1
View File
@@ -48,7 +48,6 @@ in
skyg.nixos.common.containers.networks.ipvlanLab = {
enable = true;
parent = "eno1";
ipRange = "10.0.101.16/28";
};
skyg.server.admin.enable = true;
skyg.server.exporters.enable = true;
@@ -1,31 +0,0 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{
device = "/dev/disk/by-uuid/2c1a9e86-5b82-4545-bea1-c1b6b688fdf8";
fsType = "ext4";
};
fileSystems."/boot" =
{
device = "/dev/disk/by-uuid/6583-1C43";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
swapDevices = [ ];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
+4 -5
View File
@@ -14,16 +14,15 @@ in
skyg.user.enable = true;
skyg.nixos.common.ssh-server.enable = true;
skyg.nixos.common.containers.networks.ipvlanLab = {
enable = true;
parent = "enp2s0";
};
skyg.server.dns.routing = {
enable = false;
openFirewall = true;
addressesSecretName = "dns-addresses.conf";
};
skyg.nixos.common.containers.networks.ipvlanLab = {
enable = true;
parent = "enp2s0";
ipRange = "10.0.101.240/28";
};
skyg.nixos.common.containers.openMetricsPort = true;
skyg.server.exporters.enable = true;
skyg.networkDrives.enable = true;
+5 -1
View File
@@ -1,10 +1,15 @@
{ config, ... }:
let
app = config.skyg.internalNetworkingMap.apps.nvr;
in
{
skyg.nixos.common.container-services.scrypted = {
enable = true;
autoUpdate.enable = true;
networks.lan = config.skyg.nixos.common.containers.networks.ipvlanLab.compose;
services.scrypted = {
image = "ghcr.io/koush/scrypted";
networks.lan.ipv4_address = app.ip;
volumes = [
"/var/run/dbus:/var/run/dbus"
"/var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket"
@@ -12,7 +17,6 @@
"scrypted-nvr:/nvr"
];
environment.SCRYPTED_NVR_VOLUME = "/nvr";
network_mode = "host";
};
volumes.scrypted-nvr = {
driver = "local";
@@ -1,31 +0,0 @@
{ config, lib, modulesPath, ... }:
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{
device = "/dev/disk/by-uuid/5a468faa-b149-4ae2-9106-f0b5216d6d95";
fsType = "ext4";
};
fileSystems."/boot" =
{
device = "/dev/disk/by-uuid/6CC4-8800";
fsType = "vfat";
};
swapDevices =
[{ device = "/dev/disk/by-uuid/e847bdf2-e049-428b-a203-8a1eae77ce56"; }];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
@@ -1,71 +0,0 @@
{ config, lib, pkgs, modulesPath, ... }:
let
kernel = config.boot.kernelPackages.kernel;
hddled = pkgs.stdenv.mkDerivation rec {
name = "hddled_tmj33-${version}-${kernel.version}";
version = "0.3";
src = pkgs.fetchFromGitHub {
owner = "arnarg";
repo = "hddled_tmj33";
rev = version;
sha256 = "sha256-sQ8fLK8NP5sHw/9gJTO6lqgWfwmi1G5KDwWuWujNCZw=";
};
nativeBuildInputs = kernel.moduleBuildDependencies;
# We don't want to depmod yet, just build and package the module
preConfigure = ''
sed -i 's|depmod|#depmod|' Makefile
'';
makeFlags = [
"TARGET=${kernel.modDirVersion}"
"KERNEL_MODULES=${kernel.dev}/lib/modules/${kernel.modDirVersion}"
"MODDESTDIR=$(out)/lib/modules/${kernel.modDirVersion}/kernel/drivers/misc"
];
};
in
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "usbhid" "uas" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.extraModulePackages = with pkgs.linuxPackages; [
it87
hddled
];
boot.kernelModules = [
"kvm-intel"
"coretemp"
"drivetemp"
"it87"
"hddled_tmj33"
];
fileSystems."/" =
{
device = "/dev/disk/by-uuid/a3b275b4-96d4-4eb4-b01f-d80370899791";
fsType = "ext4";
};
fileSystems."/boot" =
{
device = "/dev/disk/by-uuid/AAA7-BCE9";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
fileSystems."/mnt/Data" =
{
device = "/dev/sda1";
fsType = "btrfs";
};
swapDevices = [ ];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
nix.settings.max-jobs = 2;
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
}
@@ -2,6 +2,32 @@
# Clanker ! Do not modify this file!
#
{ config, lib, pkgs, modulesPath, ... }:
let
kernel = config.boot.kernelPackages.kernel;
hddled = pkgs.stdenv.mkDerivation rec {
name = "hddled_tmj33-${version}-${kernel.version}";
version = "0.3";
src = pkgs.fetchFromGitHub {
owner = "arnarg";
repo = "hddled_tmj33";
rev = version;
sha256 = "sha256-sQ8fLK8NP5sHw/9gJTO6lqgWfwmi1G5KDwWuWujNCZw=";
};
nativeBuildInputs = kernel.moduleBuildDependencies;
preConfigure = ''
sed -i 's|depmod|#depmod|' Makefile
'';
makeFlags = [
"TARGET=${kernel.modDirVersion}"
"KERNEL_MODULES=${kernel.dev}/lib/modules/${kernel.modDirVersion}"
"MODDESTDIR=$(out)/lib/modules/${kernel.modDirVersion}/kernel/drivers/misc"
];
};
in
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
@@ -18,7 +44,6 @@
"it87"
"hddled_tmj33"
];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
@@ -3,18 +3,22 @@
#
{ config, lib, pkgs, modulesPath, ... }:
{
fileSystems."/" = {
device = "/dev/disk/by-uuid/a3b275b4-96d4-4eb4-b01f-d80370899791";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/AAA7-BCE9";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
fileSystems."/mnt/Data" = {
device = "/dev/sda1";
fsType = "btrfs";
};
fileSystems."/" =
{
device = "/dev/disk/by-uuid/a3b275b4-96d4-4eb4-b01f-d80370899791";
fsType = "ext4";
};
fileSystems."/boot" =
{
device = "/dev/disk/by-uuid/AAA7-BCE9";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
fileSystems."/mnt/Data" =
{
device = "/dev/sda1";
fsType = "btrfs";
};
swapDevices = [ ];
}
+1 -1
View File
@@ -10,7 +10,7 @@ modules/
├── lib.nix # makeNixOs / makeIso / makeHomeManagerUsers / makeDarwinModule / eachSystem
│ # (registers the `tether` flake input's NixOS module → programs.tether.*)
├── main.nix # Base module imported by every host: core/ + nixos/ + network-drives.nix
│ # + skyg.internalNetworkingMap (global app registry)
│ # + skyg.internalNetworkingMap (global app registry + appNetwork)
├── internal-networking.nix # Renders skyg.internalNetworkingMap → router generalMappings
├── skyg-utils.nix # makeHyperlinkScriptToConfigs (symlinks configs/ → ~/.config/;
│ # backs up an existing real dir to <path>.backup.<timestamp>)
+3 -2
View File
@@ -138,8 +138,8 @@ in
inherit
user
rootDir
hostName
configsDir
hostName
systemStateVersion
homeManagerVersion
;
@@ -165,8 +165,8 @@ in
inherit
user
rootDir
hostName
configsDir
hostName
systemStateVersion
homeManagerVersion
;
@@ -202,6 +202,7 @@ in
inherit
user
rootDir
configsDir
homeManagerVersion
hostName
systemStateVersion;
+36 -8
View File
@@ -54,11 +54,33 @@ in
description = "Suffix appended to each app name to form its internal DNS name.";
};
subnet = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
example = "10.0.101.0/24";
description = "LAN subnet the apps live on (informational).";
appNetwork = lib.mkOption {
default = { };
description = ''
The lab network the apps live on. Consumed as the defaults for the
ipvlan/macvlan container networks (skyg.nixos.common.containers.networks).
'';
type = lib.types.submodule {
options = {
subnet = lib.mkOption {
type = lib.types.str;
default = "10.0.0.0/16";
description = "IPv4 subnet (--subnet).";
};
gateway = lib.mkOption {
type = lib.types.str;
default = "10.0.0.1";
description = "IPv4 gateway (--gateway).";
};
ipRange = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
description = "IPv4 range for dynamic address allocation (--ip-range).";
};
};
};
};
apps = lib.mkOption {
@@ -76,11 +98,17 @@ in
# Global internal app registry.
skyg.internalNetworkingMap = {
rootDns = ".app.internal";
subnet = "10.0.101.0/24";
appNetwork = {
subnet = "10.0.0.0/16";
gateway = "10.0.0.1";
ipRange = "10.0.101.16/28";
};
apps = {
audiobooks = { ip = "10.0.101.4"; };
buzz = { ip = "10.0.101.3"; aliasDns = "buzz.home.sosnovsky.ca"; };
drawdb = { ip = "10.0.101.2"; };
buzz = { ip = "10.0.101.3"; aliasDns = "buzz.home.sosnovsky.ca"; };
audiobooks = { ip = "10.0.101.4"; };
# jellyfin = { ip = "10.0.101.5"; aliasDns = "jellyfin.home.sosnovsky.ca"; };
nvr = { ip = "10.0.101.6"; aliasDns = "nvr.home.sosnovsky.ca"; };
portainer = { ip = "10.0.101.241"; };
};
};
+4 -4
View File
@@ -64,14 +64,12 @@ Two predefined lab networks are available:
skyg.nixos.common.containers.networks.macvlanLab = {
enable = true;
parent = "eno1";
ipRange = "10.0.101.16/28";
};
# ipvlan L2 mode (host can reach its own containers — preferred)
skyg.nixos.common.containers.networks.ipvlanLab = {
enable = true;
parent = "eno1";
ipRange = "10.0.101.16/28";
};
```
@@ -93,8 +91,10 @@ skyg.nixos.common.containers.networks.extra.myNet = {
};
```
Predefined fields: `enable`, `parent`, `subnet` (default `10.0.0.0/16`), `gateway` (default
`10.0.0.1`), `ipRange`, `internal`. Extra networks also have `name`, `driver`, `driverOpts`.
Predefined fields: `enable`, `parent`, `subnet`, `gateway`, `ipRange`, `internal`. `subnet`,
`gateway`, and `ipRange` default to `skyg.internalNetworkingMap.appNetwork` (see
`modules/main.nix`), so the lab network is declared once. Extra networks also have `name`,
`driver`, `driverOpts`.
Works with both docker and podman.
## Container service groups (`skyg.nixos.common.container-services`)
+6 -6
View File
@@ -70,19 +70,19 @@ in
subnet = lib.mkOption {
type = lib.types.str;
default = "10.0.0.0/16";
default = config.skyg.internalNetworkingMap.appNetwork.subnet;
description = "IPv4 subnet.";
};
gateway = lib.mkOption {
type = lib.types.str;
default = "10.0.0.1";
default = config.skyg.internalNetworkingMap.appNetwork.gateway;
description = "IPv4 gateway.";
};
ipRange = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
default = config.skyg.internalNetworkingMap.appNetwork.ipRange;
description = "IPv4 range for dynamic address allocation (--ip-range).";
};
@@ -124,19 +124,19 @@ in
subnet = lib.mkOption {
type = lib.types.str;
default = "10.0.0.0/16";
default = config.skyg.internalNetworkingMap.appNetwork.subnet;
description = "IPv4 subnet.";
};
gateway = lib.mkOption {
type = lib.types.str;
default = "10.0.0.1";
default = config.skyg.internalNetworkingMap.appNetwork.gateway;
description = "IPv4 gateway.";
};
ipRange = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
default = config.skyg.internalNetworkingMap.appNetwork.ipRange;
description = "IPv4 range for dynamic address allocation (--ip-range).";
};