move typeChecked into pkgs.liminix.lib
This commit is contained in:
parent
69e6eb5a89
commit
682183a88d
4 changed files with 25 additions and 12 deletions
|
@ -5,11 +5,7 @@ let
|
|||
inherit (pkgs.liminix.networking) address interface;
|
||||
inherit (pkgs.liminix.services) bundle;
|
||||
|
||||
type_service = types.package // {
|
||||
name = "service";
|
||||
description = "s6-rc service";
|
||||
check = x: isDerivation x && hasAttr "serviceType" x;
|
||||
};
|
||||
type_service = pkgs.liminix.lib.types.service;
|
||||
|
||||
in {
|
||||
options = {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
final: prev:
|
||||
let
|
||||
extraPkgs = import ./pkgs/default.nix { inherit (final) callPackage; };
|
||||
extraPkgs = import ./pkgs/default.nix {
|
||||
inherit (final) lib callPackage;
|
||||
};
|
||||
inherit (final) fetchpatch;
|
||||
lua_no_readline = prev.lua5_3.overrideAttrs(o: {
|
||||
name = "lua-tty";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
callPackage
|
||||
, lib
|
||||
}:
|
||||
{
|
||||
pseudofile = callPackage ./pseudofile {};
|
||||
|
@ -10,6 +11,23 @@
|
|||
squashfs = callPackage ./liminix-tools/builders/squashfs.nix {};
|
||||
kernel = callPackage ./kernel {};
|
||||
};
|
||||
lib = {
|
||||
types = {
|
||||
service =
|
||||
let inherit (lib) types isDerivation hasAttr;
|
||||
in types.package // {
|
||||
name = "service";
|
||||
description = "s6-rc service";
|
||||
check = x: isDerivation x && hasAttr "serviceType" x;
|
||||
};
|
||||
};
|
||||
typeChecked = caller: type: value:
|
||||
let
|
||||
inherit (lib) types mergeDefinitions;
|
||||
defs = [{ file = caller; inherit value; }];
|
||||
type' = types.submodule { options = type; };
|
||||
in (mergeDefinitions [] type' defs).mergedValue;
|
||||
};
|
||||
};
|
||||
writeFennelScript = callPackage ./write-fennel-script {};
|
||||
writeAshScript = callPackage ./write-ash-script {};
|
||||
|
|
|
@ -8,26 +8,23 @@
|
|||
} :
|
||||
let
|
||||
inherit (liminix.services) longrun;
|
||||
inherit (liminix.lib) typeChecked;
|
||||
inherit (lib)
|
||||
mergeDefinitions
|
||||
mkEnableOption mkOption isType types isDerivation hasAttr;
|
||||
t = {
|
||||
interface = mkOption {
|
||||
type = types.package; # actually a service
|
||||
type = liminix.lib.types.service;
|
||||
description = "ethernet interface to run PPPoE over";
|
||||
};
|
||||
ppp-options = mkOption {
|
||||
type = types.listOf types.str;
|
||||
};
|
||||
};
|
||||
t' = types.submodule { options = t; };
|
||||
typeChecked = type: value:
|
||||
let defs = [{ file = "pppoe.nix"; inherit value; }];
|
||||
in (lib.mergeDefinitions [ ] type defs).mergedValue;
|
||||
in
|
||||
params:
|
||||
let
|
||||
inherit (typeChecked t' params) ppp-options interface;
|
||||
inherit (typeChecked "pppoe.nix" t params) ppp-options interface;
|
||||
name = "${interface.device}.pppoe";
|
||||
ip-up = writeAshScript "ip-up" {} ''
|
||||
. ${serviceFns}
|
||||
|
|
Loading…
Reference in a new issue