mirror of
https://github.com/hercules-ci/flake-parts.git
synced 2024-12-14 11:47:31 +00:00
Add freeformType to flake option
This commit is contained in:
parent
06ebe54ddb
commit
315c09733e
7 changed files with 55 additions and 4 deletions
|
@ -3,6 +3,7 @@
|
|||
imports = [
|
||||
./modules/checks.nix
|
||||
./modules/devShell.nix
|
||||
./modules/flake.nix
|
||||
./modules/legacyPackages.nix
|
||||
./modules/packages.nix
|
||||
./modules/perSystem.nix
|
||||
|
|
11
lib.nix
11
lib.nix
|
@ -16,6 +16,17 @@ let
|
|||
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; } ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
flake-modules-core-lib
|
||||
|
|
|
@ -8,10 +8,13 @@ let
|
|||
optionalAttrs
|
||||
types
|
||||
;
|
||||
inherit (flake-modules-core-lib)
|
||||
mkSubmoduleOptions
|
||||
;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
flake = {
|
||||
flake = mkSubmoduleOptions {
|
||||
checks = mkOption {
|
||||
type = types.lazyAttrsOf (types.lazyAttrsOf types.package);
|
||||
default = { };
|
||||
|
|
|
@ -8,10 +8,13 @@ let
|
|||
optionalAttrs
|
||||
types
|
||||
;
|
||||
inherit (flake-modules-core-lib)
|
||||
mkSubmoduleOptions
|
||||
;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
flake = {
|
||||
flake = mkSubmoduleOptions {
|
||||
devShell = mkOption {
|
||||
type = types.lazyAttrsOf types.package;
|
||||
default = { };
|
||||
|
|
27
modules/flake.nix
Normal file
27
modules/flake.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
inherit (lib)
|
||||
filterAttrs
|
||||
genAttrs
|
||||
mapAttrs
|
||||
mkOption
|
||||
optionalAttrs
|
||||
types
|
||||
;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
flake = mkOption {
|
||||
type = types.submoduleWith {
|
||||
modules = [
|
||||
{ freeformType = types.lazyAttrsOf types.anything; }
|
||||
];
|
||||
};
|
||||
description = ''
|
||||
Raw flake attributes. Any attribute can be set here, but some
|
||||
attributes are represented by options, to provide appropriate
|
||||
configuration merging.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -8,10 +8,13 @@ let
|
|||
optionalAttrs
|
||||
types
|
||||
;
|
||||
inherit (flake-modules-core-lib)
|
||||
mkSubmoduleOptions
|
||||
;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
flake = {
|
||||
flake = mkSubmoduleOptions {
|
||||
legacyPackages = mkOption {
|
||||
type = types.lazyAttrsOf (types.lazyAttrsOf types.anything);
|
||||
default = { };
|
||||
|
|
|
@ -8,10 +8,13 @@ let
|
|||
optionalAttrs
|
||||
types
|
||||
;
|
||||
inherit (flake-modules-core-lib)
|
||||
mkSubmoduleOptions
|
||||
;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
flake = {
|
||||
flake = mkSubmoduleOptions {
|
||||
packages = mkOption {
|
||||
type = types.lazyAttrsOf (types.lazyAttrsOf types.package);
|
||||
default = { };
|
||||
|
|
Loading…
Reference in a new issue