Error message related to `*.desktop` files during GNOME installation

I started with a minimal NixOS installation and then changed configuration.nix to enable GNOME. When running nixos-rebuild afterwards, I got error messages of the following forms:

Could not parse file "/nix/store/⟨hash⟩-system-path/share/applications/org.gnome.Music.desktop": Key file does not have group “Desktop Entry”
Could not parse file "/nix/store/⟨hash⟩-system-path/share/applications/org.gnome.OnlineAccounts.OAuth2.desktop": Key file does not have group “Desktop Entry”
Could not parse file "/nix/store/⟨hash⟩-system-path/share/applications/org.gnome.Totem.desktop": Key file does not have group “Desktop Entry”

What causes these and what should I do about them?

Can you try a store repair on those paths?
i.e. use realpath to get the actual store path, then nix-store --repair-path <path>

It seems that these errors had indeed to do with store corruption, caused by a power outage of my laptop during my first attempt of installing GNOME.

Now I wasn’t really sure whether the repairing you suggested would resolve the problem, because the errors could have shown up when constructing a derivation that merely depends on the broken derivations, resulting in a derivation that is itself broken but looks correct to Nix (as its construction wasn’t interrupted). For this reason, I opted for a more drastic approach:

  1. Remove everything GNOME-related from the NixOS configuration
  2. Run nixos-rebuild boot
  3. Reboot
  4. Run nix-collect-garbage -d and nixos-rebuild boot
  5. Reboot
  6. Re-add the GNOME-related configuration
  7. Run nixos-rebuild boot

The point was to get a fresh installation of GNOME. During this installation, the above-mentioned error messages didn’t show up.

1 Like