mirror of
https://github.com/nix-community/flakelight.git
synced 2024-11-21 23:13:09 +01:00
Fix inconsistency when setting outputs.__functor
This edge case was inconsistent between setting outputs directly and auto-loading. Setting directly did not support args, so just merged sets, thus resulting in a __functor flake output. When autoloading, a set with a __functor attr was treated as a function and passed module args. To correct this inconsistency, outputs now always supports taking args, and has the autoloading behavior. Code that relied on previous behavior is easy to fix, as the value needs to be converted to a function, which can then return the set with __functor.
This commit is contained in:
parent
f2c32f5a42
commit
bb0080c21c
@ -2,13 +2,13 @@
|
||||
# Copyright (C) 2023 Archit Gupta <archit@accelbread.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
{ config, inputs, lib, flakelight, ... }:
|
||||
{ config, inputs, lib, flakelight, moduleArgs, ... }:
|
||||
let
|
||||
inherit (builtins) all head isAttrs length;
|
||||
inherit (lib) foldAttrs genAttrs getFiles getValues mapAttrs mergeAttrs
|
||||
mkOption mkOptionType showFiles showOption;
|
||||
inherit (lib.types) functionTo lazyAttrsOf listOf nonEmptyStr raw uniq;
|
||||
inherit (flakelight.types) optListOf overlay;
|
||||
inherit (flakelight.types) optCallWith optListOf overlay;
|
||||
|
||||
outputs = mkOptionType {
|
||||
name = "outputs";
|
||||
@ -43,7 +43,7 @@ in
|
||||
};
|
||||
|
||||
outputs = mkOption {
|
||||
type = lazyAttrsOf outputs;
|
||||
type = optCallWith moduleArgs (lazyAttrsOf outputs);
|
||||
default = { };
|
||||
};
|
||||
|
||||
|
@ -13,7 +13,7 @@ in
|
||||
default = null;
|
||||
};
|
||||
|
||||
config.outputs = mkIf (config.functor != null) {
|
||||
config.outputs = mkIf (config.functor != null) (_: {
|
||||
__functor = config.functor;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ in
|
||||
|
||||
config =
|
||||
let
|
||||
outputs = autoImportArgs' "outputs";
|
||||
outputs = autoImport' "outputs";
|
||||
perSystem = autoImport' "perSystem";
|
||||
withOverlays = autoImport' "withOverlays";
|
||||
package = autoImport' "package";
|
||||
|
Loading…
Reference in New Issue
Block a user