diff options
author | Emery Hemingway <ehmry@posteo.net> | 2020-11-26 14:10:47 +0100 |
---|---|---|
committer | Milan <me@pbb.lc> | 2020-11-26 20:06:20 +0100 |
commit | bb7b1b59c860a23010473b0408f56c91f7d0c810 (patch) | |
tree | 02c622189e8b81de6b29dd76b7100cc01feb9a91 /pkgs/development/compilers | |
parent | 138a90ebc36cd4ddb32704035142a03dc34d324d (diff) |
nim: include nimble utility with wrapped compiler
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r-- | pkgs/development/compilers/nim/default.nix | 55 |
1 files changed, 45 insertions, 10 deletions
diff --git a/pkgs/development/compilers/nim/default.nix b/pkgs/development/compilers/nim/default.nix index 30290eb83a6a9..59061c0a2f0c5 100644 --- a/pkgs/development/compilers/nim/default.nix +++ b/pkgs/development/compilers/nim/default.nix @@ -1,7 +1,7 @@ # https://nim-lang.github.io/Nim/packaging.html -{ stdenv, lib, fetchgit, fetchurl, makeWrapper, gdb, openssl, pcre, readline -, boehmgc, sqlite, nim-unwrapped, nim }: +{ stdenv, lib, fetchurl, fetchgit, fetchFromGitHub, makeWrapper, gdb, openssl +, pcre, readline, boehmgc, sqlite, nim-unwrapped, nimble-unwrapped }: let version = "1.4.0"; @@ -153,21 +153,52 @@ let inherit meta; }; + + nimble-unwrapped = stdenv.mkDerivation rec { + pname = "nimble-unwrapped"; + version = "0.12.0"; + + src = fetchFromGitHub { + owner = "nim-lang"; + repo = "nimble"; + rev = "v" + version; + sha256 = "0vx0mdk31n00dr2rhiip6f4x7aa3z3mnblnmwk7f65ixd5hayq6y"; + }; + + nativeBuildInputs = [ nim-unwrapped ]; + buildInputs = [ openssl ]; + + nimFlags = [ "--cpu:${nimHost.cpu}" "--os:${nimHost.os}" "-d:release" ]; + + buildPhase = '' + runHook preBuild + HOME=$NIX_BUILD_TOP nim c $nimFlags src/nimble + runHook postBuild + ''; + + installPhase = '' + runHook preBuild + install -Dt $out/bin src/nimble + runHook postBuild + ''; + }; + }; wrapped = let - nim = nim-unwrapped; + nim' = nim-unwrapped; + nimble' = nimble-unwrapped; inherit (stdenv) targetPlatform; in stdenv.mkDerivation { - name = "${targetPlatform.config}-nim-wrapper-${nim.version}"; - inherit (nim) version; + name = "${targetPlatform.config}-nim-wrapper-${nim'.version}"; + inherit (nim') version; preferLocalBuild = true; nativeBuildInputs = [ makeWrapper ]; unpackPhase = '' runHook preUnpack - tar xf ${nim.src} nim-$version/config/nim.cfg + tar xf ${nim'.src} nim-$version/config/nim.cfg cd nim-$version runHook postUnpack ''; @@ -210,7 +241,7 @@ let substituteAll config/nim.cfg $out/etc/nim/nim.cfg \ --replace "cc = gcc" "" - for binpath in ${nim}/bin/nim?*; do + for binpath in ${nim'}/bin/nim?*; do local binname=`basename $binpath` makeWrapper \ $binpath $out/bin/${targetPlatform.config}-$binname \ @@ -219,21 +250,25 @@ let done makeWrapper \ - ${nim}/nim/bin/nim $out/bin/${targetPlatform.config}-nim \ + ${nim'}/nim/bin/nim $out/bin/${targetPlatform.config}-nim \ $wrapperArgs ln -s $out/bin/${targetPlatform.config}-nim $out/bin/nim + makeWrapper \ + ${nimble'}/bin/nimble $out/bin/${targetPlatform.config}-nimble \ + --suffix PATH : $out/bin + ln -s $out/bin/${targetPlatform.config}-nimble $out/bin/nimble + runHook postBuild ''; dontInstall = true; meta = meta // { - description = nim.meta.description + description = nim'.meta.description + " (${targetPlatform.config} wrapper)"; platforms = lib.platforms.unix; }; - }; in wrapped // wrapperInputs |