about summary refs log tree commit diff
path: root/pkgs/development/compilers/mint
diff options
context:
space:
mode:
authorMichael Fellinger <michael.fellinger@xing.com>2018-05-27 21:13:22 +0200
committerMichael Fellinger <michael.fellinger@xing.com>2018-05-27 22:09:09 +0200
commitd6c4e3e8fb87da73ba38bfe73725618e460a25b0 (patch)
tree1e9ed4c64ad7acc9e899d83a442551690be4ee98 /pkgs/development/compilers/mint
parent3b5fd4dada65e9eaf92de6a507fc08f0ce49cd7c (diff)
downloadnixlib-d6c4e3e8fb87da73ba38bfe73725618e460a25b0.tar
nixlib-d6c4e3e8fb87da73ba38bfe73725618e460a25b0.tar.gz
nixlib-d6c4e3e8fb87da73ba38bfe73725618e460a25b0.tar.bz2
nixlib-d6c4e3e8fb87da73ba38bfe73725618e460a25b0.tar.lz
nixlib-d6c4e3e8fb87da73ba38bfe73725618e460a25b0.tar.xz
nixlib-d6c4e3e8fb87da73ba38bfe73725618e460a25b0.tar.zst
nixlib-d6c4e3e8fb87da73ba38bfe73725618e460a25b0.zip
Mint-lang: Init at 2018.05.27
Diffstat (limited to 'pkgs/development/compilers/mint')
-rw-r--r--pkgs/development/compilers/mint/crystal2nix.cr27
-rw-r--r--pkgs/development/compilers/mint/default.nix59
-rw-r--r--pkgs/development/compilers/mint/shards.nix42
3 files changed, 128 insertions, 0 deletions
diff --git a/pkgs/development/compilers/mint/crystal2nix.cr b/pkgs/development/compilers/mint/crystal2nix.cr
new file mode 100644
index 000000000000..2ec8c92be3fb
--- /dev/null
+++ b/pkgs/development/compilers/mint/crystal2nix.cr
@@ -0,0 +1,27 @@
+require "yaml"
+
+File.open "shards.nix", "w+" do |file|
+  file.puts "{"
+  yaml = YAML.parse(File.read("shard.lock"))
+  yaml["shards"].each do |key, value|
+    file.puts "  #{key} = {"
+    file.puts %(    url = "https://github.com/#{value["github"]}";)
+    if value["commit"]?
+      file.puts %(    rev = "#{value["commit"]}";)
+    else
+      url = "https://github.com/#{value["github"]}"
+      ref = "v#{value["version"]}"
+
+      puts "git ls-remote #{url} #{ref}"
+      Process.run("git", args: ["ls-remote", url, ref]) do |x|
+        x.error.each_line { |e| puts e }
+        x.output.each_line { |o| value.as_h["commit"] = o.split("\t")[0] }
+      end
+
+      file.puts %(    rev = "#{value["commit"]};)
+    end
+
+    file.puts "  };"
+  end
+  file.puts "}"
+end
diff --git a/pkgs/development/compilers/mint/default.nix b/pkgs/development/compilers/mint/default.nix
new file mode 100644
index 000000000000..853fa937bafb
--- /dev/null
+++ b/pkgs/development/compilers/mint/default.nix
@@ -0,0 +1,59 @@
+{stdenv, lib, remarshal, runCommand, crystal, zlib, openssl, duktape}:
+let
+  crystalPackages = lib.mapAttrs (name: src:
+    stdenv.mkDerivation {
+      name = lib.replaceStrings ["/"] ["-"] name;
+      src = fetchGit 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 = "2018-05-27";
+  name = "mint-${version}";
+  src = fetchGit {
+    url = "https://github.com/mint-lang/mint.git";
+    rev = "a3f0c86f54b8b3a18dda5c39c2089bdb1d774b4f";
+  };
+
+  buildInputs = [ crystal zlib openssl duktape ];
+
+  buildPhase = ''
+    mkdir -p $out/bin
+
+    mkdir tmp
+    cd tmp
+    ln -s ${crystalLib} lib
+    cp -r $src/* .
+    crystal build src/mint.cr -o $out/bin/mint --verbose --progress --release --no-debug
+  '';
+
+  installPhase = ''true'';
+
+  meta = {
+    description = "A refreshing language for the front-end web.";
+    homepage = https://mint-lang.com/;
+    license = stdenv.lib.licenses.bsd3;
+    maintainers = with stdenv.lib.maintainers; [ manveru ];
+    platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ];
+  };
+}
diff --git a/pkgs/development/compilers/mint/shards.nix b/pkgs/development/compilers/mint/shards.nix
new file mode 100644
index 000000000000..cac1bba5ccce
--- /dev/null
+++ b/pkgs/development/compilers/mint/shards.nix
@@ -0,0 +1,42 @@
+{
+  admiral = {
+    url = "jwaldrip/admiral.cr";
+    rev = "07dde44b2d499c0a941b8da6270e1eac0baadcc2";
+  };
+  ameba = {
+    url = "veelenga/ameba";
+    rev = "7a4fcec5ce62ff92197014f67143c8112866cf8a";
+  };
+  baked_file_system = {
+    url = "schovi/baked_file_system";
+    rev = "22956aa79e889c241884017461e9dc79443d84d9";
+  };
+  duktape = {
+    url = "jessedoyle/duktape.cr";
+    rev = "0e59b56835da23068fe5bd5fbddb935cf0123b67";
+  };
+  kemal = {
+    url = "kemalcr/kemal";
+    rev = "17bd3dce3724b092fd1151cad126f5973da00204";
+  };
+  kilt = {
+    url = "jeromegn/kilt";
+    rev = "d177f02e124a197d22c4cc6d8dee7e1b33821bb1";
+  };
+  radix = {
+    url = "luislavena/radix";
+    rev = "4acb5cfbc304751d94201cdbca72947214af6ee1";
+  };
+  string_inflection = {
+    url = "mosop/string_inflection";
+    rev = "fe46a7269ff8183d4d24728fb24cfa576e89829e";
+  };
+  time_format = {
+    url = "vladfaust/time_format.cr";
+    rev = "30676d3712cb9a0a667c763c69912d801368f90d";
+  };
+  tree_template = {
+    url = "anykeyh/tree_template";
+    rev = "3fcb71ee6852040077dd1a2c8c55c67f4a95ba4e";
+  };
+}