From ecae25c3ef137d972e909eb0e85960d90481789e Mon Sep 17 00:00:00 2001 From: David Arnold Date: Wed, 28 Jul 2021 07:54:00 -0500 Subject: 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 ` 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. --- nixos/modules/services/misc/nix-daemon.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nixos/modules/services/misc/nix-daemon.nix') 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 is to be rewritten."; }; flake = mkOption { - type = types.unspecified; + type = types.nullOr types.attrs; default = null; example = literalExample "nixpkgs"; description = '' -- cgit 1.4.1