1
0
Fork 0
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:
Robert Hensing 2021-11-21 15:47:11 +01:00
parent 06ebe54ddb
commit 315c09733e
7 changed files with 55 additions and 4 deletions

View file

@ -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
View file

@ -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

View file

@ -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 = { };

View file

@ -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
View 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.
'';
};
};
}

View file

@ -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 = { };

View file

@ -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 = { };