# Mimetype for Nix source files (and corresponding icons)

**URL:** https://discourse.nixos.org/t/mimetype-for-nix-source-files-and-corresponding-icons/43815
**Category:** Nix
**Created:** [April 21, 2024, 11:10am UTC](https://discourse.nixos.org/t/mimetype-for-nix-source-files-and-corresponding-icons/43815 "2024-04-21T11:10:26Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Aleksanaa](https://discourse.nixos.org/user_avatar/discourse.nixos.org/aleksanaa/32/12953_2.png) [@Aleksanaa](https://discourse.nixos.org/u/Aleksanaa)
#### Post date: [April 21, 2024, 11:10am UTC](https://discourse.nixos.org/t/mimetype-for-nix-source-files-and-corresponding-icons/43815/1 "2024-04-21T11:10:26Z")

</div>

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](https://help.gnome.org/admin/system-admin-guide/stable/mime-types-custom-user.html.en)

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](https://www.iana.org/assignments/media-types/media-types.xhtml)

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](https://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec/). This is packaged as [shared-mime-info](https://search.nixos.org/packages?channel=unstable&show=shared-mime-info&type=packages). Per the documentation suggests, we can add new mimetypes by creating an issue in the [issue tracker](https://gitlab.freedesktop.org/xdg/shared-mime-info/-/issues).

4. Corresponding icons are in `<icon pack name>/<scale>/mimetypes`, for example, [Papirus](https://github.com/PapirusDevelopmentTeam/papirus-icon-theme/tree/master/Papirus/64x64/mimetypes).

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`?

---

<div class="post-metadata">

### Author: ![Aleksanaa](https://discourse.nixos.org/user_avatar/discourse.nixos.org/aleksanaa/32/12953_2.png) [@Aleksanaa](https://discourse.nixos.org/u/Aleksanaa)
#### Post date: [June 2, 2024, 11:35am UTC](https://discourse.nixos.org/t/mimetype-for-nix-source-files-and-corresponding-icons/43815/2 "2024-06-02T11:35:29Z")

</div>

Okay so @bobby285271 accidentally finished it in [Add text/x-nix (!309) · Merge requests · xdg / shared-mime-info · GitLab](https://gitlab.freedesktop.org/xdg/shared-mime-info/-/merge_requests/309)

---

<div class="post-metadata">

### Author: ![Aleksanaa](https://discourse.nixos.org/user_avatar/discourse.nixos.org/aleksanaa/32/12953_2.png) [@Aleksanaa](https://discourse.nixos.org/u/Aleksanaa)
#### Post date: [June 2, 2024, 11:46am UTC](https://discourse.nixos.org/t/mimetype-for-nix-source-files-and-corresponding-icons/43815/3 "2024-06-02T11:46:07Z")

</div>

Reopened papirus icon request for nix mimetype: [[Icon request] Nix · Issue #3478 · PapirusDevelopmentTeam/papirus-icon-theme · GitHub](https://github.com/PapirusDevelopmentTeam/papirus-icon-theme/issues/3478)
