new ppp module, used by rotuer

The objective here is that services which depend on global config
(e.g. kernel config or busybox options or static paths in the
filesystem) now live under config.system.service, and are added
to that collection by the module that defines the necessary state.

This is a first step: the services will be configured by a typechecked
attr set instead of the arbitrary arguments that
pkgs.liminix.networking.pppoe accepts
module-based-network
Daniel Barlow 2023-07-13 19:44:14 +01:00
parent 2e50368bd2
commit 9441f48819
2 changed files with 26 additions and 7 deletions

View File

@ -14,7 +14,6 @@ let
dnsmasq
hostapd
interface
pppoe
route;
inherit (pkgs.liminix.services) oneshot longrun bundle target;
inherit (pkgs)
@ -35,16 +34,12 @@ in rec {
imports = [
../modules/wlan.nix
../modules/standard.nix
../modules/ppp.nix
];
rootfsType = "jffs2";
hostname = "rotuer";
kernel = {
config = {
PPP = "y";
PPP_BSDCOMP = "y";
PPP_DEFLATE = "y";
PPP_ASYNC = "y";
PPP_SYNC_TTY = "y";
BRIDGE = "y";
NETFILTER_XT_MATCH_CONNTRACK = "y";
@ -196,7 +191,7 @@ in rec {
services.wan =
let iface = config.hardware.networkInterfaces.wan;
in pppoe iface {
in config.system.service.pppoe iface {
ppp-options = [
"debug" "+ipv6" "noauth"
"name" secrets.l2tp.name

24
modules/ppp.nix Normal file
View File

@ -0,0 +1,24 @@
{ lib, pkgs, config, ...}:
let
inherit (lib) mkEnableOption mkOption types isDerivation hasAttr ;
inherit (pkgs.pseudofile) dir symlink;
inherit (pkgs) stdenv wireless-regdb;
in {
options = {
system.service.pppoe = mkOption {
type = types.functionTo (types.functionTo types.package);
};
};
config = {
system.service.pppoe = pkgs.liminix.networking.pppoe;
kernel = {
config = {
PPP = "y";
PPP_BSDCOMP = "y";
PPP_DEFLATE = "y";
PPP_ASYNC = "y";
PPP_SYNC_TTY = "y";
};
};
};
}