Nix # lib.mkDefault - allowUnfree - error

nixpkgs = {
      config = {
        allowUnfree = lib.mkDefault true ;
while evaluating 'foldr' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:52:20, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/top-level.nix:133:12:
while evaluating 'fold'' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:55:15, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:59:8:
while evaluating 'showWarnings' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/trivial.nix:330:28, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/top-level.nix:130:10:
while evaluating 'foldr' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:52:20, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/trivial.nix:330:33:
while evaluating 'fold'' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:55:15, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:59:8:
while evaluating the attribute 'warnings' at undefined position:
while evaluating 'g' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:301:19, called from undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:171:72, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:304:20:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:585:9:
while evaluating the option `warnings':
while evaluating the attribute 'mergedValue' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:617:5:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:611:9:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:710:7:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:597:28, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:597:17:
while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/boot/systemd.nix':
while evaluating 'dischargeProperties' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:669:25, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:598:137:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:452:44:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:259:10, called from undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/boot/systemd.nix:911:16, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:259:16:
while evaluating 'optional' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:254:20, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/boot/systemd.nix:918:16:
while evaluating the attribute 'serviceConfig.Type' at undefined position:
while evaluating 'g' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:301:19, called from undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:171:72, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:304:20:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:585:9:
while evaluating the option `systemd.services.cups.serviceConfig':
while evaluating the attribute 'mergedValue' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:617:5:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:611:9:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:710:7:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:597:28, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:597:17:
while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/boot/systemd.nix':
while evaluating 'dischargeProperties' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:669:25, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:598:137:
while evaluating the attribute 'condition' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:753:14:
while evaluating the attribute 'condition' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:753:14:
while evaluating the attribute 'preStart' at undefined position:
while evaluating 'g' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:301:19, called from undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:171:72, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:304:20:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:585:9:
while evaluating the option `systemd.services.cups.preStart':
while evaluating the attribute 'mergedValue' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:617:5:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:611:9:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:710:7:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:597:28, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:597:17:
while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/services/printing/cupsd.nix':
while evaluating 'dischargeProperties' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:669:25, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:598:137:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:452:44:
while evaluating the attribute 'passAsFile' of the derivation 'cups-progs' at /nix/store/nahkl0l0m3h0xbgzizkhfslvl1k35lhp-nixos-21.11.337100.7b38b03d76a/nixos/pkgs/stdenv/generic/make-derivation.nix:205:7:
while evaluating the attribute 'passAsFile' at /nix/store/nahkl0l0m3h0xbgzizkhfslvl1k35lhp-nixos-21.11.337100.7b38b03d76a/nixos/pkgs/build-support/buildenv/default.nix:77:5:
while evaluating the attribute 'text' of the derivation 'cups-files.conf' at /nix/store/nahkl0l0m3h0xbgzizkhfslvl1k35lhp-nixos-21.11.337100.7b38b03d76a/nixos/pkgs/stdenv/generic/make-derivation.nix:205:7:
while evaluating the attribute 'passAsFile' of the derivation 'cups-progs' at /nix/store/nahkl0l0m3h0xbgzizkhfslvl1k35lhp-nixos-21.11.337100.7b38b03d76a/nixos/pkgs/stdenv/generic/make-derivation.nix:205:7:
while evaluating the attribute 'passAsFile' at /nix/store/nahkl0l0m3h0xbgzizkhfslvl1k35lhp-nixos-21.11.337100.7b38b03d76a/nixos/pkgs/build-support/buildenv/default.nix:77:5:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:371:14, called from undefined position:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:630:27:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:619:17, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:619:12:
while evaluating 'check' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:362:15, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:619:22:
while evaluating 'assertValidity' at /nix/store/nahkl0l0m3h0xbgzizkhfslvl1k35lhp-nixos-21.11.337100.7b38b03d76a/nixos/pkgs/stdenv/generic/check-meta.nix:305:20, called from /nix/store/nahkl0l0m3h0xbgzizkhfslvl1k35lhp-nixos-21.11.337100.7b38b03d76a/nixos/pkgs/stdenv/generic/make-derivation.nix:336:14:
while evaluating 'checkValidity' at /nix/store/nahkl0l0m3h0xbgzizkhfslvl1k35lhp-nixos-21.11.337100.7b38b03d76a/nixos/pkgs/stdenv/generic/check-meta.nix:282:19, called from /nix/store/nahkl0l0m3h0xbgzizkhfslvl1k35lhp-nixos-21.11.337100.7b38b03d76a/nixos/pkgs/stdenv/generic/check-meta.nix:306:18:
while evaluating 'hasDeniedUnfreeLicense' at /nix/store/nahkl0l0m3h0xbgzizkhfslvl1k35lhp-nixos-21.11.337100.7b38b03d76a/nixos/pkgs/stdenv/generic/check-meta.nix:76:28, called from /nix/store/nahkl0l0m3h0xbgzizkhfslvl1k35lhp-nixos-21.11.337100.7b38b03d76a/nixos/pkgs/stdenv/generic/check-meta.nix:289:12:
value is a set while a Boolean was expected, at /nix/store/nahkl0l0m3h0xbgzizkhfslvl1k35lhp-nixos-21.11.337100.7b38b03d76a/nixos/pkgs/stdenv/generic/check-meta.nix:16:17

Is this error message clear - related to the config?

What logic is behind mkDefault and or allowUnfree that lib.mkDefault results in an error?

lib.mkDefault is used for the NixOS module system, which lives in nixpkgs, but is not actually used for the pkgs part, which you’re using here.

nix-repl> lib.mkDefault true
{ _type = "override"; content = true; priority = 1000; }

is the set the error is complaining about. While nixpkgs/check-meta.nix at ca3394dd1afe4bcb5f98b037d35ce2ed77c10dc7 · NixOS/nixpkgs · GitHub expects a boolean, because it tries to use it in an || expression.

2 Likes