-
-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mint-lang: Init at 2018.05.27 #41148
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
require "yaml" | ||
require "json" | ||
|
||
class PrefetchJSON | ||
JSON.mapping(sha256: String) | ||
end | ||
|
||
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"]}" | ||
else | ||
value["commit"].as_s | ||
end | ||
|
||
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 %( #{key} = {) | ||
file.puts %( owner = "#{owner}";) | ||
file.puts %( repo = "#{repo}";) | ||
file.puts %( rev = "#{rev}";) | ||
file.puts %( sha256 = "#{sha256}";) | ||
file.puts %( };) | ||
end | ||
file.puts %(}) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{stdenv, lib, fetchFromGitHub, crystal, zlib, openssl, duktape}: | ||
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 = "2018-05-27"; | ||
name = "mint-${version}"; | ||
src = fetchFromGitHub { | ||
owner = "mint-lang"; | ||
repo = "mint"; | ||
rev = "a3f0c86f54b8b3a18dda5c39c2089bdb1d774b4f"; | ||
sha256 = "1bgs6jkwfc2ksq4gj55cl3h2l5g25f5bwlsjryiw9cbx5k4bp1kz"; | ||
}; | ||
|
||
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" ]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
admiral = { | ||
owner = "jwaldrip"; | ||
repo = "admiral.cr"; | ||
rev = "v1.6.1"; | ||
sha256 = "0y30b9b9rkz43afd3b9l24hs0r170qyc07r05kvydbv89376c53i"; | ||
}; | ||
ameba = { | ||
owner = "veelenga"; | ||
repo = "ameba"; | ||
rev = "v0.6.0"; | ||
sha256 = "16jfyrkfc909h16si513lw944qp3dyapymczcqc2ic0jaal0af5b"; | ||
}; | ||
baked_file_system = { | ||
owner = "schovi"; | ||
repo = "baked_file_system"; | ||
rev = "v0.9.6"; | ||
sha256 = "06cpriaizp5pcqwdq3jl2lm4sz9b2gcxg3a9q3lh0fqk2acajzmx"; | ||
}; | ||
duktape = { | ||
owner = "jessedoyle"; | ||
repo = "duktape.cr"; | ||
rev = "v0.13.0"; | ||
sha256 = "0v0nckprgr7idmsx97g98as1a7z4hmlmwl924dbbaqvyslv5ls6w"; | ||
}; | ||
kemal = { | ||
owner = "kemalcr"; | ||
repo = "kemal"; | ||
rev = "v0.22.0"; | ||
sha256 = "0gq3c27grgh90fykbj9fdsz507lwd41gk686qfnig6npndqv1v10"; | ||
}; | ||
kilt = { | ||
owner = "jeromegn"; | ||
repo = "kilt"; | ||
rev = "v0.4.0"; | ||
sha256 = "1w9ib6j4xhwxdxx58nzc06gw7ci7vga03vgj1z1bnklamb0b0l0k"; | ||
}; | ||
radix = { | ||
owner = "luislavena"; | ||
repo = "radix"; | ||
rev = "v0.3.8"; | ||
sha256 = "1kn2xxj8a8j6f6g1dr0s9mkrj1xqnpzw9wnbq24mbv8ach9a1hva"; | ||
}; | ||
string_inflection = { | ||
owner = "mosop"; | ||
repo = "string_inflection"; | ||
rev = "v0.2.1"; | ||
sha256 = "10vkr28h7n53ijjv57ldxhh473086qg313lzs55a7wsh0zgc104m"; | ||
}; | ||
time_format = { | ||
owner = "vladfaust"; | ||
repo = "time_format.cr"; | ||
rev = "v0.1.0"; | ||
sha256 = "1f3rssdlcw2a5f74qa8bzlf1rh5dzvyg1d32w9qlisf2cc4lkh9g"; | ||
}; | ||
tree_template = { | ||
owner = "anykeyh"; | ||
repo = "tree_template"; | ||
rev = "3fcb71ee6852040077dd1a2c8c55c67f4a95ba4e"; | ||
sha256 = "04w89wpnkna4ipyy3pxshqqwgk965hz1d31vqp0mrb0ilmpsywdk"; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this tool really live in a mint-specific directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good question, and eventually I want to make it a standalone tool, but until I package more Crystal applications, I think it can live here for a bit.
I can remove it if you don't want to have it here, just thought it makes the work for future packages a bit easier.