convert pppoe to serviceDefn
This commit is contained in:
parent
2942c465b9
commit
3ea40f95dc
3 changed files with 14 additions and 21 deletions
|
@ -112,7 +112,7 @@ in rec {
|
||||||
domain = "fake.liminix.org";
|
domain = "fake.liminix.org";
|
||||||
};
|
};
|
||||||
|
|
||||||
services.wan = svc.pppoe {
|
services.wan = svc.pppoe.build {
|
||||||
interface = config.hardware.networkInterfaces.wan;
|
interface = config.hardware.networkInterfaces.wan;
|
||||||
ppp-options = [
|
ppp-options = [
|
||||||
"debug" "+ipv6" "noauth"
|
"debug" "+ipv6" "noauth"
|
||||||
|
|
|
@ -11,14 +11,24 @@
|
||||||
{ lib, pkgs, config, ...}:
|
{ lib, pkgs, config, ...}:
|
||||||
let
|
let
|
||||||
inherit (lib) mkOption types;
|
inherit (lib) mkOption types;
|
||||||
|
inherit (pkgs) liminix;
|
||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
system.service.pppoe = mkOption {
|
system.service.pppoe = mkOption {
|
||||||
type = types.functionTo types.package;
|
type = liminix.lib.types.serviceDefn;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config = {
|
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 = {
|
kernel = {
|
||||||
config = {
|
config = {
|
||||||
PPP = "y";
|
PPP = "y";
|
||||||
|
|
|
@ -6,25 +6,9 @@
|
||||||
, writeAshScript
|
, writeAshScript
|
||||||
, serviceFns
|
, serviceFns
|
||||||
} :
|
} :
|
||||||
|
{ interface, ppp-options }:
|
||||||
let
|
let
|
||||||
inherit (liminix.services) longrun;
|
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";
|
name = "${interface.device}.pppoe";
|
||||||
ip-up = writeAshScript "ip-up" {} ''
|
ip-up = writeAshScript "ip-up" {} ''
|
||||||
. ${serviceFns}
|
. ${serviceFns}
|
||||||
|
@ -55,7 +39,6 @@ let
|
||||||
"usepeerdns"
|
"usepeerdns"
|
||||||
"logfd" "2"
|
"logfd" "2"
|
||||||
];
|
];
|
||||||
|
|
||||||
in
|
in
|
||||||
longrun {
|
longrun {
|
||||||
inherit name;
|
inherit name;
|
||||||
|
|
Loading…
Reference in a new issue