mint: Use buildCrystalPackage

This commit is contained in:
Silvan Mosberger 2019-08-26 18:24:45 +02:00
parent 1ffdf01777
commit 2f92cd6960
No known key found for this signature in database
GPG Key ID: 9424360B4B85C9E7

View File

@ -1,40 +1,7 @@
# Updating the dependencies for this package: { lib, fetchFromGitHub, crystal, zlib, openssl_1_0_2, duktape, which, libyaml }:
# crystal.buildCrystalPackage rec {
# wget https://raw.githubusercontent.com/mint-lang/mint/0.3.1/shard.lock
# nix-shell -p crystal libyaml --run 'crystal run crystal2nix.cr'
#
{stdenv, lib, fetchFromGitHub, crystal, zlib, openssl_1_0_2, duktape, which, libyaml }:
let
crystalPackages = lib.mapAttrs (name: src:
stdenv.mkDerivation {
name = lib.replaceStrings ["/"] ["-"] name;
src = fetchFromGitHub src;
phases = "installPhase";
installPhase = ''cp -r $src $out'';
passthru = { libName = name; };
}
) (import ./shards.nix);
crystalLib = stdenv.mkDerivation {
name = "crystal-lib";
src = lib.attrValues crystalPackages;
libNames = lib.mapAttrsToList (k: v: [k v]) crystalPackages;
phases = "buildPhase";
buildPhase = ''
mkdir -p $out
linkup () {
while [ "$#" -gt 0 ]; do
ln -s $2 $out/$1
shift; shift
done
}
linkup $libNames
'';
};
in
stdenv.mkDerivation rec {
version = "0.5.0"; version = "0.5.0";
name = "mint-${version}"; pname = "mint";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "mint-lang"; owner = "mint-lang";
repo = "mint"; repo = "mint";
@ -42,23 +9,19 @@ stdenv.mkDerivation rec {
sha256 = "0vxbx38c390rd2ysvbwgh89v2232sh5rbsp3nk9wzb70jybpslvl"; sha256 = "0vxbx38c390rd2ysvbwgh89v2232sh5rbsp3nk9wzb70jybpslvl";
}; };
nativeBuildInputs = [ which crystal zlib openssl_1_0_2 duktape libyaml ]; buildInputs = [ openssl_1_0_2 ];
buildPhase = '' # Update with
mkdir -p $out/bin tmp # nix-shell -p crystal2nix --run crystal2nix
cd tmp # with mint's shard.lock file in the current directory
ln -s ${crystalLib} lib shardsFile = ./shards.nix;
cp -r $src/* . crystalBinaries.mint.src = "src/mint.cr";
crystal build src/mint.cr -o $out/bin/mint --verbose --progress --release --no-debug
'';
installPhase = ''true'';
meta = { meta = {
description = "A refreshing language for the front-end web"; description = "A refreshing language for the front-end web";
homepage = https://mint-lang.com/; homepage = https://mint-lang.com/;
license = stdenv.lib.licenses.bsd3; license = lib.licenses.bsd3;
maintainers = with stdenv.lib.maintainers; [ manveru ]; maintainers = with lib.maintainers; [ manveru ];
platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ]; platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ];
}; };
} }