liminix

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

commit 3ea40f95dca4a0d254708270b385380383bffffd
parent 2942c465b9b82287dc3c034a965f4c29c305673f
Author: Daniel Barlow <dan@telent.net>
Date:   Thu, 10 Aug 2023 22:53:45 +0100

convert pppoe to serviceDefn

Diffstat:
Mexamples/rotuer.nix | 2+-
Mmodules/ppp/default.nix | 14++++++++++++--
Mmodules/ppp/pppoe.nix | 19+------------------
3 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/examples/rotuer.nix b/examples/rotuer.nix @@ -112,7 +112,7 @@ in rec { domain = "fake.liminix.org"; }; - services.wan = svc.pppoe { + services.wan = svc.pppoe.build { interface = config.hardware.networkInterfaces.wan; ppp-options = [ "debug" "+ipv6" "noauth" diff --git a/modules/ppp/default.nix b/modules/ppp/default.nix @@ -11,14 +11,24 @@ { lib, pkgs, config, ...}: let inherit (lib) mkOption types; + inherit (pkgs) liminix; in { options = { system.service.pppoe = mkOption { - type = types.functionTo types.package; + type = liminix.lib.types.serviceDefn; }; }; config = { - system.service.pppoe = pkgs.callPackage ./pppoe.nix {}; + system.service.pppoe = pkgs.liminix.callService ./pppoe.nix { + interface = mkOption { + type = liminix.lib.types.service; + description = "ethernet interface to run PPPoE over"; + }; + ppp-options = mkOption { + type = types.listOf types.str; + description = "options supplied on ppp command line"; + }; + }; kernel = { config = { PPP = "y"; diff --git a/modules/ppp/pppoe.nix b/modules/ppp/pppoe.nix @@ -6,25 +6,9 @@ , writeAshScript , serviceFns } : +{ interface, ppp-options }: let inherit (liminix.services) longrun; - inherit (liminix.lib) typeChecked; - inherit (lib) mkOption types; - - t = { - interface = mkOption { - type = liminix.lib.types.service; - description = "ethernet interface to run PPPoE over"; - }; - ppp-options = mkOption { - type = types.listOf types.str; - description = "options supplied on ppp command line"; - }; - }; -in -params: -let - inherit (typeChecked "pppoe.nix" t params) interface ppp-options; name = "${interface.device}.pppoe"; ip-up = writeAshScript "ip-up" {} '' . ${serviceFns} @@ -55,7 +39,6 @@ let "usepeerdns" "logfd" "2" ]; - in longrun { inherit name;