2023-02-26 00:12:55 +01:00
|
|
|
# This is not part of Liminix per se. This is my "scratchpad"
|
|
|
|
# configuration for the device I'm testing with.
|
|
|
|
#
|
|
|
|
# Parts of it do do things that Liminix eventually needs to do, but
|
|
|
|
# don't look in here for solutions - just for identifying the
|
|
|
|
# problems.
|
|
|
|
|
|
|
|
|
2024-03-18 01:05:43 +01:00
|
|
|
{ config, pkgs, lib, modulesPath, ... } :
|
2023-02-26 00:12:55 +01:00
|
|
|
let
|
2024-02-11 10:10:03 +01:00
|
|
|
secrets = {
|
|
|
|
domainName = "fake.liminix.org";
|
|
|
|
firewallRules = {};
|
|
|
|
} // (import ./rotuer-secrets.nix);
|
2024-03-18 01:05:43 +01:00
|
|
|
inherit (pkgs.liminix.services) oneshot bundle;
|
2023-09-04 23:05:42 +02:00
|
|
|
inherit (pkgs) serviceFns;
|
2023-07-20 12:28:45 +02:00
|
|
|
svc = config.system.service;
|
2023-07-23 00:37:01 +02:00
|
|
|
wirelessConfig = {
|
|
|
|
country_code = "GB";
|
|
|
|
inherit (secrets) wpa_passphrase;
|
|
|
|
wmm_enabled = 1;
|
|
|
|
};
|
|
|
|
|
2023-02-26 00:12:55 +01:00
|
|
|
in rec {
|
|
|
|
boot = {
|
|
|
|
tftp = {
|
2023-04-24 00:29:53 +02:00
|
|
|
freeSpaceBytes = 3 * 1024 * 1024;
|
2023-02-26 00:12:55 +01:00
|
|
|
serverip = "10.0.0.1";
|
|
|
|
ipaddr = "10.0.0.8";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
imports = [
|
2024-03-18 01:05:43 +01:00
|
|
|
"${modulesPath}/profiles/gateway.nix"
|
|
|
|
"${modulesPath}/schnapps"
|
|
|
|
"${modulesPath}/outputs/btrfs.nix"
|
|
|
|
"${modulesPath}/outputs/extlinux.nix"
|
2023-02-26 00:12:55 +01:00
|
|
|
];
|
2023-05-20 23:34:57 +02:00
|
|
|
hostname = "rotuer";
|
2024-01-07 17:43:43 +01:00
|
|
|
rootfsType = "btrfs";
|
2024-01-08 19:54:49 +01:00
|
|
|
rootOptions = "subvol=@";
|
2024-01-08 19:58:07 +01:00
|
|
|
boot.loader.extlinux.enable = true;
|
2023-02-26 00:12:55 +01:00
|
|
|
|
2024-03-18 01:05:43 +01:00
|
|
|
profile.gateway = {
|
|
|
|
lan = {
|
|
|
|
interfaces = with config.hardware.networkInterfaces;
|
|
|
|
[
|
|
|
|
wlan wlan5
|
|
|
|
lan0 lan1 lan2 lan3 lan4
|
|
|
|
];
|
|
|
|
inherit (secrets.lan) prefix;
|
|
|
|
address = {
|
|
|
|
family = "inet"; address ="${secrets.lan.prefix}.1"; prefixLength = 24;
|
|
|
|
};
|
|
|
|
dhcp = {
|
|
|
|
start = 10;
|
|
|
|
end = 240;
|
|
|
|
hosts = { } // lib.optionalAttrs (builtins.pathExists ./static-leases.nix) (import ./static-leases.nix);
|
|
|
|
localDomain = "lan";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
wan = {
|
|
|
|
interface = config.hardware.networkInterfaces.wan;
|
|
|
|
username = secrets.l2tp.name;
|
|
|
|
password = secrets.l2tp.password;
|
|
|
|
dhcp6.enable = true;
|
|
|
|
};
|
|
|
|
firewall = {
|
|
|
|
enable = true;
|
|
|
|
rules =
|
|
|
|
let defaults = import ./demo-firewall.nix;
|
|
|
|
in lib.recursiveUpdate defaults 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;
|
|
|
|
};
|
2023-08-28 00:45:27 +02:00
|
|
|
};
|
2023-03-01 23:24:58 +01:00
|
|
|
|
2023-08-05 15:16:54 +02:00
|
|
|
services.ntp = svc.ntp.build {
|
2023-07-23 00:22:45 +02:00
|
|
|
pools = { "pool.ntp.org" = ["iburst"]; };
|
|
|
|
makestep = { threshold = 1.0; limit = 3; };
|
|
|
|
};
|
2023-04-23 19:22:39 +02:00
|
|
|
|
2023-08-10 23:53:21 +02:00
|
|
|
services.sshd = svc.ssh.build { };
|
2023-03-04 01:39:54 +01:00
|
|
|
|
2023-05-20 23:48:30 +02:00
|
|
|
users.root = secrets.root;
|
2023-03-04 01:39:54 +01:00
|
|
|
|
2023-06-20 21:13:59 +02:00
|
|
|
defaultProfile.packages = with pkgs; [
|
|
|
|
min-collect-garbage
|
2024-02-12 00:30:46 +01:00
|
|
|
nftables
|
|
|
|
strace
|
|
|
|
tcpdump
|
2024-02-16 19:30:24 +01:00
|
|
|
s6
|
2023-06-20 21:13:59 +02:00
|
|
|
];
|
2023-12-13 22:54:15 +01:00
|
|
|
|
2024-02-16 19:30:24 +01:00
|
|
|
programs.busybox = {
|
|
|
|
applets = [
|
|
|
|
"fdisk" "sfdisk"
|
|
|
|
];
|
|
|
|
options = {
|
|
|
|
FEATURE_FANCY_TAIL = "y";
|
|
|
|
};
|
|
|
|
};
|
2023-02-26 00:12:55 +01:00
|
|
|
}
|