nim2: init 2.0.0
This commit is contained in:
parent
c740ca0e9b
commit
380a34d03c
|
@ -2,8 +2,8 @@
|
|||
# https://nim-lang.org/docs/nimc.html
|
||||
|
||||
{ lib, callPackage, buildPackages, stdenv, fetchurl, fetchgit, fetchFromGitHub
|
||||
, makeWrapper, openssl, pcre, readline, boehmgc, sqlite, nim-unwrapped
|
||||
, nimble-unwrapped, Security }:
|
||||
, makeWrapper, openssl, pcre, readline, boehmgc, sqlite, Security, nim-unwrapped
|
||||
, nim-unwrapped-2, nimble-unwrapped, nim }:
|
||||
|
||||
let
|
||||
parseCpu = platform:
|
||||
|
@ -72,25 +72,15 @@ let
|
|||
nimHost = parsePlatform stdenv.hostPlatform;
|
||||
nimTarget = parsePlatform stdenv.targetPlatform;
|
||||
|
||||
bootstrapCompiler = stdenv.mkDerivation {
|
||||
pname = "nim-bootstrap";
|
||||
inherit (nim-unwrapped) version src preBuild;
|
||||
enableParallelBuilding = true;
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
install -Dt $out/bin bin/nim
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
in {
|
||||
|
||||
nim-unwrapped = stdenv.mkDerivation rec {
|
||||
nim-unwrapped = stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "nim-unwrapped";
|
||||
version = "1.6.14";
|
||||
strictDeps = true;
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://nim-lang.org/download/nim-${version}.tar.xz";
|
||||
url = "https://nim-lang.org/download/nim-${finalAttrs.version}.tar.xz";
|
||||
hash = "sha256-0HDS8oriQA33/kpJ7OufRc1TmQaxB0gYVqCveo+oLck=";
|
||||
};
|
||||
|
||||
|
@ -108,7 +98,18 @@ in {
|
|||
# Mangle store paths of modules to prevent runtime dependence.
|
||||
] ++ lib.optional (!stdenv.hostPlatform.isWindows) ./toLocation.patch;
|
||||
|
||||
configurePhase = ''
|
||||
configurePhase = let
|
||||
bootstrapCompiler = stdenv.mkDerivation {
|
||||
pname = "nim-bootstrap";
|
||||
inherit (finalAttrs) version src preBuild;
|
||||
enableParallelBuilding = true;
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
install -Dt $out/bin bin/nim
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
in ''
|
||||
runHook preConfigure
|
||||
cp ${bootstrapCompiler}/bin/nim bin/
|
||||
echo 'define:nixbuild' >> config/nim.cfg
|
||||
|
@ -154,7 +155,25 @@ in {
|
|||
mainProgram = "nim";
|
||||
maintainers = with maintainers; [ ehmry ];
|
||||
};
|
||||
});
|
||||
|
||||
nim-unwrapped-2 = nim-unwrapped.overrideAttrs (finalAttrs: rec {
|
||||
version = "2.0.0";
|
||||
src = fetchurl {
|
||||
url = "https://nim-lang.org/download/nim-${version}.tar.xz";
|
||||
hash = "sha256-vWEB2EADb7eOk6ad9s8/n9DCHNdUtpX/hKO0rdjtCvc=";
|
||||
};
|
||||
patches = [
|
||||
./NIM_CONFIG_DIR.patch
|
||||
# Override compiler configuration via an environmental variable
|
||||
|
||||
./nixbuild.patch
|
||||
# Load libraries at runtime by absolute path
|
||||
|
||||
./extra-mangling.patch
|
||||
# Mangle store paths of modules to prevent runtime dependence.
|
||||
];
|
||||
});
|
||||
|
||||
nimble-unwrapped = stdenv.mkDerivation rec {
|
||||
pname = "nimble-unwrapped";
|
||||
|
@ -169,8 +188,7 @@ in {
|
|||
};
|
||||
|
||||
depsBuildBuild = [ nim-unwrapped ];
|
||||
buildInputs = [ openssl ]
|
||||
++ lib.optional stdenv.isDarwin Security;
|
||||
buildInputs = [ openssl ] ++ lib.optional stdenv.isDarwin Security;
|
||||
|
||||
nimFlags = [ "--cpu:${nimHost.cpu}" "--os:${nimHost.os}" "-d:release" ];
|
||||
|
||||
|
@ -194,13 +212,12 @@ in {
|
|||
mainProgram = "nimble";
|
||||
};
|
||||
};
|
||||
|
||||
nim = let
|
||||
nim' = buildPackages.nim-unwrapped;
|
||||
nimble' = buildPackages.nimble-unwrapped;
|
||||
inherit (stdenv) targetPlatform;
|
||||
self = stdenv.mkDerivation {
|
||||
name = "${targetPlatform.config}-nim-wrapper-${nim'.version}";
|
||||
} // (let
|
||||
wrapNim = { nim', nimble', patches }:
|
||||
let
|
||||
targetPlatformConfig = stdenv.targetPlatform.config;
|
||||
self = stdenv.mkDerivation (finalAttrs: {
|
||||
name = "${targetPlatformConfig}-nim-wrapper-${nim'.version}";
|
||||
inherit (nim') version;
|
||||
preferLocalBuild = true;
|
||||
strictDeps = true;
|
||||
|
@ -211,10 +228,7 @@ in {
|
|||
# 'std/sysrand' module.
|
||||
depsTargetTargetPropagated = lib.optional stdenv.isDarwin Security;
|
||||
|
||||
patches = [
|
||||
./nim.cfg.patch
|
||||
# Remove configurations that clash with ours
|
||||
];
|
||||
inherit patches;
|
||||
|
||||
unpackPhase = ''
|
||||
runHook preUnpack
|
||||
|
@ -297,28 +311,30 @@ in {
|
|||
for binpath in ${nim'}/bin/nim?*; do
|
||||
local binname=`basename $binpath`
|
||||
makeWrapper \
|
||||
$binpath $out/bin/${targetPlatform.config}-$binname \
|
||||
$binpath $out/bin/${targetPlatformConfig}-$binname \
|
||||
$wrapperArgs
|
||||
ln -s $out/bin/${targetPlatform.config}-$binname $out/bin/$binname
|
||||
ln -s $out/bin/${targetPlatformConfig}-$binname $out/bin/$binname
|
||||
done
|
||||
|
||||
makeWrapper \
|
||||
${nim'}/nim/bin/nim $out/bin/${targetPlatform.config}-nim \
|
||||
${nim'}/nim/bin/nim $out/bin/${targetPlatformConfig}-nim \
|
||||
--set-default CC $(command -v $CC) \
|
||||
--set-default CXX $(command -v $CXX) \
|
||||
$wrapperArgs
|
||||
ln -s $out/bin/${targetPlatform.config}-nim $out/bin/nim
|
||||
ln -s $out/bin/${targetPlatformConfig}-nim $out/bin/nim
|
||||
|
||||
makeWrapper \
|
||||
${nim'}/bin/testament $out/bin/${targetPlatform.config}-testament \
|
||||
${nim'}/bin/testament $out/bin/${targetPlatformConfig}-testament \
|
||||
$wrapperArgs
|
||||
ln -s $out/bin/${targetPlatform.config}-testament $out/bin/testament
|
||||
ln -s $out/bin/${targetPlatformConfig}-testament $out/bin/testament
|
||||
|
||||
'' + lib.strings.optionalString (nimble' != null) ''
|
||||
makeWrapper \
|
||||
${nimble'}/bin/nimble $out/bin/${targetPlatform.config}-nimble \
|
||||
${nimble'}/bin/nimble $out/bin/${targetPlatformConfig}-nimble \
|
||||
--suffix PATH : $out/bin
|
||||
ln -s $out/bin/${targetPlatform.config}-nimble $out/bin/nimble
|
||||
ln -s $out/bin/${targetPlatformConfig}-nimble $out/bin/nimble
|
||||
|
||||
'' + ''
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
|
@ -329,12 +345,24 @@ in {
|
|||
|
||||
meta = nim'.meta // {
|
||||
description = nim'.meta.description
|
||||
+ " (${targetPlatform.config} wrapper)";
|
||||
+ " (${targetPlatformConfig} wrapper)";
|
||||
platforms = with lib.platforms; unix ++ genode;
|
||||
};
|
||||
};
|
||||
});
|
||||
in self // {
|
||||
pkgs = callPackage ../../../top-level/nim-packages.nix { nim = self; };
|
||||
};
|
||||
in {
|
||||
|
||||
}
|
||||
nim = wrapNim {
|
||||
nim' = buildPackages.nim-unwrapped;
|
||||
nimble' = buildPackages.nimble-unwrapped;
|
||||
patches = [ ./nim.cfg.patch ];
|
||||
};
|
||||
|
||||
nim2 = wrapNim {
|
||||
nim' = buildPackages.nim-unwrapped-2;
|
||||
nimble' = null;
|
||||
patches = [ ./nim2.cfg.patch ];
|
||||
};
|
||||
})
|
||||
|
|
41
pkgs/development/compilers/nim/nim2.cfg.patch
Normal file
41
pkgs/development/compilers/nim/nim2.cfg.patch
Normal file
|
@ -0,0 +1,41 @@
|
|||
diff --git a/config/nim.cfg b/config/nim.cfg
|
||||
index 1470de780..8a12f741a 100644
|
||||
--- a/config/nim.cfg
|
||||
+++ b/config/nim.cfg
|
||||
@@ -9,8 +9,6 @@
|
||||
# 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
|
||||
|
||||
@@ -22,27 +20,6 @@ cc = gcc
|
||||
|
||||
threads:on
|
||||
|
||||
-# Examples of how to setup a cross-compiler:
|
||||
-# Nim can target architectures and OSes different than the local host
|
||||
-# Syntax: <arch>.<os>.gcc.exe = "<compiler executable>"
|
||||
-# <arch>.<os>.gcc.linkerexe = "<linker executable>"
|
||||
-
|
||||
-# ARM e.g. Raspberry Pi 2: gcc-arm-linux-gnueabihf package on Debian/Ubuntu
|
||||
-arm.linux.gcc.exe = "arm-linux-gnueabihf-gcc"
|
||||
-arm.linux.gcc.linkerexe = "arm-linux-gnueabihf-gcc"
|
||||
-# ARM64/aarch64 e.g. Raspberry Pi 3: gcc-aarch64-linux-gnu package on Debian/Ubuntu
|
||||
-arm64.linux.gcc.exe = "aarch64-linux-gnu-gcc"
|
||||
-arm64.linux.gcc.linkerexe = "aarch64-linux-gnu-gcc"
|
||||
-# RISC-V: gcc-riscv64-linux-gnu package on Debian/Ubuntu
|
||||
-riscv32.linux.gcc.exe = "riscv64-linux-gnu-gcc"
|
||||
-riscv32.linux.gcc.linkerexe = "riscv64-linux-gnu-gcc"
|
||||
-riscv64.linux.gcc.exe = "riscv64-linux-gnu-gcc"
|
||||
-riscv64.linux.gcc.linkerexe = "riscv64-linux-gnu-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"
|
|
@ -1,13 +0,0 @@
|
|||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
export HOME=$NIX_BUILD_TOP
|
||||
|
||||
nimble --accept --noSSLCheck develop "${pkgname}@${version}"
|
||||
# TODO: bring in the certificates for Nimble to verify the fetch of
|
||||
# the package list.
|
||||
|
||||
pkgdir=${NIX_BUILD_TOP}/${pkgname}
|
||||
|
||||
find "$pkgdir" -name .git -print0 | xargs -0 rm -rf
|
||||
|
||||
cp -a "$pkgdir" "$out"
|
|
@ -1,20 +0,0 @@
|
|||
{ lib, makeOverridable, stdenv, gitMinimal, nim, cacert }:
|
||||
|
||||
makeOverridable (
|
||||
|
||||
{ pname, version, hash ? lib.fakeHash,
|
||||
|
||||
meta ? { }, passthru ? { }, preferLocalBuild ? true }:
|
||||
stdenv.mkDerivation {
|
||||
inherit version meta passthru preferLocalBuild;
|
||||
pname = pname + "-src";
|
||||
pkgname = pname;
|
||||
builder = ./builder.sh;
|
||||
nativeBuildInputs = [ gitMinimal nim ];
|
||||
outputHash = hash;
|
||||
outputHashAlgo = null;
|
||||
outputHashMode = "recursive";
|
||||
impureEnvVars = lib.fetchers.proxyImpureEnvVars
|
||||
++ [ "GIT_PROXY_COMMAND" "SOCKS_SERVER" ];
|
||||
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||
})
|
|
@ -16671,8 +16671,9 @@ with pkgs;
|
|||
|
||||
inherit (callPackages ../development/compilers/nim
|
||||
{ inherit (darwin) Security; }
|
||||
) nim-unwrapped nimble-unwrapped nim;
|
||||
) nim-unwrapped nim-unwrapped-2 nimble-unwrapped nim nim2;
|
||||
nimPackages = recurseIntoAttrs nim.pkgs;
|
||||
nim2Packages = recurseIntoAttrs nim2.pkgs;
|
||||
|
||||
nrpl = callPackage ../development/tools/nrpl { };
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ lib.makeScope newScope (self:
|
|||
callPackage ../development/nim-packages/build-nim-package {
|
||||
inherit (buildPackages.buildPackages.nimPackages) nim_builder;
|
||||
};
|
||||
fetchNimble = callPackage ../development/nim-packages/fetch-nimble { };
|
||||
|
||||
asciigraph = callPackage ../development/nim-packages/asciigraph { };
|
||||
|
||||
|
|
Loading…
Reference in a new issue