add Nim 1.2.0
This commit is contained in:
parent
3ff7bef13b
commit
9bd7983fc1
|
@ -15,6 +15,8 @@ self: super:
|
||||||
easyhid = super.callPackage ./pkgs/easyhid/default.nix { };
|
easyhid = super.callPackage ./pkgs/easyhid/default.nix { };
|
||||||
openphone = super.callPackage ./pkgs/openphone/default.nix { };
|
openphone = super.callPackage ./pkgs/openphone/default.nix { };
|
||||||
|
|
||||||
|
nim = super.callPackages ./pkgs/nim/default.nix { };
|
||||||
|
|
||||||
shinto-cli = super.callPackage ./pkgs/shinto-cli { };
|
shinto-cli = super.callPackage ./pkgs/shinto-cli { };
|
||||||
|
|
||||||
ui = super.callPackage ./pkgs/nim-packages/ui.nix { };
|
ui = super.callPackage ./pkgs/nim-packages/ui.nix { };
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
# based on https://github.com/nim-lang/Nim/blob/v0.18.0/.travis.yml
|
||||||
|
|
||||||
|
{ stdenv, lib, fetchurl, makeWrapper, openssl, pcre, readline,
|
||||||
|
boehmgc, sfml, sqlite }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "nim";
|
||||||
|
version = "1.2.0";
|
||||||
|
|
||||||
|
src = fetchurl {
|
||||||
|
url = "https://nim-lang.org/download/${pname}-${version}.tar.xz";
|
||||||
|
sha256 = "TpRYOjc5ZYIYBeZl4KBfUvthCRZnbtsJFIlBQVY3xXU=";
|
||||||
|
};
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
NIX_LDFLAGS = "-lcrypto -lpcre -lreadline -lgc -lsqlite3";
|
||||||
|
|
||||||
|
# we could create a separate derivation for the "written in c" version of nim
|
||||||
|
# used for bootstrapping, but koch insists on moving the nim compiler around
|
||||||
|
# as part of building it, so it cannot be read-only
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
makeWrapper
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
openssl pcre readline boehmgc sfml sqlite
|
||||||
|
];
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
runHook preBuild
|
||||||
|
|
||||||
|
# build.sh wants to write to $HOME/.cache
|
||||||
|
HOME=$TMPDIR
|
||||||
|
sh build.sh
|
||||||
|
./bin/nim c koch
|
||||||
|
./koch boot -d:release \
|
||||||
|
-d:useGnuReadline \
|
||||||
|
${lib.optionals (stdenv.isDarwin || stdenv.isLinux) "-d:nativeStacktrace"}
|
||||||
|
./koch tools -d:release
|
||||||
|
|
||||||
|
runHook postBuild
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
install -Dt $out/bin bin/* koch
|
||||||
|
./koch install $out
|
||||||
|
mv $out/nim/bin/* $out/bin/ && rmdir $out/nim/bin
|
||||||
|
mv $out/nim/* $out/ && rmdir $out/nim
|
||||||
|
|
||||||
|
# Fortify hardening appends -O2 to gcc flags which is unwanted for unoptimized nim builds.
|
||||||
|
wrapProgram $out/bin/nim \
|
||||||
|
--run 'NIX_HARDENING_ENABLE=''${NIX_HARDENING_ENABLE/fortify/}' \
|
||||||
|
--suffix PATH : ${lib.makeBinPath [ stdenv.cc ]}
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with stdenv.lib; {
|
||||||
|
description = "Statically typed, imperative programming language";
|
||||||
|
homepage = "https://nim-lang.org/";
|
||||||
|
license = licenses.mit;
|
||||||
|
maintainers = with maintainers; [ ehmry ];
|
||||||
|
platforms = with platforms; linux ++ darwin; # arbitrary
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue