https://github.com/nim-lang/Nim/issues/8599#issuecomment-412138212:
Nim should check for nim.cfg (et al.) in /etc/nim/nim.cfg instead of /etc/nim.cfg.
The canonical place on unix systems is ~/.config/FOO/FOO.cfg.
This is preferred because not all users have access to /etc/.., especially on work machines. But everyone can access their $HOME.
This is from Arch Wiki but it applies to most Linux distros.. Just as we used $XDG_CACHE_HOME/nim/ for Nim caches, use $XDG_CONFIG_HOME/nim/ in this case.
$XDG_CONFIG_HOME defaults to ~/.config.
@Araq: You are not using $XDG_CONFIG_HOME in that commit. Looks like few people agreed with that suggestion.
Also, https://github.com/nim-lang/Nim/issues/8599#issuecomment-412233994 /cc @timotheecour.
proc getUserConfigPath(filename: string): string =
result = joinPath(getConfigDir(), filename)
Already was there and os.getConfigDir uses $XDG_CONFIG_HOME. There was nothing for me to do. And if it doesn't work, that's a different issue.
And if it doesn't work, that's a different issue.
OK. Thanks. So this deserves another issue. The "/nim/" needs to be appended in getUserConfigPath too it seems.
Already was there and os.getConfigDir uses $XDG_CONFIG_HOME. There was nothing for me to do. And if it doesn't work, that's a different issue.
getConfigDir was using XDG_CONFIG_DIR, which, as pointed by @kaushalmodi , should've been XDG_CONFIG_HOME ; will be fixed in @kaushalmodi 's https://github.com/nim-lang/Nim/pull/8662
@Araq Do we also have to fix our install scripts? Won't all the .cfg files still go to /etc/?
Edit: I fixed it.
Most helpful comment
This is from Arch Wiki but it applies to most Linux distros.. Just as we used
$XDG_CACHE_HOME/nim/for Nim caches, use$XDG_CONFIG_HOME/nim/in this case.$XDG_CONFIG_HOMEdefaults to~/.config.