hackens-org-configurations/machines/router/configuration.nix
2024-01-26 19:43:04 +01:00

54 lines
1.5 KiB
Nix

# 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.
{ config, pkgs, lib, modulesPath, ... } :
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 = {
# PLEASE remove this when using the real ROM. These are just tweaks to make tftpboot working
minIOSize = lib.mkForce "1";
eraseBlockSize = lib.mkForce "130944";
};
imports = [
(modulesPath + "/network")
(modulesPath + "/ssh")
(modulesPath + "/outputs/ubimage.nix")
];
rootfsType = "ubifs";
hostname = "hackens-router"; # EDIT
services.int = svc.network.address.build {
interface = config.hardware.networkInterfaces.wan;
family = "inet";
address = "10.0.0.8";
prefixLength = 24;
};
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/";
};
}