summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorDavid Arnold <dgx.arnold@gmail.com>2021-07-28 07:54:00 -0500
committerDavid Arnold <dgx.arnold@gmail.com>2021-08-01 14:56:13 -0500
commitecae25c3ef137d972e909eb0e85960d90481789e (patch)
treea8115be83de6a326960d71b10c2c587954229d36 /nixos
parent863a26e3809df2ecffc63c45831c82b33b05317e (diff)
downloadnixpkgs-ecae25c3ef137d972e909eb0e85960d90481789e.tar
nixpkgs-ecae25c3ef137d972e909eb0e85960d90481789e.tar.gz
nixpkgs-ecae25c3ef137d972e909eb0e85960d90481789e.tar.bz2
nixpkgs-ecae25c3ef137d972e909eb0e85960d90481789e.tar.lz
nixpkgs-ecae25c3ef137d972e909eb0e85960d90481789e.tar.xz
nixpkgs-ecae25c3ef137d972e909eb0e85960d90481789e.tar.zst
nixpkgs-ecae25c3ef137d972e909eb0e85960d90481789e.zip
nixos/nix-daemon: fix registry flake type
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.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/misc/nix-daemon.nix2
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 133e96da0ec..70b27b7d3d0 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 = ''