1
0
Fork 0
mirror of https://github.com/hercules-ci/flake-parts.git synced 2024-12-14 11:47:31 +00:00
flake-parts/lib.nix
2022-05-17 10:12:13 +02:00

47 lines
970 B
Nix

{ lib }:
let
inherit (lib)
mkOption
types
functionTo
;
flake-modules-core-lib = {
evalFlakeModule =
{ self
, specialArgs ? { }
}:
module:
lib.evalModules {
specialArgs = { inherit self flake-modules-core-lib; } // specialArgs;
modules = [ ./all-modules.nix module ];
};
# For extending options in an already declared submodule.
# Workaround for https://github.com/NixOS/nixpkgs/issues/146882
mkSubmoduleOptions =
options:
mkOption {
type = types.submoduleWith {
modules = [ { inherit options; } ];
};
};
mkPerSystemType =
module:
types.functionTo (types.submoduleWith {
modules = [ module ];
shorthandOnlyDefinesConfig = false;
});
mkPerSystemModule =
module:
mkOption {
type = flake-modules-core-lib.mkPerSystemType module;
};
};
in
flake-modules-core-lib