diff options
| author | David Arnold <dgx.arnold@gmail.com> | 2021-07-28 07:54:00 -0500 |
|---|---|---|
| committer | github-actions[bot] <github-actions[bot]@users.noreply.github.com> | 2021-08-01 22:09:08 +0000 |
| commit | a791442a31afe47ba7e66dd61786edaee2f6727e (patch) | |
| tree | e09030e94489e51a71682152c95cb2aba622e567 | |
| parent | Merge pull request #131876 from NixOS/backport-131760-to-release-21.05 (diff) | |
| download | nixpkgs-origin/backport-131814-to-release-21.05.tar.gz | |
nixos/nix-daemon: fix registry flake typeorigin/backport-131814-to-release-21.05
Before this commit, the `flake` option was typed with `types.unspecified`.
This type get's merged via [`mergeDefaultOption`](https://github.com/NixOS/nixpkgs/blob/ebb592a04c5282f316d60cd4aba066f6e5d74b65/lib/options.nix#L119-L128), which has a line
```nix
else if all isFunction list then x: mergeDefaultOption loc (map (f: f x) list)
```
`lib.isFunction` detects an attrs in the shape of `{__functor = ...}` as
a function and hence this line substitutes such attrs with a function
(f: f x).
If now, a flake input has a `__functor` as it's output, this will
coerce the once attrs to a function. This breaks a lot of things later
in the stack, for example a later `lib.filterAttrs seive <LAMBDA>` will
fail for obious reasons.
According to @infinisil, `types.unspecified` is due to deprecation. In
the meantime this PR provides a specific fix for the specific problem
discovered.
(cherry picked from commit ecae25c3ef137d972e909eb0e85960d90481789e)
| -rw-r--r-- | nixos/modules/services/misc/nix-daemon.nix | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index 133e96da0ec8..70b27b7d3d09 100644 --- a/nixos/modules/services/misc/nix-daemon.nix +++ b/nixos/modules/services/misc/nix-daemon.nix @@ -458,7 +458,7 @@ in description = "The flake reference to which <option>from></option> is to be rewritten."; }; flake = mkOption { - type = types.unspecified; + type = types.nullOr types.attrs; default = null; example = literalExample "nixpkgs"; description = '' |
