mirror of
https://github.com/hercules-ci/flake-parts.git
synced 2024-12-15 17:50:53 +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 = [
|
imports = [
|
||||||
./modules/checks.nix
|
./modules/checks.nix
|
||||||
./modules/devShell.nix
|
./modules/devShell.nix
|
||||||
|
./modules/flake.nix
|
||||||
./modules/legacyPackages.nix
|
./modules/legacyPackages.nix
|
||||||
./modules/packages.nix
|
./modules/packages.nix
|
||||||
./modules/perSystem.nix
|
./modules/perSystem.nix
|
||||||
|
|
11
lib.nix
11
lib.nix
|
@ -16,6 +16,17 @@ let
|
||||||
specialArgs = { inherit self flake-modules-core-lib; } // specialArgs;
|
specialArgs = { inherit self flake-modules-core-lib; } // specialArgs;
|
||||||
modules = [ ./all-modules.nix module ];
|
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
|
in
|
||||||
flake-modules-core-lib
|
flake-modules-core-lib
|
||||||
|
|
|
@ -8,10 +8,13 @@ let
|
||||||
optionalAttrs
|
optionalAttrs
|
||||||
types
|
types
|
||||||
;
|
;
|
||||||
|
inherit (flake-modules-core-lib)
|
||||||
|
mkSubmoduleOptions
|
||||||
|
;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
flake = {
|
flake = mkSubmoduleOptions {
|
||||||
checks = mkOption {
|
checks = mkOption {
|
||||||
type = types.lazyAttrsOf (types.lazyAttrsOf types.package);
|
type = types.lazyAttrsOf (types.lazyAttrsOf types.package);
|
||||||
default = { };
|
default = { };
|
||||||
|
|
|
@ -8,10 +8,13 @@ let
|
||||||
optionalAttrs
|
optionalAttrs
|
||||||
types
|
types
|
||||||
;
|
;
|
||||||
|
inherit (flake-modules-core-lib)
|
||||||
|
mkSubmoduleOptions
|
||||||
|
;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
flake = {
|
flake = mkSubmoduleOptions {
|
||||||
devShell = mkOption {
|
devShell = mkOption {
|
||||||
type = types.lazyAttrsOf types.package;
|
type = types.lazyAttrsOf types.package;
|
||||||
default = { };
|
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
|
optionalAttrs
|
||||||
types
|
types
|
||||||
;
|
;
|
||||||
|
inherit (flake-modules-core-lib)
|
||||||
|
mkSubmoduleOptions
|
||||||
|
;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
flake = {
|
flake = mkSubmoduleOptions {
|
||||||
legacyPackages = mkOption {
|
legacyPackages = mkOption {
|
||||||
type = types.lazyAttrsOf (types.lazyAttrsOf types.anything);
|
type = types.lazyAttrsOf (types.lazyAttrsOf types.anything);
|
||||||
default = { };
|
default = { };
|
||||||
|
|
|
@ -8,10 +8,13 @@ let
|
||||||
optionalAttrs
|
optionalAttrs
|
||||||
types
|
types
|
||||||
;
|
;
|
||||||
|
inherit (flake-modules-core-lib)
|
||||||
|
mkSubmoduleOptions
|
||||||
|
;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
flake = {
|
flake = mkSubmoduleOptions {
|
||||||
packages = mkOption {
|
packages = mkOption {
|
||||||
type = types.lazyAttrsOf (types.lazyAttrsOf types.package);
|
type = types.lazyAttrsOf (types.lazyAttrsOf types.package);
|
||||||
default = { };
|
default = { };
|
||||||
|
|
Loading…
Reference in a new issue