Mimetype for Nix source files (and corresponding icons)

I’d like to have mimetype for Nix source files ( *.nix ) by default, and have popular file explorers and icon packs supporting it, just like others, e.g. C, Go, Rust, Haskell…

This is the information I have collected so far:

  1. To define a mimetype locally, we can simply add a xml config file in ~/.local/share/mime/packages, see: Add a custom MIME type for individual users

  2. Top-level (I don’t know if this word is standard or not) mimetypes are managed by IANA. We can find a list of them here: Media Types

  3. Mimetypes like */x-* (e.g. text/x-go, application/x-excel ) commonly seen in Linux GUI file explorers are provided by freedesktop, as Shared mime info spec. This is packaged as shared-mime-info. Per the documentation suggests, we can add new mimetypes by creating an issue in the issue tracker.

  4. Corresponding icons are in <icon pack name>/<scale>/mimetypes, for example, Papirus.

I’d like to ask everyone’s opinions here. Is it worthwhile to define a standard mimetype for Nix? Is text/x-nix an appropriate name? Do we need to define an additional mimetype for flake.nix?

4 Likes