Meaning of error (via Home-Manager) # error: makeDesktopItem: value for categories must be a list!

(updated right now)

  • worked fine before niv update (Home-Manager)
 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.33, NixOS, 21.11 (Porcupine)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.16`
 - channels(root): `"nixos-21.11.337053.2f06b87f64b"`
 - channels(usera): `"home-manager-21.11, nixos-21.11.337053.2f06b87f64b, nixos-hardware"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
{
    "home-manager": {
        "branch": "master",
        "description": "Manage a user environment using Nix",
        "homepage": "https://rycee.gitlab.io/home-manager/",
        "owner": "nix-community",
        "repo": "home-manager",
        "rev": "d49d68f4196d32c5039cb9e91d730cee894f6f14",
        "sha256": "04x79p4c5l3qi990ja7zacibip4p4pn62ingvs1cfnrvdcl615z7",
        "type": "tarball",
        "url": "https://github.com/nix-community/home-manager/archive/d49d68f4196d32c5039cb9e91d730cee894f6f14.tar.gz",
        "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
    },
    "niv": {
        "branch": "master",
        "description": "Easy dependency management for Nix projects",
        "homepage": "https://github.com/nmattia/niv",
        "owner": "nmattia",
        "repo": "niv",
        "rev": "df49d53b71ad5b6b5847b32e5254924d60703c46",
        "sha256": "1j5p8mi1wi3pdcq0lfb881p97i232si07nb605dl92cjwnira88c",
        "type": "tarball",
        "url": "https://github.com/nmattia/niv/archive/df49d53b71ad5b6b5847b32e5254924d60703c46.tar.gz",
        "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
    },
    "nixpkgs-unstable": {
        "branch": "nixpkgs-unstable",
        "description": "Nix Packages collection",
        "homepage": "",
        "owner": "nixos",
        "repo": "nixpkgs",
        "rev": "d08394e7cd5c7431a1e8f53b7f581e74ee909548",
        "sha256": "04s6ajl82zgxic20ymcz8b9a8sr14p7c69f1axvagypcmjnqz47i",
        "type": "tarball",
        "url": "https://github.com/nixos/nixpkgs/archive/d08394e7cd5c7431a1e8f53b7f581e74ee909548.tar.gz",
        "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
    }
}

error: makeDesktopItem: value for categories must be a list!

       … while evaluating 'renderList'

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/pkgs/build-support/make-desktopitem/default.nix:47:21:

           46|   # Technically, it's possible to escape semicolons in values with \;, but this is currently not implemented.
           47|   renderList = key: value:
             |                     ^
           48|     if !builtins.isList value then throw "makeDesktopItem: value for ${key} must be a list!"

       … from call site

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/pkgs/build-support/make-desktopitem/default.nix:72:20:

           71|     "MimeType" = renderList "mimeTypes" mimeTypes;
           72|     "Categories" = renderList "categories" categories;
             |                    ^
           73|     "Implements" = renderList "implements" implements;

       … while evaluating the attribute 'Categories'

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/pkgs/build-support/make-desktopitem/default.nix:72:5:

           71|     "MimeType" = renderList "mimeTypes" mimeTypes;
           72|     "Categories" = renderList "categories" categories;
             |     ^
           73|     "Implements" = renderList "implements" implements;

       … while evaluating 'renderLine'

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/pkgs/build-support/make-desktopitem/default.nix:85:22:

           84|   # need to be escaped. There are currently none in nixpkgs though, so this is OK.
           85|   renderLine = name: value: if value != null then "${name}=${value}" else null;
             |                      ^
           86|

       … from call site

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/lib/attrsets.nix:356:16:

          355|   mapAttrsToList = f: attrs:
          356|     map (name: f name attrs.${name}) (attrNames attrs);
             |                ^
          357|

       … while evaluating anonymous lambda

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/lib/attrsets.nix:356:10:

          355|   mapAttrsToList = f: attrs:
          356|     map (name: f name attrs.${name}) (attrNames attrs);
             |          ^
          357|

       … from call site

       … while evaluating anonymous lambda

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/pkgs/build-support/make-desktopitem/default.nix:92:25:

           91|       (lib.mapAttrsToList renderLine)
           92|       (builtins.filter (v: !isNull v))
             |                         ^
           93|       (builtins.concatStringsSep "\n")

       … from call site

       … while evaluating 'reverseApply'

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/lib/trivial.nix:62:27:

           61|   pipe = val: functions:
           62|     let reverseApply = x: f: f x;
             |                           ^
           63|     in builtins.foldl' reverseApply val functions;

       … from call site

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/lib/trivial.nix:63:8:

           62|     let reverseApply = x: f: f x;
           63|     in builtins.foldl' reverseApply val functions;
             |        ^
           64|

       … while evaluating 'pipe'

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/lib/trivial.nix:61:15:

           60|   */
           61|   pipe = val: functions:
             |               ^
           62|     let reverseApply = x: f: f x;

       … from call site

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/pkgs/build-support/make-desktopitem/default.nix:90:5:

           89|   renderSection = sectionName: attrs:
           90|     lib.pipe attrs [
             |     ^
           91|       (lib.mapAttrsToList renderLine)

       … while evaluating 'renderSection'

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/pkgs/build-support/make-desktopitem/default.nix:89:32:

           88|   # Null values are intentionally left out.
           89|   renderSection = sectionName: attrs:
             |                                ^
           90|     lib.pipe attrs [

       … from call site

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/pkgs/build-support/make-desktopitem/default.nix:100:25:

           99|
          100|   mainSectionRendered = renderSection "Desktop Entry" mainSection;
             |                         ^
          101|

       … while evaluating the attribute 'text' of the derivation 'Spyder.desktop'

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/pkgs/stdenv/generic/make-derivation.nix:205:7:

          204|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          205|       name =
             |       ^
          206|         let

       … while evaluating the attribute 'desktopItem' of the derivation 'python3.9-spyder-5.2.1'

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/pkgs/stdenv/generic/make-derivation.nix:205:7:

          204|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          205|       name =
             |       ^
          206|         let

       … while evaluating the attribute 'passAsFile'

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/pkgs/build-support/buildenv/default.nix:77:5:

           76|     # XXX: The size is somewhat arbitrary
           77|     passAsFile = if builtins.stringLength pkgs >= 128*1024 then [ "pkgs" ] else [ ];
             |     ^
           78|   }

       … while evaluating the attribute 'passAsFile' of the derivation 'home-manager-path'

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/pkgs/stdenv/generic/make-derivation.nix:205:7:

          204|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          205|       name =
             |       ^
          206|         let

       … while evaluating the attribute 'value'

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/lib/modules.nix:572:44:

          571|       defnsByName' = byName "config" (module: value:
          572|           [{ inherit (module) file; inherit value; }]
             |                                            ^
          573|         ) configs;

       … while evaluating 'dischargeProperties'

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/lib/modules.nix:823:25:

          822|   */
          823|   dischargeProperties = def:
             |                         ^
          824|     if def._type or "" == "merge" then

       … from call site

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/lib/modules.nix:752:137:

          751|         defs' = concatMap (m:
          752|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          753|         ) defs;

       … while evaluating definitions from `/nix/store/lanw8ikznjg7q35x1swhf48s8h2fjb6g-home-manager-src/modules/home-environment.nix':

       … while evaluating anonymous lambda

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/lib/modules.nix:751:28:

          750|         # Process mkMerge and mkIf properties.
          751|         defs' = concatMap (m:
             |                            ^
          752|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … from call site

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/lib/modules.nix:751:17:

          750|         # Process mkMerge and mkIf properties.
          751|         defs' = concatMap (m:
             |                 ^
          752|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating the attribute 'values'

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/lib/modules.nix:864:7:

          863|     in {
          864|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
             |       ^
          865|       inherit highestPrio;

       … while evaluating the attribute 'values'

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/lib/modules.nix:765:9:

          764|       in {
          765|         values = defs''';
             |         ^
          766|         inherit (defs'') highestPrio;

       … while evaluating the attribute 'mergedValue'

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/lib/modules.nix:771:5:

          770|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
          771|     mergedValue =
             |     ^
          772|       if isDefined then

       … while evaluating the option `home.activation.installPackages.data':

       … while evaluating the attribute 'value'

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/lib/modules.nix:737:9:

          736|     in warnDeprecation opt //
          737|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          738|         inherit (res.defsFinal') highestPrio;

       … while evaluating anonymous lambda

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/lib/modules.nix:289:72:

          288|           # For definitions that have an associated option
          289|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          290|

       … from call site

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/lib/attrsets.nix:401:20:

          400|               then recurse (path ++ [name]) value
          401|               else f (path ++ [name]) value;
             |                    ^
          402|         in mapAttrs g;

       … while evaluating 'g'

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/lib/attrsets.nix:398:19:

          397|           g =
          398|             name: value:
             |                   ^
          399|             if isAttrs value && cond value

       … from call site

       … while evaluating the attribute 'data'

       at /nix/store/lanw8ikznjg7q35x1swhf48s8h2fjb6g-home-manager-src/modules/lib/dag.nix:84:9:

           83|         name = n;
           84|         data = v.data;
             |         ^
           85|         after = v.after ++ dagBefore dag n;

       … while evaluating the attribute 'data'

       at /nix/store/lanw8ikznjg7q35x1swhf48s8h2fjb6g-home-manager-src/modules/lib/dag.nix:90:37:

           89|     in if sorted ? result then {
           90|       result = map (v: { inherit (v) name data; }) sorted.result;
             |                                     ^
           91|     } else

       … while evaluating 'mkCmd'

       at /nix/store/lanw8ikznjg7q35x1swhf48s8h2fjb6g-home-manager-src/modules/home-environment.nix:638:17:

          637|       let
          638|         mkCmd = res: ''
             |                 ^
          639|             _iNote "Activating %s" "${res.name}"

       … from call site

       … while evaluating the attribute 'text' of the derivation 'activation-script'

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/pkgs/stdenv/generic/make-derivation.nix:205:7:

          204|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          205|       name =
             |       ^
          206|         let

       … while evaluating the attribute 'buildCommand' of the derivation 'home-manager-generation'

       at /nix/store/3dz6jz7rqk6g7dm2pglwf4ck99qd6znd-nixpkgs-unstable-src/pkgs/stdenv/generic/make-derivation.nix:205:7:

          204|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          205|       name =
             |       ^
          206|         let

How to handle anything that could be wrong?

From the trace, it seems to be caused by the Spyder desktopEntry.

In unstable, the makeDesktopItem function was changed. Also, utilizing the old format would cause an error similar to what you are having. However, the spyder desktop file was correctly updated [RFC] treewide: some desktop file cleanups by K900 · Pull Request #161374 · NixOS/nixpkgs · GitHub. Namely, categories is indeed a list.

The only thing which I could think of is that your channels are from 21.11 meanwhile the niv entries are from unstable. So perhaps somehow the channels are leaking into the sypder definition. This is weird (im not familiar with how niv works) but my guess would be either

  • you are using a local spyder nix file. Then if you use callPackage ./path/to/file/spyder.nix makeDesktopItem would be from unstable while the contents of spyder.nix would be using the old interface
  • perhaps some overlay is doing the above process

Edit: I’m pretty sure its this since

1 Like