liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 9441f48819ae1b385fc340385d6d7e90c575afae
parent 2e50368bd224c54e2c72e0c902ae244fd3ad13ee
Author: Daniel Barlow <dan@telent.net>
Date:   Thu, 13 Jul 2023 19:44:14 +0100

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

Diffstat:
Mexamples/rotuer.nix | 9++-------
Amodules/ppp.nix | 24++++++++++++++++++++++++
2 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/examples/rotuer.nix b/examples/rotuer.nix @@ -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 diff --git a/modules/ppp.nix b/modules/ppp.nix @@ -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"; + }; + }; + }; +}