Structure
Each extension is created using delib.extension
.
Function arguments
name
: string. Must be unique. Used to look up the extension indelib.extensions
ordelib.callExtensions
.description
: string. A short description. Defaults to""
, but is required for official extensions.maintainers
: a list of maintainers responsible for the extension. Defaults to[]
.config
: overlay. If a lambda with 1 parameter or an attrset is provided, it will be converted into a lambda with 2 parameters usingnixpkgs.lib.toExtension
, where the lambda with 1 parameter is treated asprev
. Defaults tofinal: prev: {}
.initialConfig
: an object to which overlays are applied, or null. If an attrset is provided, it will be converted into a lambda with 1 parameterfinal
. If you merge extensions, only one of them may have a non-nullinitialConfig
. Defaults tonull
.configOrder
: integer. Specifies the order in which theconfig
of this extension is composed with theconfig
of other extensions when merged. The smaller the number, the earlier it is applied. Defaults to0
.libExtension
: an overlay with the extension's configuration. If a lambda with 1 parameter is provided, it isconfig
; if two -config
andprev
. Applied todelib
. Defaults toconfig: final: prev: {}
.libExtensionOrder
: integer. Specifies the order in which thelibExtension
of this extension is composed with thelibExtension
of other extensions when merged. The smaller the number, the earlier it is applied. Defaults to0
.modules
: a list of modules with the extension's configuration. If a lambda with 1 parameter is provided, that parameter isconfig
. The listed modules will be imported into configurations using this extension. It is strongly discouraged to usedelib
from the arguments of the file where the extension is defined when declaring modules. Instead, usedelib
inside the modules themselves:modules = [({delib, ...}: delib.module {/* ... */})]
. Defaults to[]
.
Pseudocode
nix
delib.extension {
name = "test";
description = "";
maintainers = with delib.maintainers; [sjohn];
# config = {};
# config = prev: {};
config = final: prev: {};
# initialConfig = {};
# initialConfig = final: {}
initialConfig = null;
configOrder = 0;
# libExtension = {};
# libExtension = config: {};
# libExtension = config: prev: {};
libExtension = config: final: prev: {};
libExtensionOrder = 0;
# modules = config: [];
modules = [];
}