forked from extern/flakelight
bb0080c21c
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.
20 lines
464 B
Nix
20 lines
464 B
Nix
# flakelight -- Framework for simplifying flake setup
|
|
# Copyright (C) 2023 Archit Gupta <archit@accelbread.com>
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
{ config, lib, ... }:
|
|
let
|
|
inherit (lib) mkOption mkIf;
|
|
inherit (lib.types) functionTo nullOr raw uniq;
|
|
in
|
|
{
|
|
options.functor = mkOption {
|
|
type = nullOr (uniq (functionTo (functionTo raw)));
|
|
default = null;
|
|
};
|
|
|
|
config.outputs = mkIf (config.functor != null) (_: {
|
|
__functor = config.functor;
|
|
});
|
|
}
|