-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathoverridable-package.nix
29 lines (29 loc) · 1.06 KB
/
overridable-package.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
topLevel@{ flake-parts-lib, inputs, lib, ... }: {
flake.flakeModules.overridablePackage = {
options.perSystem = flake-parts-lib.mkPerSystemOption ({ pkgs, ... }: {
options.ml-ops.overridablePackage = lib.mkOption {
default = { };
type = lib.types.deferredModuleWith {
staticModules = [
(overridablePackage: {
options.base-package = lib.mkOption {
type = lib.types.package;
example = pkgs.hello;
};
options.overridden-package = lib.mkOption
{
type = lib.types.package;
defaultText = lib.literalMD "applied `base-package` with `pipe`";
default = lib.trivial.pipe overridablePackage.config.base-package overridablePackage.config.pipe;
};
options.pipe = lib.mkOption {
type = lib.types.listOf (lib.types.functionTo lib.types.package);
default = [ ];
};
})
];
};
};
});
};
}