Create Desktop Files with Home Manager

For folks landing here by search, see

https://nix-community.github.io/home-manager/options.xhtml#opt-xdg.desktopEntries

To create the entry above,

  xdg.desktopEntries.org-protocol = {
    name = "org-protocol";
    exec = "emacsclient -- %u";
    terminal = false;
    type = "Application";
    categories = ["System"];
    mimeType = ["x-scheme-handler/org-protocol"];
  };

The file ends up at ~/.local/state/nix/profiles/home-manager/home-path/share/appl ications/ and that share dir is added to XDG_DATA_DIRS. :beers:

3 Likes