nixpkgs/pkgs/by-name/ni/nim-unwrapped/NIM_CONFIG_DIR.patch
eveeifyeve 81daafea8c nim: remove 1_0, 2_0 and 2_2 versions and aliases; nim: 2.2.4 -> 2.2.10
writers/writeNim: migrate package to nim
nim: remove nativeStacktraces and gnuReadline args
nim: use pname instead

It's time that we remove nim1, nim1 has been a package for a while and
nim has moved on during that time to the v2 versions.
It's also time that nim had some attention in nixpkgs and upgrade the
nim 2 versions.

Also fixes an issue with nim-unwrapped missing the pname and version.
See #485742 for more info.

Co-authored-by: éclairevoyant
<848000+eclairevoyant@users.noreply.github.com>
2026-07-02 13:36:59 +10:00

23 lines
1,020 B
Diff

diff --git a/compiler/nimconf.nim b/compiler/nimconf.nim
index a470179bd..73cfa1a23 100644
--- a/compiler/nimconf.nim
+++ b/compiler/nimconf.nim
@@ -225,10 +225,15 @@ proc getUserConfigPath*(filename: RelativeFile): AbsoluteFile =
proc getSystemConfigPath*(conf: ConfigRef; filename: RelativeFile): AbsoluteFile =
# try standard configuration file (installation did not distribute files
# the UNIX way)
- let p = getPrefixDir(conf)
- result = p / RelativeDir"config" / filename
+ let
+ prefix = getPrefixDir(conf)
+ env = getEnv("NIM_CONFIG_PATH")
+ if env != "":
+ result = env.toAbsoluteDir / filename
+ else:
+ result = prefix / RelativeDir"config" / filename
when defined(unix):
- if not fileExists(result): result = p / RelativeDir"etc/nim" / filename
+ if not fileExists(result): result = prefix / RelativeDir"etc/nim" / filename
if not fileExists(result): result = AbsoluteDir"/etc/nim" / filename
proc loadConfigs*(cfg: RelativeFile; cache: IdentCache; conf: ConfigRef) =