9 Commits

Author SHA1 Message Date
be25560858 WhiteHouse router configuration 2025-10-16 14:53:41 +07:00
e4bf326191 add Alex's laptop to networks 2025-10-10 15:38:28 +07:00
04fafa32d3 update kurogeek thinkpad zerotier id 2025-10-09 16:42:23 +07:00
ed4e045ffc rm unused args 2025-09-28 13:30:10 +07:00
fd6edd83c2 machines are accessed by zerotier ip 2025-09-28 13:21:46 +07:00
65faa70fa3 no nextcloud on vega 2025-09-28 12:45:29 +07:00
377b63437c no write permission on GLOM samba 2025-09-26 20:26:02 +07:00
43e8252459 samba for vega 2025-09-26 16:46:00 +07:00
800500f57e vega on new device 2025-09-26 12:04:02 +07:00
13 changed files with 430 additions and 296 deletions

2
.gitignore vendored
View File

@@ -2,4 +2,4 @@
# Ignore build outputs from performing a nix-build or `nix build` command
result
result-*
run-vm-*

19
flake.lock generated
View File

@@ -136,6 +136,24 @@
"type": "github"
}
},
"liminix": {
"flake": false,
"locked": {
"lastModified": 1760426231,
"narHash": "sha256-r8c5PKtsxAvtQ/k17GH+WNvP47Lr+AbExLMPdLtvAKE=",
"ref": "refs/heads/fix-gl-ar750",
"rev": "3f1f7c08d440130cce9262a93ce78ed7969d93cd",
"revCount": 1574,
"type": "git",
"url": "https://git.b4l.co.th/newedge/liminix"
},
"original": {
"ref": "refs/heads/fix-gl-ar750",
"rev": "3f1f7c08d440130cce9262a93ce78ed7969d93cd",
"type": "git",
"url": "https://git.b4l.co.th/newedge/liminix"
}
},
"nix-darwin": {
"inputs": {
"nixpkgs": [
@@ -207,6 +225,7 @@
"devshell": "devshell",
"flake-parts": "flake-parts",
"import-tree": "import-tree",
"liminix": "liminix",
"nixpkgs": "nixpkgs",
"treefmt-nix": "treefmt-nix"
}

View File

@@ -21,6 +21,10 @@
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
liminix = {
url = "git+https://git.b4l.co.th/newedge/liminix?ref=refs/heads/fix-gl-ar750&rev=3f1f7c08d440130cce9262a93ce78ed7969d93cd";
flake = false;
};
};
outputs =
{
@@ -38,6 +42,7 @@
./shell.nix
./machines
./routers
./inventories
./modules/clan/flake-module.nix
];

View File

@@ -1,19 +1,7 @@
{
inputs,
self,
lib,
pkgs,
...
}:
{
clan = {
inventory = {
machines = {
rigel.deploy.targetHost = "root@rigel.local";
vega.deploy.targetHost = "root@vega.local";
};
tags = {
glom = [ "vega" ];
b4l = [ "rigel" ];
@@ -73,7 +61,6 @@
input = "self";
};
roles.default.machines.b4l = { };
roles.default.machines.vega = { };
};
stirling-pdf = {
module = {

View File

@@ -1,13 +1,16 @@
{ config, ... }:
{
imports = [
(import ../../lib/auto-accept-zerotier-members.nix {
memberIds = [
"dbe44c0287" # Alex-gateway
"1b495eede9" # kurogeek-thinkpad
"b0e0b84fd3" # Alex
"2bd36db8cc" # kurogeek-thinkpad
];
})
];
system.stateVersion = "25.11";
clan.core.sops.defaultGroups = [ "admins" ];
clan.core.networking.targetHost = "root@[${config.clan.core.vars.generators.zerotier.files.zerotier-ip.value}]";
}

View File

@@ -10,12 +10,14 @@
(import ../../lib/auto-accept-zerotier-members.nix {
memberIds = [
"dbe44c0287" # Alex-gateway
"1b495eede9" # kurogeek-thinkpad
"b0e0b84fd3" # Alex
"2bd36db8cc" # kurogeek-thinkpad
];
})
];
clan.core.sops.defaultGroups = [ "admins" ];
clan.core.networking.targetHost = "root@[${config.clan.core.vars.generators.zerotier.files.zerotier-ip.value}]";
nixpkgs.hostPlatform = {
system = "x86_64-linux";

View File

@@ -1,7 +1,7 @@
{ lib, ... }:
let
hashDisk = disk: "os-${builtins.substring 0 5 (builtins.hashString "sha256" disk)}";
os = "/dev/disk/by-id/mmc-CUTB42_0x9d59499c";
os = "/dev/disk/by-id/mmc-CUTB42_0x95d14f9e";
vdev = [
"/dev/disk/by-id/ata-ST20000NM002H-3KV133_ZYD5RYRG"
"/dev/disk/by-id/ata-ST20000NM002H-3KV133_ZYD5S02X"

View File

@@ -23,8 +23,8 @@
},
"bluetooth": [
{
"index": 33,
"attached_to": 34,
"index": 31,
"attached_to": 33,
"class_list": ["usb", "bluetooth"],
"bus_type": {
"hex": "0086",
@@ -99,7 +99,7 @@
},
{
"index": 36,
"attached_to": 34,
"attached_to": 33,
"class_list": ["usb", "bluetooth"],
"bus_type": {
"hex": "0086",
@@ -597,7 +597,7 @@
"fpu_exception": true,
"cpuid_level": 32,
"write_protect": false,
"tlb_size": 32767,
"tlb_size": 32764,
"clflush_size": 64,
"cache_alignment": 64,
"address_sizes": {
@@ -636,7 +636,7 @@
},
"device": {
"hex": "0561",
"name": "0",
"name": "1",
"value": 1377
},
"revision": {
@@ -645,10 +645,10 @@
"value": 0
},
"serial": "000000004EBF",
"model": "0",
"model": "1",
"sysfs_id": "/class/block/sdb",
"sysfs_bus_id": "1:0:0:0",
"sysfs_device_link": "/devices/pci0000:00/0000:00:14.0/usb4/4-3/4-3:1.0/host1/target1:0:0/1:0:0:0",
"sysfs_bus_id": "1:0:0:1",
"sysfs_device_link": "/devices/pci0000:00/0000:00:14.0/usb4/4-3/4-3:1.0/host1/target1:0:0/1:0:0:1",
"unix_device_name": "/dev/sdb",
"unix_device_number": {
"type": 98,
@@ -657,10 +657,10 @@
"range": 16
},
"unix_device_names": [
"/dev/disk/by-id/ata-ST20000NM002H-3KV133_ZYD5RYRG",
"/dev/disk/by-id/usb-USB_3.0_Device_0_000000004EBF-0:0",
"/dev/disk/by-path/pci-0000:00:14.0-usb-0:3:1.0-scsi-0:0:0:0",
"/dev/disk/by-path/pci-0000:00:14.0-usbv3-0:3:1.0-scsi-0:0:0:0",
"/dev/disk/by-id/ata-ST20000NM002H-3KV133_ZYD5S02X",
"/dev/disk/by-id/usb-USB_3.0_Device_1_000000004EBF-0:1",
"/dev/disk/by-path/pci-0000:00:14.0-usb-0:3:1.0-scsi-0:0:0:1",
"/dev/disk/by-path/pci-0000:00:14.0-usbv3-0:3:1.0-scsi-0:0:0:1",
"/dev/sdb"
],
"unix_device_name2": "/dev/sg1",
@@ -706,7 +706,7 @@
"name": "Disk",
"value": 0
},
"serial": "0x9d59499c",
"serial": "0x95d14f9e",
"model": "Disk",
"sysfs_id": "/class/block/mmcblk0",
"sysfs_bus_id": "mmc0:0001",
@@ -719,7 +719,7 @@
"range": 32
},
"unix_device_names": [
"/dev/disk/by-id/mmc-CUTB42_0x9d59499c",
"/dev/disk/by-id/mmc-CUTB42_0x95d14f9e",
"/dev/mmcblk0"
],
"resources": [
@@ -745,180 +745,6 @@
},
{
"index": 29,
"attached_to": 25,
"class_list": ["disk", "block_device"],
"base_class": {
"hex": "0106",
"name": "Mass Storage Device",
"value": 262
},
"sub_class": {
"hex": "0000",
"name": "Disk",
"value": 0
},
"model": "Disk",
"sysfs_id": "/class/block/mmcblk0boot0",
"sysfs_bus_id": "mmcblk0",
"sysfs_device_link": "/devices/pci0000:00/0000:00:1a.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0",
"unix_device_name": "/dev/mmcblk0boot0",
"unix_device_number": {
"type": 98,
"major": 179,
"minor": 32,
"range": 32
},
"unix_device_names": ["/dev/mmcblk0boot0"],
"resources": [
{
"type": "disk_geo",
"cylinders": 128,
"heads": 4,
"sectors": 16,
"size": "0x0",
"geo_type": "logical"
},
{
"type": "size",
"unit": "sectors",
"value_1": 8192,
"value_2": 512
}
],
"driver": "mmcblk",
"drivers": ["mmcblk"]
},
{
"index": 30,
"attached_to": 22,
"class_list": ["disk", "usb", "scsi", "block_device"],
"bus_type": {
"hex": "0084",
"name": "SCSI",
"value": 132
},
"slot": {
"bus": 1,
"number": 0
},
"base_class": {
"hex": "0106",
"name": "Mass Storage Device",
"value": 262
},
"sub_class": {
"hex": "0000",
"name": "Disk",
"value": 0
},
"vendor": {
"hex": "152d",
"value": 5421
},
"device": {
"hex": "0561",
"name": "1",
"value": 1377
},
"revision": {
"hex": "0000",
"name": "~",
"value": 0
},
"serial": "000000004EBF",
"model": "1",
"sysfs_id": "/class/block/sdc",
"sysfs_bus_id": "1:0:0:1",
"sysfs_device_link": "/devices/pci0000:00/0000:00:14.0/usb4/4-3/4-3:1.0/host1/target1:0:0/1:0:0:1",
"unix_device_name": "/dev/sdc",
"unix_device_number": {
"type": 98,
"major": 8,
"minor": 32,
"range": 16
},
"unix_device_names": [
"/dev/disk/by-id/ata-ST20000NM002H-3KV133_ZYD5S02X",
"/dev/disk/by-id/usb-USB_3.0_Device_1_000000004EBF-0:1",
"/dev/disk/by-path/pci-0000:00:14.0-usb-0:3:1.0-scsi-0:0:0:1",
"/dev/disk/by-path/pci-0000:00:14.0-usbv3-0:3:1.0-scsi-0:0:0:1",
"/dev/sdc"
],
"unix_device_name2": "/dev/sg2",
"unix_device_number2": {
"type": 99,
"major": 21,
"minor": 2,
"range": 1
},
"resources": [
{
"type": "disk_geo",
"cylinders": 19074048,
"heads": 64,
"sectors": 32,
"size": "0x0",
"geo_type": "logical"
},
{
"type": "size",
"unit": "sectors",
"value_1": 39063650304,
"value_2": 512
}
],
"driver": "uas",
"driver_module": "uas",
"drivers": ["sd", "uas"],
"driver_modules": ["sd_mod", "uas"]
},
{
"index": 31,
"attached_to": 25,
"class_list": ["disk", "block_device"],
"base_class": {
"hex": "0106",
"name": "Mass Storage Device",
"value": 262
},
"sub_class": {
"hex": "0000",
"name": "Disk",
"value": 0
},
"model": "Disk",
"sysfs_id": "/class/block/mmcblk0boot1",
"sysfs_bus_id": "mmcblk0",
"sysfs_device_link": "/devices/pci0000:00/0000:00:1a.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0",
"unix_device_name": "/dev/mmcblk0boot1",
"unix_device_number": {
"type": 98,
"major": 179,
"minor": 64,
"range": 32
},
"unix_device_names": ["/dev/mmcblk0boot1"],
"resources": [
{
"type": "disk_geo",
"cylinders": 128,
"heads": 4,
"sectors": 16,
"size": "0x0",
"geo_type": "logical"
},
{
"type": "size",
"unit": "sectors",
"value_1": 8192,
"value_2": 512
}
],
"driver": "mmcblk",
"drivers": ["mmcblk"]
},
{
"index": 32,
"attached_to": 22,
"class_list": ["disk", "usb", "scsi", "block_device"],
"bus_type": {
@@ -957,27 +783,27 @@
},
"serial": "000000001532",
"model": "Generic STORAGE DEVICE",
"sysfs_id": "/class/block/sda",
"sysfs_id": "/class/block/sdc",
"sysfs_bus_id": "0:0:0:0",
"sysfs_device_link": "/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/host0/target0:0:0/0:0:0:0",
"unix_device_name": "/dev/sda",
"sysfs_device_link": "/devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1:1.0/host0/target0:0:0/0:0:0:0",
"unix_device_name": "/dev/sdc",
"unix_device_number": {
"type": 98,
"major": 8,
"minor": 0,
"minor": 32,
"range": 16
},
"unix_device_names": [
"/dev/disk/by-id/usb-Generic_STORAGE_DEVICE_000000001532-0:0",
"/dev/disk/by-path/pci-0000:00:14.0-usb-0:2:1.0-scsi-0:0:0:0",
"/dev/disk/by-path/pci-0000:00:14.0-usbv2-0:2:1.0-scsi-0:0:0:0",
"/dev/sda"
"/dev/disk/by-path/pci-0000:00:14.0-usb-0:1:1.0-scsi-0:0:0:0",
"/dev/disk/by-path/pci-0000:00:14.0-usbv2-0:1:1.0-scsi-0:0:0:0",
"/dev/sdc"
],
"unix_device_name2": "/dev/sg0",
"unix_device_name2": "/dev/sg2",
"unix_device_number2": {
"type": 99,
"major": 21,
"minor": 0,
"minor": 2,
"range": 1
},
"resources": [
@@ -1009,6 +835,90 @@
"drivers": ["sd", "usb-storage"],
"driver_modules": ["sd_mod", "usb_storage"],
"module_alias": "usb:v05E3p0749d1532dc00dsc00dp00ic08isc06ip50in00"
},
{
"index": 30,
"attached_to": 22,
"class_list": ["disk", "usb", "scsi", "block_device"],
"bus_type": {
"hex": "0084",
"name": "SCSI",
"value": 132
},
"slot": {
"bus": 1,
"number": 0
},
"base_class": {
"hex": "0106",
"name": "Mass Storage Device",
"value": 262
},
"sub_class": {
"hex": "0000",
"name": "Disk",
"value": 0
},
"vendor": {
"hex": "152d",
"value": 5421
},
"device": {
"hex": "0561",
"name": "0",
"value": 1377
},
"revision": {
"hex": "0000",
"name": "~",
"value": 0
},
"serial": "000000004EBF",
"model": "0",
"sysfs_id": "/class/block/sda",
"sysfs_bus_id": "1:0:0:0",
"sysfs_device_link": "/devices/pci0000:00/0000:00:14.0/usb4/4-3/4-3:1.0/host1/target1:0:0/1:0:0:0",
"unix_device_name": "/dev/sda",
"unix_device_number": {
"type": 98,
"major": 8,
"minor": 0,
"range": 16
},
"unix_device_names": [
"/dev/disk/by-id/ata-ST20000NM002H-3KV133_ZYD5RYRG",
"/dev/disk/by-id/usb-USB_3.0_Device_0_000000004EBF-0:0",
"/dev/disk/by-path/pci-0000:00:14.0-usb-0:3:1.0-scsi-0:0:0:0",
"/dev/disk/by-path/pci-0000:00:14.0-usbv3-0:3:1.0-scsi-0:0:0:0",
"/dev/sda"
],
"unix_device_name2": "/dev/sg0",
"unix_device_number2": {
"type": 99,
"major": 21,
"minor": 0,
"range": 1
},
"resources": [
{
"type": "disk_geo",
"cylinders": 19074048,
"heads": 64,
"sectors": 32,
"size": "0x0",
"geo_type": "logical"
},
{
"type": "size",
"unit": "sectors",
"value_1": 39063650304,
"value_2": 512
}
],
"driver": "uas",
"driver_module": "uas",
"drivers": ["sd", "uas"],
"driver_modules": ["sd_mod", "uas"]
}
],
"graphics_card": [
@@ -1118,7 +1028,7 @@
],
"hub": [
{
"index": 34,
"index": 33,
"attached_to": 22,
"class_list": ["usb", "hub"],
"bus_type": {
@@ -1268,7 +1178,7 @@
"module_alias": "usb:v1D6Bp0003d0615dc09dsc00dp03ic09isc00ip00in00"
},
{
"index": 39,
"index": 38,
"attached_to": 9,
"class_list": ["usb", "hub"],
"bus_type": {
@@ -1348,7 +1258,7 @@
"module_alias": "usb:v1D6Bp0002d0615dc09dsc00dp01ic09isc00ip00in00"
},
{
"index": 41,
"index": 40,
"attached_to": 9,
"class_list": ["usb", "hub"],
"bus_type": {
@@ -1420,8 +1330,8 @@
],
"keyboard": [
{
"index": 38,
"attached_to": 34,
"index": 39,
"attached_to": 33,
"class_list": ["keyboard", "usb"],
"bus_type": {
"hex": "0086",
@@ -1458,8 +1368,8 @@
"value": 0
},
"model": "Logitech USB Receiver",
"sysfs_id": "/devices/pci0000:00/0000:00:14.0/usb3/3-5/3-5:1.0",
"sysfs_bus_id": "3-5:1.0",
"sysfs_id": "/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0",
"sysfs_bus_id": "3-2:1.0",
"resources": [
{
"type": "baud",
@@ -1529,7 +1439,7 @@
{
"type": "mem",
"base": 0,
"range": 8096096256,
"range": 8097124352,
"enabled": true,
"access": "read_write",
"prefetch": "unknown"
@@ -1718,8 +1628,8 @@
],
"mouse": [
{
"index": 42,
"attached_to": 34,
"index": 32,
"attached_to": 33,
"class_list": ["mouse", "usb"],
"bus_type": {
"hex": "0086",
@@ -1758,8 +1668,8 @@
"compat_vendor": "Unknown",
"compat_device": "Generic USB Mouse",
"model": "Logitech USB Receiver",
"sysfs_id": "/devices/pci0000:00/0000:00:14.0/usb3/3-5/3-5:1.1",
"sysfs_bus_id": "3-5:1.1",
"sysfs_id": "/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1",
"sysfs_bus_id": "3-2:1.1",
"resources": [
{
"type": "baud",
@@ -1964,7 +1874,7 @@
"resources": [
{
"type": "hwaddr",
"address": 48
"address": 54
},
{
"type": "io",
@@ -1989,7 +1899,7 @@
},
{
"type": "phwaddr",
"address": 54
"address": 53
},
{
"type": "wlan",
@@ -2082,8 +1992,8 @@
],
"network_interface": [
{
"index": 43,
"attached_to": 13,
"index": 41,
"attached_to": 0,
"class_list": ["network_interface"],
"base_class": {
"hex": "0107",
@@ -2091,32 +2001,17 @@
"value": 263
},
"sub_class": {
"hex": "000a",
"name": "WLAN",
"value": 10
"hex": "0000",
"name": "Loopback",
"value": 0
},
"model": "WLAN network interface",
"sysfs_id": "/class/net/wlan0",
"sysfs_device_link": "/devices/pci0000:00/0000:00:1c.0/0000:01:00.0",
"unix_device_name": "wlan0",
"unix_device_names": ["wlan0"],
"resources": [
{
"type": "hwaddr",
"address": 48
},
{
"type": "phwaddr",
"address": 54
}
],
"driver": "rtw89_8852be",
"driver_module": "rtw89_8852be",
"drivers": ["rtw89_8852be"],
"driver_modules": ["rtw89_8852be"]
"model": "Loopback network interface",
"sysfs_id": "/class/net/lo",
"unix_device_name": "lo",
"unix_device_names": ["lo"]
},
{
"index": 44,
"index": 42,
"attached_to": 11,
"class_list": ["network_interface"],
"base_class": {
@@ -2150,8 +2045,8 @@
"driver_modules": ["igc"]
},
{
"index": 45,
"attached_to": 0,
"index": 43,
"attached_to": 13,
"class_list": ["network_interface"],
"base_class": {
"hex": "0107",
@@ -2159,14 +2054,29 @@
"value": 263
},
"sub_class": {
"hex": "0000",
"name": "Loopback",
"value": 0
"hex": "000a",
"name": "WLAN",
"value": 10
},
"model": "Loopback network interface",
"sysfs_id": "/class/net/lo",
"unix_device_name": "lo",
"unix_device_names": ["lo"]
"model": "WLAN network interface",
"sysfs_id": "/class/net/wlan0",
"sysfs_device_link": "/devices/pci0000:00/0000:00:1c.0/0000:01:00.0",
"unix_device_name": "wlan0",
"unix_device_names": ["wlan0"],
"resources": [
{
"type": "hwaddr",
"address": 54
},
{
"type": "phwaddr",
"address": 53
}
],
"driver": "rtw89_8852be",
"driver_module": "rtw89_8852be",
"drivers": ["rtw89_8852be"],
"driver_modules": ["rtw89_8852be"]
}
],
"pci": [

View File

@@ -1,34 +0,0 @@
{ config, pkgs, ... }:
let
# ncDomain = "${config.clan.core.vars.generators.vega-nextcloud.files.subdomain.value}.${config.networking.fqdn}";
ncDomain = "${config.networking.fqdn}";
in
{
clan.core.vars.generators.vega-nextcloud = {
files.subdomain.secret = false;
prompts = {
subdomain = {
persist = true;
type = "line";
description = "Sub-domain for Nextcloud app. Default:(cloud)";
};
};
script = ''cat $prompts/subdomain || echo -n "cloud" > $out/subdomain'';
};
networking.firewall.allowedTCPPorts = [
80
443
];
services.nextcloud = {
hostName = ncDomain;
package = pkgs.nextcloud31;
};
# services.nginx.virtualHosts."${ncDomain}" = {
# # useACMEHost = "${config.networking.fqdn}";
# # forceSSL = true;
# };
}

View File

@@ -0,0 +1,93 @@
{
config,
lib,
...
}:
let
sambaUser = lib.filterAttrs (
name: user: user.isNormalUser && builtins.elem "samba" user.extraGroups
) config.users.users;
sharedFolders = {
GLOM.users = [
"w"
"kurogeek"
"berwn"
];
};
in
{
services.samba = {
enable = true;
openFirewall = true;
settings = {
global = {
security = "user";
workgroup = "WORKGROUP";
"server string" = "Glom Vega";
interfaces = "eth* en*";
"max log size" = "50";
"dns proxy" = false;
"syslog only" = true;
"map to guest" = "Bad User";
"guest account" = "nobody";
};
}
// lib.mapAttrs (share: opts: {
path = "/mnt/hdd/samba/${share}";
comment = share;
"force user" = share;
"force group" = share;
public = "yes";
"guest ok" = "yes";
"create mask" = "0640";
"directory mask" = "0750";
writable = "no";
browseable = "yes";
printable = "no";
# TODO
# "valid users" = toString opts.users;
}) sharedFolders;
};
users.users = lib.mapAttrs (share: opts: {
isSystemUser = true;
group = share;
}) sharedFolders;
users.groups = lib.mapAttrs (share: opts: { }) sharedFolders;
systemd.services.samba-smbd.postStart =
lib.concatMapStrings (
user:
let
password = config.clan.core.vars.generators."${user}-smb-password".files.password.path;
in
''
mkdir -p /mnt/hdd/samba/${user}
chown ${user}:users /mnt/hdd/samba/${user}
# if a password is unchanged, this will error
(echo $(<${password}); echo $(<${password})) | ${config.services.samba.package}/bin/smbpasswd -s -a ${user}
''
) (lib.attrNames sambaUser)
+ lib.concatMapStrings (share: ''
mkdir -p /mnt/hdd/samba/${share}
chown ${share}:${share} /mnt/hdd/samba/${share}
'') (lib.attrNames sharedFolders);
services.samba-wsdd = {
enable = true;
openFirewall = true;
};
services.avahi = {
publish.enable = true;
publish.userServices = true;
# ^^ Needed to allow samba to automatically register mDNS records (without the need for an `extraServiceFile`
nssmdns4 = true;
# ^^ Not one hundred percent sure if this is needed- if it aint broke, don't fix it
enable = true;
openFirewall = true;
};
}

9
routers/default.nix Normal file
View File

@@ -0,0 +1,9 @@
{ inputs, ... }:
{
flake.legacyPackages = {
whitehouse-router = import "${inputs.liminix}/default.nix" {
device = (import "${inputs.liminix}/devices/gl-ar750");
liminix-config = import ./white-house/configuration.nix { inherit inputs; };
};
};
}

View File

@@ -0,0 +1,120 @@
{ inputs }:
{
config,
pkgs,
modulesPath,
lib,
...
}:
let
secrets = {
firewallRules = { };
}
// (import ./secrets.nix);
wirelessConfig = {
country_code = "TH";
inherit (secrets) wpa_passphrase;
wmm_enabled = 1;
};
svc = config.system.service;
in
{
imports = [
"${inputs.liminix}/modules/wlan.nix"
"${inputs.liminix}/modules/network"
"${inputs.liminix}/modules/vlan"
"${inputs.liminix}/modules/ssh"
"${inputs.liminix}/modules/bridge"
"${modulesPath}/profiles/gateway.nix"
];
hostname = "whitehouse";
boot = {
tftp = {
freeSpaceBytes = 3 * 1024 * 1024;
serverip = "${secrets.lan.prefix}.148";
ipaddr = "${secrets.lan.prefix}.251";
};
};
services.sshd = svc.ssh.build {
authorizedKeys.root = secrets.root.openssh.authorizedKeys.keys;
};
users.root = secrets.root;
services.resolvconf = lib.mkForce (
pkgs.liminix.services.oneshot rec {
name = "resolvconf";
up = ''
( in_outputs ${name}
echo "nameserver $(output ${config.services.wan} ns1)" > resolv.conf
echo "nameserver $(output ${config.services.wan} ns2)" >> resolv.conf
chmod 0444 resolv.conf
)
'';
}
);
profile.gateway = {
lan = {
interfaces = with config.hardware.networkInterfaces; [
wlan
wlan5
lan
];
inherit (secrets.lan) prefix;
address = {
family = "inet";
address = "${secrets.lan.prefix}.1";
prefixLength = 24;
};
dhcp = {
start = 10;
end = 240;
hosts = { };
localDomain = "lan";
};
};
wan = {
interface = svc.pppoe.build {
interface = config.hardware.networkInterfaces.wan;
username = secrets.l2tp.name;
password = secrets.l2tp.password;
};
dhcp6.enable = true;
};
firewall = {
enable = true;
rules = secrets.firewallRules;
};
wireless.networks = {
"${secrets.ssid}" = {
interface = config.hardware.networkInterfaces.wlan;
hw_mode = "g";
channel = "2";
ieee80211n = 1;
}
// wirelessConfig;
"${secrets.ssid}-5" = rec {
interface = config.hardware.networkInterfaces.wlan5;
hw_mode = "a";
channel = 36;
ht_capab = "[HT40+]";
vht_oper_chwidth = 1;
vht_oper_centr_freq_seg0_idx = channel + 6;
ieee80211n = 1;
ieee80211ac = 1;
}
// wirelessConfig;
};
};
defaultProfile.packages = with pkgs; [
busybox
iw
iptables
];
}

View File

@@ -0,0 +1,20 @@
{
wpa_passphrase = "";
ssid = "WhiteHouse";
l2tp = {
name = "";
password = "";
};
root = {
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEcZ/p1Ofa9liwIzPWzNtONhJ7+FUWd2lCz33r81t8+w kurogeek@kurogeek"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAB/raxJR8gASmquP63weHelbi+da2WBJR1DgzHPNz/f"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDuhpzDHBPvn8nv8RH1MRomDOaXyP4GziQm7r3MZ1Syk"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAmgyEGuY/r7SDlJgrzYmQqpcWS5W+fCzRi3OS59ne4W openpgp:0xFF687387"
];
};
lan = {
prefix = "192.168.1";
};
}