Under XFCE 4.14, using Thunar 1.8.9, the mimetype of nim source files (program.nim) is incorrectly shown as "MATLAB file". It shows an icon totally unrelated to Nim.
On the terminal, the command
file --mime-type program.nim
yields
program.nim: text/x-python
This is more of a marketing problem than a technical one, since it robs Nim of some of its "brand".
Maybe we could try to change XFCE upstream about it. But what changes should be carried over in order to show nim instead of MATLAB or x-pyhton?
XFCE is a downstream still; the likely proper place is where file and/or libmagic are made.
The upstream is mirrored to GitHub https://github.com/file/file, but project's readme in there lists https://mailman.astron.com/pipermail/file/ as the official mailing list and https://bugs.astron.com/ as the official bug tracker. That's the place to start if you want to extend the file Linux utility with Nim support.
The initial basic way to detect Nim source files would be to set *.nim and *.nims as such. Then the additional magic can be added - if you open /usr/share/magic and search for x-python, you'll see that the library indeed lives up to its name with the amount of effort spent to detect Python based on various Pythonic code snippets. Something similar could be done for Nim.
The initial naïve way to detect Nim source files would be to set *.nim and *.nims as such.
That's the only correct way. The "additonal magic" is wrong, you cannot detect programming languages with heuristics. It's 2019, time to admit that file extensions are a good idea.
For programming language sourcefiles yes, extensions help and are commonly used. To enforce extensions in 100% of all computing cases - absolutely not.
The advanced heuristics is used for additional cases such as /usr/bin/some_tool - for running the stuff, I don't need to know if it's a compiled binary, bash script or Python (or Nim, in the future?) or a symlink, I want to run some_tool. But I'd love file to tell me what it is, if I need to.