Merge pull request #20 from Profpatsch/master

Add fetcher script and update to dhall 1.31.0
This commit is contained in:
Profpatsch 2020-03-30 23:32:40 +02:00 committed by GitHub
commit aa9db8eb24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 170 additions and 25 deletions

View file

@ -32,3 +32,14 @@ nix-repl> drvs.dhall-simple
## NixOS: Contributors needed ## NixOS: Contributors needed
The derivations here have been tested by others to work on NixOS. If you have problems, open an issue. The derivations here have been tested by others to work on NixOS. If you have problems, open an issue.
## Update this repository
To update, run
```
./fetch.py
```
from the root of this repository.
It will prefetch the binaries from the latest dhall release on Github.

View file

@ -1,16 +1,20 @@
{ pkgs ? import <nixpkgs> {} }: { pkgs ? import <nixpkgs> {} }:
let
release = import ./release.nix;
in
pkgs.stdenv.mkDerivation rec { pkgs.stdenv.mkDerivation rec {
name = "dhall-bash-simple"; name = "dhall-bash-simple";
src = if pkgs.stdenv.isDarwin src = if pkgs.stdenv.isDarwin
then pkgs.fetchurl { then pkgs.fetchurl {
url = "https://github.com/dhall-lang/dhall-haskell/releases/download/1.30.0/dhall-bash-1.0.28-x86_64-macos.tar.bz2"; url = release.dhall-bash-darwin.url;
sha256 = "1flzfjb9qxphpgzpp9acpgxdylkn97zbrw6f3lbz6rnb2k7sc8b5"; sha256 = release.dhall-bash-darwin.hash;
} }
else pkgs.fetchurl { else pkgs.fetchurl {
url = "https://github.com/dhall-lang/dhall-haskell/releases/download/1.30.0/dhall-bash-1.0.28-x86_64-linux.tar.bz2"; url = release.dhall-bash-linux.url;
sha256 = "0v377zbna1m7mphgzmibbs35k3bshx22iwvnyciwryl9x2hglbsg"; sha256 = release.dhall-bash-linux.hash;
}; };
installPhase = '' installPhase = ''

View file

@ -1,16 +1,20 @@
{ pkgs ? import <nixpkgs> {} }: { pkgs ? import <nixpkgs> {} }:
let
release = import ./release.nix;
in
pkgs.stdenv.mkDerivation rec { pkgs.stdenv.mkDerivation rec {
name = "dhall-json-simple"; name = "dhall-json-simple";
src = if pkgs.stdenv.isDarwin src = if pkgs.stdenv.isDarwin
then pkgs.fetchurl { then pkgs.fetchurl {
url = "https://github.com/dhall-lang/dhall-haskell/releases/download/1.30.0/dhall-json-1.6.2-x86_64-macos.tar.bz2"; url = release.dhall-json-darwin.url;
sha256 = "02j0lg285a1a7w4rxcmvvn3fxyn5mnxrrgzdn8j4yjdbizkq13lx"; sha256 = release.dhall-json-darwin.hash;
} }
else pkgs.fetchurl { else pkgs.fetchurl {
url = "https://github.com/dhall-lang/dhall-haskell/releases/download/1.30.0/dhall-json-1.6.2-x86_64-linux.tar.bz2"; url = release.dhall-json-linux.url;
sha256 = "1wzlxcfvw1nf6g5rhnsd7g079f25n569s2gg7prrly0r9ry64dza"; sha256 = release.dhall-json-linux.hash;
}; };
installPhase = '' installPhase = ''

View file

@ -1,16 +1,20 @@
{ pkgs ? import <nixpkgs> {} }: { pkgs ? import <nixpkgs> {} }:
let
release = import ./release.nix;
in
pkgs.stdenv.mkDerivation rec { pkgs.stdenv.mkDerivation rec {
name = "dhall-lsp-simple"; name = "dhall-lsp-simple";
src = if pkgs.stdenv.isDarwin src = if pkgs.stdenv.isDarwin
then pkgs.fetchurl { then pkgs.fetchurl {
url = "https://github.com/dhall-lang/dhall-haskell/releases/download/1.30.0/dhall-lsp-server-1.0.5-x86_64-macos.tar.bz2"; url = release.dhall-lsp-server-darwin.url;
sha256 = "1ng7f6mrxz1yjwskdf0knlbrb1r8d95yb9sqzbfymnynvpakjn1g"; sha256 = release.dhall-lsp-server-darwin.hash;
} }
else pkgs.fetchurl { else pkgs.fetchurl {
url = "https://github.com/dhall-lang/dhall-haskell/releases/download/1.30.0/dhall-lsp-server-1.0.5-x86_64-linux.tar.bz2"; url = release.dhall-lsp-server-linux.url;
sha256 = "0bgidy98s6nn2ysfbyl13s36rc8mn1rr5lw2wdpad6achz0mr397"; sha256 = release.dhall-lsp-server-linux.hash;
}; };
installPhase = '' installPhase = ''

View file

@ -1,16 +1,20 @@
{ pkgs ? import <nixpkgs> {} }: { pkgs ? import <nixpkgs> {} }:
let
release = import ./release.nix;
in
pkgs.stdenv.mkDerivation rec { pkgs.stdenv.mkDerivation rec {
name = "dhall-nix-simple"; name = "dhall-nix-simple";
src = if pkgs.stdenv.isDarwin src = if pkgs.stdenv.isDarwin
then pkgs.fetchurl { then pkgs.fetchurl {
url = "https://github.com/dhall-lang/dhall-haskell/releases/download/1.30.0/dhall-nix-1.1.12-x86_64-macos.tar.bz2"; url = release.dhall-nix-darwin.url;
sha256 = "19fyhwldla827im6xajhdwgfcim66r9ajc6rwyhl18qlhfbddqhm"; sha256 = release.dhall-nix-darwin.hash;
} }
else pkgs.fetchurl { else pkgs.fetchurl {
url = "https://github.com/dhall-lang/dhall-haskell/releases/download/1.30.0/dhall-nix-1.1.12-x86_64-linux.tar.bz2"; url = release.dhall-nix-linux.url;
sha256 = "0wskg94n64khx3advc019bxmfa67pzvjkd1q2fjpz8cnn9953gmf"; sha256 = release.dhall-nix-linux.hash;
}; };
installPhase = '' installPhase = ''

View file

@ -1,16 +1,20 @@
{ pkgs ? import <nixpkgs> {} }: { pkgs ? import <nixpkgs> {} }:
let
release = import ./release.nix;
in
pkgs.stdenv.mkDerivation rec { pkgs.stdenv.mkDerivation rec {
name = "dhall-simple"; name = "dhall-simple";
src = if pkgs.stdenv.isDarwin src = if pkgs.stdenv.isDarwin
then pkgs.fetchurl { then pkgs.fetchurl {
url = "https://github.com/dhall-lang/dhall-haskell/releases/download/1.30.0/dhall-1.30.0-x86_64-macos.tar.bz2"; url = release.dhall-darwin.url;
sha256 = "03s4fj7i3jvnjk3faiqd77g46xxyj85i10jxrv2nvgy14kmx11cr"; sha256 = release.dhall-darwin.hash;
} }
else pkgs.fetchurl { else pkgs.fetchurl {
url = "https://github.com/dhall-lang/dhall-haskell/releases/download/1.30.0/dhall-1.30.0-x86_64-linux.tar.bz2"; url = release.dhall-linux.url;
sha256 = "00llrslfvlihfzryfvh8z2dz93nz1327h4ha2ks41k63x4fl4ib8"; sha256 = release.dhall-linux.hash;
}; };
installPhase = '' installPhase = ''

View file

@ -1,16 +1,20 @@
{ pkgs ? import <nixpkgs> {} }: { pkgs ? import <nixpkgs> {} }:
let
release = import ./release.nix;
in
pkgs.stdenv.mkDerivation rec { pkgs.stdenv.mkDerivation rec {
name = "dhall-yaml-simple"; name = "dhall-yaml-simple";
src = if pkgs.stdenv.isDarwin src = if pkgs.stdenv.isDarwin
then pkgs.fetchurl { then pkgs.fetchurl {
url = "https://github.com/dhall-lang/dhall-haskell/releases/download/1.30.0/dhall-yaml-1.0.2-x86_64-macos.tar.bz2"; url = release.dhall-yaml-darwin.url;
sha256 = "05hj7h682bwk721r86qjq4s24q1vy302kacak9gn7l6k05awx166"; sha256 = release.dhall-yaml-darwin.hash;
} }
else pkgs.fetchurl { else pkgs.fetchurl {
url = "https://github.com/dhall-lang/dhall-haskell/releases/download/1.30.0/dhall-yaml-1.0.2-x86_64-linux.tar.bz2"; url = release.dhall-yaml-linux.url;
sha256 = "0n8015gc7pkqppqabxw66yvdv0kzd747z3hr477bzv1aawpc8i9f"; sha256 = release.dhall-yaml-linux.hash;
}; };
installPhase = '' installPhase = ''

47
fetch.py Executable file
View file

@ -0,0 +1,47 @@
#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p python3 curl nix
import json
import re
import subprocess as sub
import sys
# fetch the release info from releases/latest
def curl_latest_release():
url = "https://api.github.com/repos/dhall-lang/dhall-haskell/releases/latest"
return json.loads(sub.check_output(["curl", url]))
# call nix-prefetch-url on each asset to get their hashes
def prefetch_binaries(release):
res = []
for a in release['assets']:
if "linux" in a['name'] or "macos" in a['name']:
print(a['name'], file=sys.stderr)
hash = sub.check_output(["nix-prefetch-url", a['browser_download_url']]).strip().decode()
res += [{
'name': a['name'],
'url': a['browser_download_url'],
'hash': hash
}]
return res
# convert the list of binaries to an object we can address
def postprocess(fetched):
obj = {}
for i in fetched:
# split on the first digit ("dhall-foo-bar-1.2.3")
name = re.split(r'-\d', i['name'])[0]
post = "-linux" if "linux" in i['name'] else "-darwin"
obj[name + post] = i
return(obj)
if __name__ == "__main__":
release = curl_latest_release()
version = release['tag_name']
print("updating to release {}".format(version), file=sys.stderr)
fetched = prefetch_binaries(release)
res = postprocess(fetched)
print("writing ./release.json", file=sys.stderr)
with open("./release.json", mode='w') as f:
json.dump(res, f, indent=2)

62
release.json Normal file
View file

@ -0,0 +1,62 @@
{
"dhall-linux": {
"name": "dhall-1.31.0-x86_64-linux.tar.bz2",
"url": "https://github.com/dhall-lang/dhall-haskell/releases/download/1.31.0/dhall-1.31.0-x86_64-linux.tar.bz2",
"hash": "0h8hnxgh7jpql79fgr9iv0qy0122fph64vwqld02p6cb3v7s59yd"
},
"dhall-darwin": {
"name": "dhall-1.31.0-x86_64-macos.tar.bz2",
"url": "https://github.com/dhall-lang/dhall-haskell/releases/download/1.31.0/dhall-1.31.0-x86_64-macos.tar.bz2",
"hash": "063gidfq64fnbb8ixfdx9y5lraxwh1gc1hbq8x201d84c0rvldrk"
},
"dhall-bash-linux": {
"name": "dhall-bash-1.0.29-x86_64-linux.tar.bz2",
"url": "https://github.com/dhall-lang/dhall-haskell/releases/download/1.31.0/dhall-bash-1.0.29-x86_64-linux.tar.bz2",
"hash": "1907b5c377gzbyghlf5gfghasm14szqj7x5bmkibxspymxwxza3h"
},
"dhall-bash-darwin": {
"name": "dhall-bash-1.0.29-x86_64-macos.tar.bz2",
"url": "https://github.com/dhall-lang/dhall-haskell/releases/download/1.31.0/dhall-bash-1.0.29-x86_64-macos.tar.bz2",
"hash": "0ad0k73rvljxmrygx9vz0aiksrm4hs876k7q0vc261vmw95p5rqq"
},
"dhall-json-linux": {
"name": "dhall-json-1.6.3-x86_64-linux.tar.bz2",
"url": "https://github.com/dhall-lang/dhall-haskell/releases/download/1.31.0/dhall-json-1.6.3-x86_64-linux.tar.bz2",
"hash": "0x4q39g02swkcj47r9cr53dljn06dwjrfiypp17is7csb62lhs6h"
},
"dhall-json-darwin": {
"name": "dhall-json-1.6.3-x86_64-macos.tar.bz2",
"url": "https://github.com/dhall-lang/dhall-haskell/releases/download/1.31.0/dhall-json-1.6.3-x86_64-macos.tar.bz2",
"hash": "158mw49rayivb9xp6ch8cai1p6i94pa6ivpfbpjlb8j9r603jkvn"
},
"dhall-lsp-server-linux": {
"name": "dhall-lsp-server-1.0.6-x86_64-linux.tar.bz2",
"url": "https://github.com/dhall-lang/dhall-haskell/releases/download/1.31.0/dhall-lsp-server-1.0.6-x86_64-linux.tar.bz2",
"hash": "1fmd5snaa7c441g994szl1chzcq0wyzjr7fkshf8jg5mw1gs1z5i"
},
"dhall-lsp-server-darwin": {
"name": "dhall-lsp-server-1.0.6-x86_64-macos.tar.bz2",
"url": "https://github.com/dhall-lang/dhall-haskell/releases/download/1.31.0/dhall-lsp-server-1.0.6-x86_64-macos.tar.bz2",
"hash": "1h0rr7n0fw41fnivdaywxba5rbh007x9y627d10azd1whm7f1r3s"
},
"dhall-nix-linux": {
"name": "dhall-nix-1.1.13-x86_64-linux.tar.bz2",
"url": "https://github.com/dhall-lang/dhall-haskell/releases/download/1.31.0/dhall-nix-1.1.13-x86_64-linux.tar.bz2",
"hash": "0vhrlbnky58hm975ikq47z1pc1578r5mzv8l1ppysxwi30v0riv9"
},
"dhall-nix-darwin": {
"name": "dhall-nix-1.1.13-x86_64-macos.tar.bz2",
"url": "https://github.com/dhall-lang/dhall-haskell/releases/download/1.31.0/dhall-nix-1.1.13-x86_64-macos.tar.bz2",
"hash": "15i8cpwlzjsf19n8lqzfj75qspv8zkcf43nxdd1cjb6b8by1pqg6"
},
"dhall-yaml-linux": {
"name": "dhall-yaml-1.0.3-x86_64-linux.tar.bz2",
"url": "https://github.com/dhall-lang/dhall-haskell/releases/download/1.31.0/dhall-yaml-1.0.3-x86_64-linux.tar.bz2",
"hash": "0bx3273s5b9rj3k4d69qazsqlfjq8yb7idfddk86kqgjxas5wkr3"
},
"dhall-yaml-darwin": {
"name": "dhall-yaml-1.0.3-x86_64-macos.tar.bz2",
"url": "https://github.com/dhall-lang/dhall-haskell/releases/download/1.31.0/dhall-yaml-1.0.3-x86_64-macos.tar.bz2",
"hash": "0crb9kara9jfskljb5v3m5whl72spamml3h6afjz8clym925ka2y"
}
}

1
release.nix Normal file
View file

@ -0,0 +1 @@
builtins.fromJSON (builtins.readFile ./release.json)