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>
This commit is contained in:
eveeifyeve
2026-07-02 13:36:59 +10:00
committed by Eveeifyeve
parent 65179426c8
commit 81daafea8c
20 changed files with 42 additions and 254 deletions
+2
View File
@@ -70,6 +70,8 @@
- `rebuilderd` has been updated to 0.27.0 introducing breaking changes. See upstream changelog for details: [0.26.0](https://github.com/kpcyrd/rebuilderd/releases/tag/v0.26.0), [0.27.0](https://github.com/kpcyrd/rebuilderd/releases/tag/v0.27.0)
- Starting with v14, `flameshot` will primarily utilise xdg-desktop-portal calls for screenshotting. This will directly affect users on X11 window managers due to the lack of a compatible portal with Screenshot feature. See [upstream changelog](https://github.com/flameshot-org/flameshot/releases/tag/v14.0.0) or [NixOS Flameshot](https://wiki.nixos.org/wiki/Flameshot) wiki page for workarounds.
- `nim1` and respective aliases have been removed due to entering EOL; please migrate to `nim` or `nim-unwrapped` (nim 2).
- `nim-2_0` & `nim-2_2` and respective aliases have been removed; please migrate to `nim` or `nim-unwrapped` (nim 2.2.10).
## Other Notable Changes {#sec-nixpkgs-release-26.11-notable-changes}
+4 -10
View File
@@ -3,8 +3,7 @@
buildPackages,
callPackage,
stdenv,
nim1,
nim2,
nim,
nim_builder,
defaultNimVersion ? 2,
nimOverrides,
@@ -38,7 +37,7 @@ let
nim_builder --phase:install
runHook postInstall
'';
meta = { inherit (nim2.meta) maintainers platforms; };
meta = { inherit (nim.meta) maintainers platforms; };
};
fodFromLockEntry =
@@ -116,15 +115,10 @@ let
...
}:
(
if requiredNimVersion == 1 then
if requiredNimVersion == 2 then
{
depsBuildBuild = [ nim_builder ] ++ depsBuildBuild;
nativeBuildInputs = [ nim1 ] ++ nativeBuildInputs;
}
else if requiredNimVersion == 2 then
{
depsBuildBuild = [ nim_builder ] ++ depsBuildBuild;
nativeBuildInputs = [ nim2 ] ++ nativeBuildInputs;
nativeBuildInputs = [ nim ] ++ nativeBuildInputs;
}
else
throw "requiredNimVersion ${toString requiredNimVersion} is not valid"
+2 -2
View File
@@ -799,7 +799,7 @@ rec {
## `pkgs.writers.writeNim` usage example
```nix
writeNim "hello-nim" { nim = pkgs.nim2; } ''
writeNim "hello-nim" { nim = pkgs.nim; } ''
echo "hello nim"
'';
```
@@ -809,7 +809,7 @@ rec {
name:
{
makeWrapperArgs ? [ ],
nim ? pkgs.nim2,
nim ? pkgs.nim,
nimCompileOptions ? { },
strip ? true,
}:
-31
View File
@@ -1,31 +0,0 @@
diff --git a/config/nim.cfg b/config/nim.cfg
index 3b964d124..850ed0ed9 100644
--- a/config/nim.cfg
+++ b/config/nim.cfg
@@ -8,26 +8,12 @@
# Environment variables can be accessed like so:
# gcc.path %= "$CC_PATH"
-cc = gcc
-
# additional options always passed to the compiler:
--parallel_build: "0" # 0 to auto-detect number of processors
hint[LineTooLong]=off
#hint[XDeclaredButNotUsed]=off
-# Examples of how to setup a cross-compiler:
-
-# Cross-compiling for Raspberry Pi.
-# (This compiler is available in gcc-arm-linux-gnueabihf package on Ubuntu)
-arm.linux.gcc.exe = "arm-linux-gnueabihf-gcc"
-arm.linux.gcc.linkerexe = "arm-linux-gnueabihf-gcc"
-
-# For OpenWRT, you will also need to adjust PATH to point to your toolchain.
-mips.linux.gcc.exe = "mips-openwrt-linux-gcc"
-mips.linux.gcc.linkerexe = "mips-openwrt-linux-gcc"
-
-
path="$lib/deprecated/core"
path="$lib/deprecated/pure"
path="$lib/pure/collections"
-9
View File
@@ -1,9 +0,0 @@
{
nim-unwrapped-1,
nim,
}:
nim.passthru.wrapNim {
nimUnwrapped = nim-unwrapped-1;
patches = [ ./nim.cfg.patch ];
}
-9
View File
@@ -1,9 +0,0 @@
{
nim-unwrapped-2_0,
nim-2_2,
}:
nim-2_2.passthru.wrapNim {
nimUnwrapped = nim-unwrapped-2_0;
inherit (nim-2_2) patches;
}
@@ -1,52 +0,0 @@
diff --git a/compiler/modulepaths.nim b/compiler/modulepaths.nim
index fa8fab08a..63b0cb44d 100644
--- a/compiler/modulepaths.nim
+++ b/compiler/modulepaths.nim
@@ -73,6 +73,17 @@ proc checkModuleName*(conf: ConfigRef; n: PNode; doLocalError=true): FileIndex =
else:
result = fileInfoIdx(conf, fullPath)
+proc rot13(result: var string) =
+ # don't mangle .nim
+ let finalIdx =
+ if result.endsWith(".nim"): result.len - 4
+ else: result.len
+ for i, c in result[0..<finalIdx]:
+ case c
+ of 'a'..'m', 'A'..'M': result[i] = char(c.uint8 + 13)
+ of 'n'..'z', 'N'..'Z': result[i] = char(c.uint8 - 13)
+ else: discard
+
proc mangleModuleName*(conf: ConfigRef; path: AbsoluteFile): string =
## Mangle a relative module path to avoid path and symbol collisions.
##
@@ -81,9 +92,11 @@ proc mangleModuleName*(conf: ConfigRef; path: AbsoluteFile): string =
##
## Example:
## `foo-#head/../bar` becomes `@foo-@hhead@s..@sbar`
- "@m" & relativeTo(path, conf.projectPath).string.multiReplace(
+ result = "@m" & relativeTo(path, conf.projectPath).string.multiReplace(
{$os.DirSep: "@s", $os.AltSep: "@s", "#": "@h", "@": "@@", ":": "@c"})
+ rot13(result)
proc demangleModuleName*(path: string): string =
## Demangle a relative module path.
result = path.multiReplace({"@@": "@", "@h": "#", "@s": "/", "@m": "", "@c": ":"})
+ rot13(result)
diff --git a/compiler/msgs.nim b/compiler/msgs.nim
index ae4bcfcb8..1ad7e5c08 100644
--- a/compiler/msgs.nim
+++ b/compiler/msgs.nim
@@ -661,8 +661,10 @@ proc uniqueModuleName*(conf: ConfigRef; fid: FileIndex): string =
for i in 0..<trunc:
let c = rel[i]
case c
- of 'a'..'z':
- result.add c
+ of 'a'..'m':
+ result.add char(c.uint8 + 13)
+ of 'n'..'z':
+ result.add char(c.uint8 - 13)
of {os.DirSep, os.AltSep}:
result.add 'Z' # because it looks a bit like '/'
of '.':
@@ -1,30 +0,0 @@
{
lib,
stdenv,
fetchurl,
nim-unwrapped-2,
}:
nim-unwrapped-2.overrideAttrs (
finalAttrs: prevAttrs: {
version = "1.6.20";
src = fetchurl {
url = "https://nim-lang.org/download/nim-${finalAttrs.version}.tar.xz";
hash = "sha256-/+0EdQTR/K9hDw3Xzz4Ce+kaKSsMnFEWFQTC87mE/7k=";
};
patches =
builtins.filter (
p:
builtins.elem (baseNameOf p) [
"NIM_CONFIG_DIR.patch"
"nixbuild.patch"
]
) nim-unwrapped-2.patches
++ [
./extra-mangling.patch
# Mangle store paths of modules to prevent runtime dependence.
]
++ lib.optional (!stdenv.hostPlatform.isWindows) ./toLocation.patch;
}
)
@@ -1,16 +0,0 @@
diff --git a/lib/std/private/miscdollars.nim b/lib/std/private/miscdollars.nim
index 840fedf54..6c3436308 100644
--- a/lib/std/private/miscdollars.nim
+++ b/lib/std/private/miscdollars.nim
@@ -6,9 +6,8 @@ template toLocation*(result: var string, file: string | cstring, line: int, col:
# it can be done in a single place.
result.add file
if line > 0:
- result.add "("
+ result.add ":"
addInt(result, line)
if col > 0:
- result.add ", "
+ result.add ":"
addInt(result, col)
- result.add ")"
@@ -1,27 +0,0 @@
{
lib,
fetchurl,
nim-unwrapped-1,
nim-unwrapped-2_2,
}:
nim-unwrapped-2_2.overrideAttrs (
finalAttrs: previousAttrs: {
version = "2.0.16";
src = fetchurl {
url = "https://nim-lang.org/download/nim-${finalAttrs.version}.tar.xz";
hash = "sha256-sucMbAEbVQcJMJCoiH+iUncyCP0EfuOPhWLiVp5cN4o=";
};
patches = lib.lists.unique (
builtins.filter (
p:
builtins.elem (baseNameOf p) [
"NIM_CONFIG_DIR.patch"
"nixbuild.patch"
"extra-mangling.patch"
"openssl.patch"
]
) (nim-unwrapped-1.patches ++ nim-unwrapped-2_2.patches)
);
}
)
@@ -1,52 +0,0 @@
diff --git a/compiler/modulegraphs.nim b/compiler/modulegraphs.nim
index 77762d23a..59dd8903a 100644
--- a/compiler/modulegraphs.nim
+++ b/compiler/modulegraphs.nim
@@ -503,7 +503,11 @@ proc uniqueModuleName*(conf: ConfigRef; m: PSym): string =
for i in 0..<trunc:
let c = rel[i]
case c
- of 'a'..'z', '0'..'9':
+ of 'a'..'m':
+ result.add char(c.uint8 + 13)
+ of 'n'..'z':
+ result.add char(c.uint8 - 13)
+ of '0'..'9':
result.add c
of {os.DirSep, os.AltSep}:
result.add 'Z' # because it looks a bit like '/'
diff --git a/compiler/modulepaths.nim b/compiler/modulepaths.nim
index c9e6060e5..2b349f27c 100644
--- a/compiler/modulepaths.nim
+++ b/compiler/modulepaths.nim
@@ -79,6 +79,17 @@ proc checkModuleName*(conf: ConfigRef; n: PNode; doLocalError=true): FileIndex =
else:
result = fileInfoIdx(conf, fullPath)
+proc rot13(result: var string) =
+ # don't mangle .nim
+ let finalIdx =
+ if result.endsWith(".nim"): result.len - 4
+ else: result.len
+ for i, c in result[0..<finalIdx]:
+ case c
+ of 'a'..'m', 'A'..'M': result[i] = char(c.uint8 + 13)
+ of 'n'..'z', 'N'..'Z': result[i] = char(c.uint8 - 13)
+ else: discard
+
proc mangleModuleName*(conf: ConfigRef; path: AbsoluteFile): string =
## Mangle a relative module path to avoid path and symbol collisions.
##
@@ -87,9 +98,11 @@ proc mangleModuleName*(conf: ConfigRef; path: AbsoluteFile): string =
##
## Example:
## `foo-#head/../bar` becomes `@foo-@hhead@s..@sbar`
- "@m" & relativeTo(path, conf.projectPath).string.multiReplace(
+ result = "@m" & relativeTo(path, conf.projectPath).string.multiReplace(
{$os.DirSep: "@s", $os.AltSep: "@s", "#": "@h", "@": "@@", ":": "@c"})
+ rot13(result)
proc demangleModuleName*(path: string): string =
## Demangle a relative module path.
result = path.multiReplace({"@@": "@", "@h": "#", "@s": "/", "@m": "", "@c": ":"})
+ rot13(result)
@@ -0,0 +1,17 @@
diff --git a/compiler/modulegraphs.nim b/compiler/modulegraphs.nim
index 55f751cda..b0b3e3f40 100644
--- a/compiler/modulegraphs.nim
+++ b/compiler/modulegraphs.nim
@@ -466,7 +466,11 @@ proc uniqueModuleName*(conf: ConfigRef; m: PSym): string =
for i in 0..<trunc:
let c = rel[i]
case c
- of 'a'..'z', '0'..'9':
+ of 'a'..'m':
+ result.add char(c.uint8 + 13)
+ of 'n'..'z':
+ result.add char(c.uint8 - 13)
+ of '0'..'9':
result.add c
of {os.DirSep, os.AltSep}:
result.add 'Z' # because it looks a bit like '/'
@@ -13,12 +13,12 @@
}:
stdenv.mkDerivation (finalAttrs: {
pname = "nim-unwrapped";
version = "2.2.4";
version = "2.2.10";
strictDeps = true;
src = fetchurl {
url = "https://nim-lang.org/download/nim-${finalAttrs.version}.tar.xz";
hash = "sha256-+CtBl1D8zlYfP4l6BIaxgBhoRddvtdmfJIzhZhCBicc=";
hash = "sha256-eVe37QBCBrzxC8xPO0dEFTh45i8kMVUqmo6dP0Do1dU=";
};
buildInputs = [
@@ -36,7 +36,7 @@ stdenv.mkDerivation (finalAttrs: {
./nixbuild.patch
# Load libraries at runtime by absolute path
./extra-mangling-2.patch
./extra-mangling.patch
# Mangle store paths of modules to prevent runtime dependence.
./openssl.patch
@@ -67,9 +67,7 @@ stdenv.mkDerivation (finalAttrs: {
"--cpu:${stdenv.hostPlatform.nim.cpu}"
"--os:${stdenv.hostPlatform.nim.os}"
"-d:release"
"-d:useGnuReadline"
]
++ lib.optional (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isLinux) "-d:nativeStacktrace";
];
preBuild = lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) ''
substituteInPlace makefile \
@@ -8,7 +8,7 @@
makeWrapper,
openssl,
pcre,
nim-unwrapped-2_2 ? buildPackages.nim-unwrapped-2_2,
nim-unwrapped ? buildPackages.nim-unwrapped,
}:
let
@@ -18,7 +18,7 @@ let
targetPlatformConfig = stdenv.targetPlatform.config;
in
stdenv.mkDerivation (finalAttrs: {
name = "${targetPlatformConfig}-nim-wrapper-${nimUnwrapped.version}";
pname = "${targetPlatformConfig}-nim-wrapper";
inherit (nimUnwrapped) version;
preferLocalBuild = true;
strictDeps = true;
@@ -148,6 +148,6 @@ let
});
in
wrapNim {
nimUnwrapped = nim-unwrapped-2_2;
nimUnwrapped = nim-unwrapped;
patches = [ ./nim2.cfg.patch ];
}
+10
View File
@@ -1621,6 +1621,16 @@ mapAliases {
nfstrace = throw "nfstrace has been removed, as it was broken"; # Added 2025-08-25
nginxQuic = throw "'nginxQuic' has been removed. QUIC support is now available in the default nginx builds.";
ngrid = throw "'ngrid' has been removed as it has been unmaintained upstream and broken"; # Added 2025-11-15
nim1 = throw "'nim1' has reached EOL, please use 'nim'"; # Added 2026-03-06
nim-unwrapped-1 = throw "'nim-unwrapped-1' has reached EOL, please use 'nim-unwrapped'"; # Added 2026-03-06
nim-unwrapped-2 = throw "'nim-unwrapped-2' has been upgraded and removed, please use 'nim-unwrapped'"; # Added 2026-03-06
nim-unwrapped-2_0 = throw "'nim-unwrapped-2_0' has been upgraded and removed, please use 'nim-unwrapped'"; # Added 2026-03-06
nim-unwrapped-2_2 = throw "'nim-unwrapped-2_2' has been upgraded and removed, please use 'nim-unwrapped'"; # Added 2026-03-06
nim-unwrapped_1_0 = throw "'nim-unwrapped_1_0' has reached EOL, please use 'nim-unwrapped'"; # Added 2026-03-06
nim_1_0 = throw "'nim_1_0' has reached EOL, please use 'nim'"; # Added 2026-03-06
nim_2 = throw "'nim_2' has been upgraded and removed, please use 'nim'"; # Added 2026-03-06
nim_2_0 = throw "'nim_2_0' has been upgraded and removed, please use 'nim'"; # Added 2026-03-06
nim_2_2 = throw "'nim_2_2' has been upgraded and removed, please use 'nim'"; # Added 2026-03-06
nimbo = throw "'nimbo' has been removed due to being archived upstream."; # Added 2026-01-18
nitrokey-fido2-firmware = throw "'nitrokey-fido2-firmware' has been removed as it was broken and unmaintained upstream since 2022"; # Added 2026-03-23
nix-direnv-flakes = throw "'nix-direnv-flakes' has been renamed to/replaced by 'nix-direnv'"; # Converted to throw 2025-10-27
-7
View File
@@ -4024,13 +4024,6 @@ with pkgs;
mozart2-binary = callPackage ../development/compilers/mozart/binary.nix { };
nim = nim2;
nim1 = nim-1_0;
nim2 = nim-2_2;
nim-unwrapped = nim-unwrapped-2_2;
nim-unwrapped-1 = nim-unwrapped-1_0;
nim-unwrapped-2 = nim-unwrapped-2_2;
buildNimPackage = callPackage ../build-support/build-nim-package.nix { };
buildNimSbom = callPackage ../build-support/build-nim-sbom.nix { };
nimOverrides = callPackage ./nim-overrides.nix { };