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