From d6c4e3e8fb87da73ba38bfe73725618e460a25b0 Mon Sep 17 00:00:00 2001 From: Michael Fellinger Date: Sun, 27 May 2018 21:13:22 +0200 Subject: [PATCH 1/3] Mint-lang: Init at 2018.05.27 --- .../development/compilers/mint/crystal2nix.cr | 27 +++++++++ pkgs/development/compilers/mint/default.nix | 59 +++++++++++++++++++ pkgs/development/compilers/mint/shards.nix | 42 +++++++++++++ pkgs/top-level/all-packages.nix | 2 + 4 files changed, 130 insertions(+) create mode 100644 pkgs/development/compilers/mint/crystal2nix.cr create mode 100644 pkgs/development/compilers/mint/default.nix create mode 100644 pkgs/development/compilers/mint/shards.nix diff --git a/pkgs/development/compilers/mint/crystal2nix.cr b/pkgs/development/compilers/mint/crystal2nix.cr new file mode 100644 index 00000000000..2ec8c92be3f --- /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 00000000000..853fa937baf --- /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 00000000000..cac1bba5ccc --- /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"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d2a254244a2..bbaf1e2fb81 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6770,6 +6770,8 @@ with pkgs; microscheme = callPackage ../development/compilers/microscheme { }; + mint = callPackage ../development/compilers/mint { }; + mitscheme = callPackage ../development/compilers/mit-scheme { texLive = texlive.combine { inherit (texlive) scheme-small; }; texinfo = texinfo5; From 4f7c9186f0c838555f00e28cd46588744a8c2f86 Mon Sep 17 00:00:00 2001 From: Michael Fellinger Date: Sun, 27 May 2018 22:41:44 +0200 Subject: [PATCH 2/3] Switch to fetchgit --- .../development/compilers/mint/crystal2nix.cr | 40 +++++++++------- pkgs/development/compilers/mint/default.nix | 7 +-- pkgs/development/compilers/mint/shards.nix | 48 +++++++++++-------- 3 files changed, 56 insertions(+), 39 deletions(-) diff --git a/pkgs/development/compilers/mint/crystal2nix.cr b/pkgs/development/compilers/mint/crystal2nix.cr index 2ec8c92be3f..5d92ae4afea 100644 --- a/pkgs/development/compilers/mint/crystal2nix.cr +++ b/pkgs/development/compilers/mint/crystal2nix.cr @@ -1,27 +1,33 @@ require "yaml" +require "json" + +class PrefetchJSON + JSON.mapping(sha256: String) +end File.open "shards.nix", "w+" do |file| - file.puts "{" + 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"]}" + url = "https://github.com/#{value["github"]}" + rev = if value["version"]? + "v#{value["version"]}" + else + value["commit"].as_s + end - 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"]};) + sha256 = "" + args = ["--url", url, "--rev", rev] + Process.run("nix-prefetch-git", args: args) do |x| + x.error.each_line { |e| puts e } + sha256 = PrefetchJSON.from_json(x.output).sha256 end - file.puts " };" + file.puts %( #{key} = {) + file.puts %( url = "#{url}";) + file.puts %( rev = "#{rev}";) + file.puts %( sha256 = "#{sha256}";) + file.puts %( };) end - file.puts "}" + file.puts %(}) end diff --git a/pkgs/development/compilers/mint/default.nix b/pkgs/development/compilers/mint/default.nix index 853fa937baf..f28b7db3a56 100644 --- a/pkgs/development/compilers/mint/default.nix +++ b/pkgs/development/compilers/mint/default.nix @@ -1,9 +1,9 @@ -{stdenv, lib, remarshal, runCommand, crystal, zlib, openssl, duktape}: +{stdenv, lib, fetchgit, crystal, zlib, openssl, duktape}: let crystalPackages = lib.mapAttrs (name: src: stdenv.mkDerivation { name = lib.replaceStrings ["/"] ["-"] name; - src = fetchGit src; + src = fetchgit src; phases = "installPhase"; installPhase = ''cp -r $src $out''; passthru = { libName = name; }; @@ -30,9 +30,10 @@ in stdenv.mkDerivation rec { version = "2018-05-27"; name = "mint-${version}"; - src = fetchGit { + src = fetchgit { url = "https://github.com/mint-lang/mint.git"; rev = "a3f0c86f54b8b3a18dda5c39c2089bdb1d774b4f"; + sha256 = "1bgs6jkwfc2ksq4gj55cl3h2l5g25f5bwlsjryiw9cbx5k4bp1kz"; }; buildInputs = [ crystal zlib openssl duktape ]; diff --git a/pkgs/development/compilers/mint/shards.nix b/pkgs/development/compilers/mint/shards.nix index cac1bba5ccc..ba42006c461 100644 --- a/pkgs/development/compilers/mint/shards.nix +++ b/pkgs/development/compilers/mint/shards.nix @@ -1,42 +1,52 @@ { admiral = { - url = "jwaldrip/admiral.cr"; - rev = "07dde44b2d499c0a941b8da6270e1eac0baadcc2"; + url = "https://github.com/jwaldrip/admiral.cr"; + rev = "v1.6.1"; + sha256 = "0y30b9b9rkz43afd3b9l24hs0r170qyc07r05kvydbv89376c53i"; }; ameba = { - url = "veelenga/ameba"; - rev = "7a4fcec5ce62ff92197014f67143c8112866cf8a"; + url = "https://github.com/veelenga/ameba"; + rev = "v0.6.0"; + sha256 = "16jfyrkfc909h16si513lw944qp3dyapymczcqc2ic0jaal0af5b"; }; baked_file_system = { - url = "schovi/baked_file_system"; - rev = "22956aa79e889c241884017461e9dc79443d84d9"; + url = "https://github.com/schovi/baked_file_system"; + rev = "v0.9.6"; + sha256 = "06cpriaizp5pcqwdq3jl2lm4sz9b2gcxg3a9q3lh0fqk2acajzmx"; }; duktape = { - url = "jessedoyle/duktape.cr"; - rev = "0e59b56835da23068fe5bd5fbddb935cf0123b67"; + url = "https://github.com/jessedoyle/duktape.cr"; + rev = "v0.13.0"; + sha256 = "0v0nckprgr7idmsx97g98as1a7z4hmlmwl924dbbaqvyslv5ls6w"; }; kemal = { - url = "kemalcr/kemal"; - rev = "17bd3dce3724b092fd1151cad126f5973da00204"; + url = "https://github.com/kemalcr/kemal"; + rev = "v0.22.0"; + sha256 = "0gq3c27grgh90fykbj9fdsz507lwd41gk686qfnig6npndqv1v10"; }; kilt = { - url = "jeromegn/kilt"; - rev = "d177f02e124a197d22c4cc6d8dee7e1b33821bb1"; + url = "https://github.com/jeromegn/kilt"; + rev = "v0.4.0"; + sha256 = "1w9ib6j4xhwxdxx58nzc06gw7ci7vga03vgj1z1bnklamb0b0l0k"; }; radix = { - url = "luislavena/radix"; - rev = "4acb5cfbc304751d94201cdbca72947214af6ee1"; + url = "https://github.com/luislavena/radix"; + rev = "v0.3.8"; + sha256 = "1kn2xxj8a8j6f6g1dr0s9mkrj1xqnpzw9wnbq24mbv8ach9a1hva"; }; string_inflection = { - url = "mosop/string_inflection"; - rev = "fe46a7269ff8183d4d24728fb24cfa576e89829e"; + url = "https://github.com/mosop/string_inflection"; + rev = "v0.2.1"; + sha256 = "10vkr28h7n53ijjv57ldxhh473086qg313lzs55a7wsh0zgc104m"; }; time_format = { - url = "vladfaust/time_format.cr"; - rev = "30676d3712cb9a0a667c763c69912d801368f90d"; + url = "https://github.com/vladfaust/time_format.cr"; + rev = "v0.1.0"; + sha256 = "1f3rssdlcw2a5f74qa8bzlf1rh5dzvyg1d32w9qlisf2cc4lkh9g"; }; tree_template = { - url = "anykeyh/tree_template"; + url = "https://github.com/anykeyh/tree_template"; rev = "3fcb71ee6852040077dd1a2c8c55c67f4a95ba4e"; + sha256 = "04w89wpnkna4ipyy3pxshqqwgk965hz1d31vqp0mrb0ilmpsywdk"; }; } From ba1268fd9d557850014484bc38a6ae57009f5ffa Mon Sep 17 00:00:00 2001 From: Michael Fellinger Date: Wed, 30 May 2018 17:54:56 +0200 Subject: [PATCH 3/3] Use fetchFromGitHub instead --- .../development/compilers/mint/crystal2nix.cr | 4 ++- pkgs/development/compilers/mint/default.nix | 11 +++---- pkgs/development/compilers/mint/shards.nix | 30 ++++++++++++------- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/pkgs/development/compilers/mint/crystal2nix.cr b/pkgs/development/compilers/mint/crystal2nix.cr index 5d92ae4afea..017ebe62b49 100644 --- a/pkgs/development/compilers/mint/crystal2nix.cr +++ b/pkgs/development/compilers/mint/crystal2nix.cr @@ -9,6 +9,7 @@ File.open "shards.nix", "w+" do |file| file.puts %({) yaml = YAML.parse(File.read("shard.lock")) yaml["shards"].each do |key, value| + owner, repo = value["github"].as_s.split("/") url = "https://github.com/#{value["github"]}" rev = if value["version"]? "v#{value["version"]}" @@ -24,7 +25,8 @@ File.open "shards.nix", "w+" do |file| end file.puts %( #{key} = {) - file.puts %( url = "#{url}";) + file.puts %( owner = "#{owner}";) + file.puts %( repo = "#{repo}";) file.puts %( rev = "#{rev}";) file.puts %( sha256 = "#{sha256}";) file.puts %( };) diff --git a/pkgs/development/compilers/mint/default.nix b/pkgs/development/compilers/mint/default.nix index f28b7db3a56..619170d4a48 100644 --- a/pkgs/development/compilers/mint/default.nix +++ b/pkgs/development/compilers/mint/default.nix @@ -1,9 +1,9 @@ -{stdenv, lib, fetchgit, crystal, zlib, openssl, duktape}: +{stdenv, lib, fetchFromGitHub, crystal, zlib, openssl, duktape}: let crystalPackages = lib.mapAttrs (name: src: stdenv.mkDerivation { name = lib.replaceStrings ["/"] ["-"] name; - src = fetchgit src; + src = fetchFromGitHub src; phases = "installPhase"; installPhase = ''cp -r $src $out''; passthru = { libName = name; }; @@ -30,8 +30,9 @@ in stdenv.mkDerivation rec { version = "2018-05-27"; name = "mint-${version}"; - src = fetchgit { - url = "https://github.com/mint-lang/mint.git"; + src = fetchFromGitHub { + owner = "mint-lang"; + repo = "mint"; rev = "a3f0c86f54b8b3a18dda5c39c2089bdb1d774b4f"; sha256 = "1bgs6jkwfc2ksq4gj55cl3h2l5g25f5bwlsjryiw9cbx5k4bp1kz"; }; @@ -51,7 +52,7 @@ stdenv.mkDerivation rec { installPhase = ''true''; meta = { - description = "A refreshing language for the front-end web."; + 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 ]; diff --git a/pkgs/development/compilers/mint/shards.nix b/pkgs/development/compilers/mint/shards.nix index ba42006c461..dcf7454b4ca 100644 --- a/pkgs/development/compilers/mint/shards.nix +++ b/pkgs/development/compilers/mint/shards.nix @@ -1,51 +1,61 @@ { admiral = { - url = "https://github.com/jwaldrip/admiral.cr"; + owner = "jwaldrip"; + repo = "admiral.cr"; rev = "v1.6.1"; sha256 = "0y30b9b9rkz43afd3b9l24hs0r170qyc07r05kvydbv89376c53i"; }; ameba = { - url = "https://github.com/veelenga/ameba"; + owner = "veelenga"; + repo = "ameba"; rev = "v0.6.0"; sha256 = "16jfyrkfc909h16si513lw944qp3dyapymczcqc2ic0jaal0af5b"; }; baked_file_system = { - url = "https://github.com/schovi/baked_file_system"; + owner = "schovi"; + repo = "baked_file_system"; rev = "v0.9.6"; sha256 = "06cpriaizp5pcqwdq3jl2lm4sz9b2gcxg3a9q3lh0fqk2acajzmx"; }; duktape = { - url = "https://github.com/jessedoyle/duktape.cr"; + owner = "jessedoyle"; + repo = "duktape.cr"; rev = "v0.13.0"; sha256 = "0v0nckprgr7idmsx97g98as1a7z4hmlmwl924dbbaqvyslv5ls6w"; }; kemal = { - url = "https://github.com/kemalcr/kemal"; + owner = "kemalcr"; + repo = "kemal"; rev = "v0.22.0"; sha256 = "0gq3c27grgh90fykbj9fdsz507lwd41gk686qfnig6npndqv1v10"; }; kilt = { - url = "https://github.com/jeromegn/kilt"; + owner = "jeromegn"; + repo = "kilt"; rev = "v0.4.0"; sha256 = "1w9ib6j4xhwxdxx58nzc06gw7ci7vga03vgj1z1bnklamb0b0l0k"; }; radix = { - url = "https://github.com/luislavena/radix"; + owner = "luislavena"; + repo = "radix"; rev = "v0.3.8"; sha256 = "1kn2xxj8a8j6f6g1dr0s9mkrj1xqnpzw9wnbq24mbv8ach9a1hva"; }; string_inflection = { - url = "https://github.com/mosop/string_inflection"; + owner = "mosop"; + repo = "string_inflection"; rev = "v0.2.1"; sha256 = "10vkr28h7n53ijjv57ldxhh473086qg313lzs55a7wsh0zgc104m"; }; time_format = { - url = "https://github.com/vladfaust/time_format.cr"; + owner = "vladfaust"; + repo = "time_format.cr"; rev = "v0.1.0"; sha256 = "1f3rssdlcw2a5f74qa8bzlf1rh5dzvyg1d32w9qlisf2cc4lkh9g"; }; tree_template = { - url = "https://github.com/anykeyh/tree_template"; + owner = "anykeyh"; + repo = "tree_template"; rev = "3fcb71ee6852040077dd1a2c8c55c67f4a95ba4e"; sha256 = "04w89wpnkna4ipyy3pxshqqwgk965hz1d31vqp0mrb0ilmpsywdk"; };