hackens-org-configurations/machines/router/configuration.nix

55 lines
1.5 KiB
Nix
Raw Normal View History

2023-12-04 17:42:06 +01:00
# This is an example configuration for a "typical" small office/home
# router and wifi access point.
# You need to copy it to another filename and change the configuration
# wherever the text "EDIT" appears - please consult the tutorial
# documentation for details.
2024-01-11 01:25:59 +01:00
{ config, pkgs, lib, modulesPath, ... } :
2023-12-04 17:42:06 +01:00
let
inherit (pkgs.liminix.services) bundle oneshot longrun;
inherit (pkgs) serviceFns;
# EDIT: you can pick your preferred RFC1918 address space
# for NATted connections, if you don't like this one.
svc = config.system.service;
in rec {
boot = {
tftp = {
freeSpaceBytes = 3 * 1024 * 1024;
serverip = "10.0.0.1";
ipaddr = "10.0.0.8";
};
};
hardware.ubi = {
2024-01-26 19:43:04 +01:00
# PLEASE remove this when using the real ROM. These are just tweaks to make tftpboot working
minIOSize = lib.mkForce "1";
eraseBlockSize = lib.mkForce "130944";
};
2023-12-04 17:42:06 +01:00
imports = [
2024-01-26 19:43:04 +01:00
(modulesPath + "/network")
(modulesPath + "/ssh")
(modulesPath + "/outputs/ubimage.nix")
2023-12-04 17:42:06 +01:00
];
rootfsType = "ubifs";
2024-01-11 01:25:59 +01:00
hostname = "hackens-router"; # EDIT
2023-12-04 17:42:06 +01:00
services.int = svc.network.address.build {
interface = config.hardware.networkInterfaces.wan;
family = "inet";
address = "10.0.0.8";
prefixLength = 24;
2023-12-04 17:42:06 +01:00
};
services.sshd = svc.ssh.build { };
users.root = {
# EDIT: choose a root password and then use
# "mkpasswd -m sha512crypt" to determine the hash.
# It should start wirh $6$.
passwd = "$6$9XlVymX951ai.c2C$SYtEF2Ykcud8VRuLRxfQRfuc9h7oJpVo.xDEv6fTWjBngMj3bPN9GbFMv3r.T.K2wIj1rTo9j1m58G.GTPKWo/";
2023-12-04 17:42:06 +01:00
};
}