Convert some packages to nix-based

Affected packages:
- crystal
- dart
- dash
- deno
- elixir
- erlang
- gawk
This commit is contained in:
Thomas Hobson 2022-01-31 18:02:35 +13:00
parent ddab59ccdd
commit af5036d82c
No known key found for this signature in database
GPG Key ID: 9F1FD9D87950DB6F
60 changed files with 224 additions and 309 deletions

View File

@ -1,7 +0,0 @@
#!/bin/bash
PREFIX=$(realpath $(dirname $0))
curl -L "https://github.com/crystal-lang/crystal/releases/download/0.36.1/crystal-0.36.1-1-linux-x86_64.tar.gz" -o crystal.tar.gz
tar xzf crystal.tar.gz --strip-components=1
rm crystal.tar.gz

View File

@ -1,5 +0,0 @@
#!/usr/bin/env bash
# Compile crystal files into out file
crystal build "$@" -o out --no-color && \
chmod +x out

View File

@ -1 +0,0 @@
export PATH=$PWD/bin:$PATH

View File

@ -1,5 +0,0 @@
{
"language": "crystal",
"version": "0.36.1",
"aliases": ["crystal", "cr"]
}

View File

@ -1,4 +0,0 @@
#!/bin/bash
shift # Filename is only used to compile
./out "$@"

View File

@ -1 +0,0 @@
puts("OK")

View File

@ -1,11 +0,0 @@
#!/usr/bin/env bash
curl -L "https://storage.googleapis.com/dart-archive/channels/stable/release/2.12.1/sdk/dartsdk-linux-x64-release.zip" -o dart.zip
unzip dart.zip
rm dart.zip
cp -r dart-sdk/* .
rm -rf dart-sdk
chmod -R +rx bin

View File

@ -1,4 +0,0 @@
#!/usr/bin/env bash
# Put 'export' statements here for environment variables
export PATH=$PWD/bin:$PATH

View File

@ -1,5 +0,0 @@
{
"language": "dart",
"version": "2.12.1",
"aliases": []
}

View File

@ -1,4 +0,0 @@
#!/usr/bin/env bash
# Put instructions to run the runtime
dart run "$@"

View File

@ -1,3 +0,0 @@
void main() {
print('OK');
}

View File

@ -1,19 +0,0 @@
#!/usr/bin/env bash
# Put instructions to build your package in here
PREFIX=$(realpath $(dirname $0))
mkdir -p build
cd build
curl "http://gondor.apana.org.au/~herbert/dash/files/dash-0.5.11.tar.gz" -o dash.tar.gz
tar xzf dash.tar.gz --strip-components=1
./configure --prefix "$PREFIX" &&
make -j$(nproc) &&
make install -j$(nproc)
cd ../
rm -rf build

View File

@ -1,4 +0,0 @@
#!/usr/bin/env bash
# Put 'export' statements here for environment variables
export PATH=$PWD/bin:$PATH

View File

@ -1,5 +0,0 @@
{
"language": "dash",
"version": "0.5.11",
"aliases": ["dash"]
}

View File

@ -1,4 +0,0 @@
#!/usr/bin/env bash
# Put instructions to run the runtime
dash "$@"

View File

@ -1 +0,0 @@
echo "OK"

View File

@ -1,5 +0,0 @@
#!/bin/bash
curl -OL https://github.com/denoland/deno/releases/download/v1.16.2/deno-x86_64-unknown-linux-gnu.zip
unzip -o deno-x86_64-unknown-linux-gnu.zip
rm deno-x86_64-unknown-linux-gnu.zip

View File

@ -1,3 +0,0 @@
#!/bin/bash
export PATH=$PWD:$PATH

View File

@ -1,20 +0,0 @@
{
"language": "deno",
"version": "1.16.2",
"dependencies": {},
"provides": [
{
"language": "typescript",
"aliases": [
"deno",
"deno-ts"
]
},
{
"language": "javascript",
"aliases": [
"deno-js"
]
}
]
}

View File

@ -1,3 +0,0 @@
#!/bin/bash
DENO_DIR=$PWD deno run $@

View File

@ -1 +0,0 @@
console.log("OK")

View File

@ -1,5 +0,0 @@
curl -L https://github.com/denoland/deno/releases/download/v1.7.5/deno-x86_64-unknown-linux-gnu.zip --output deno.zip
unzip -o deno.zip
rm deno.zip
chmod +x deno

View File

@ -1 +0,0 @@
export PATH=$PWD:$PATH

View File

@ -1,14 +0,0 @@
{
"language": "deno",
"version": "1.7.5",
"provides": [
{
"language": "typescript",
"aliases": ["deno-ts", "deno"]
},
{
"language": "javascript",
"aliases": ["deno-js"]
}
]
}

View File

@ -1,2 +0,0 @@
#!/bin/bash
DENO_DIR=$PWD deno run "$@"

View File

@ -1 +0,0 @@
console.log('OK');

View File

@ -1,25 +0,0 @@
#!/bin/bash
source ../../erlang/23.0.0/build.sh
export PATH=$PWD/bin:$PATH
PREFIX=$(realpath $(dirname $0))
mkdir -p build
cd build
curl -L "https://github.com/elixir-lang/elixir/archive/v1.11.3.tar.gz" -o elixir.tar.gz
tar xzf elixir.tar.gz --strip-components=1
rm elixir.tar.gz
./configure --prefix "$PREFIX"
make -j$(nproc)
cd ..
cp -r build/bin .
cp -r build/lib .
rm -rf build

View File

@ -1,5 +0,0 @@
#!/usr/bin/env bash
# Put 'export' statements here for environment variables
export LC_ALL=en_US.UTF-8
export PATH=$PWD/bin:$PATH

View File

@ -1,5 +0,0 @@
{
"language": "elixir",
"version": "1.11.3",
"aliases": ["elixir", "exs"]
}

View File

@ -1,4 +0,0 @@
#!/bin/bash
# Put instructions to run the runtime
elixir "$@"

View File

@ -1 +0,0 @@
IO.puts("OK")

View File

@ -1,21 +0,0 @@
#!/bin/bash
PREFIX=$(realpath $(dirname $0))
mkdir -p build
cd build
curl "http://erlang.org/download/otp_src_23.0.tar.gz" -o erlang.tar.gz
tar xzf erlang.tar.gz --strip-components=1
rm erlang.tar.gz
export ERL_TOP=$(pwd)
./configure --prefix "$PREFIX"
make -j$(nproc)
make install -j$(nproc)
cd ..
rm -rf build

View File

@ -1,4 +0,0 @@
#!/usr/bin/env bash
# Put 'export' statements here for environment variables
export PATH=$PWD/bin:$PATH

View File

@ -1,5 +0,0 @@
{
"language": "erlang",
"version": "23.0.0",
"aliases": ["erlang", "erl", "escript"]
}

View File

@ -1,4 +0,0 @@
#!/bin/bash
# Put instructions to run the runtime
escript "$@"

View File

@ -1,3 +0,0 @@
main(_) ->
io:format("OK~n").

View File

@ -1,3 +0,0 @@
#!/bin/bash
# Nothing to do here

View File

@ -1,3 +0,0 @@
#!/bin/bash
export PATH=$PWD:$PATH

View File

@ -1,5 +0,0 @@
{
"language": "file",
"version": "0.0.1",
"aliases": ["executable", "elf", "binary"]
}

View File

@ -1,6 +0,0 @@
#!/bin/bash
filename="$1"
chmod +x "$filename"
shift
./"$filename" "$@"

Binary file not shown.

View File

@ -1,21 +0,0 @@
#!/usr/bin/env bash
# Put instructions to build your package in here
PREFIX=$(realpath $(dirname $0))
mkdir -p build
cd build
curl "https://ftp.gnu.org/gnu/gawk/gawk-5.1.0.tar.gz" -o gawk.tar.gz
tar xzf gawk.tar.gz --strip-components=1
# === autoconf based ===
./configure --prefix "$PREFIX"
make -j$(nproc)
make install -j$(nproc)
cd ../
rm -rf build

View File

@ -1,4 +0,0 @@
#!/usr/bin/env bash
# Put 'export' statements here for environment variables
export PATH=$PWD/bin:$PATH

View File

@ -1,10 +0,0 @@
{
"language": "gawk",
"version": "5.1.0",
"provides": [
{
"language": "awk",
"aliases": ["gawk"]
}
]
}

View File

@ -1,4 +0,0 @@
#!/usr/bin/env bash
# Put instructions to run the runtime
gawk-5.1.0 -f "$@"

View File

@ -1 +0,0 @@
{print "OK"}

View File

@ -1,21 +0,0 @@
#!/bin/bash
PREFIX=$(realpath $(dirname $0))
mkdir -p build
cd build
curl "https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz" -o python.tar.gz
tar xzf python.tar.gz --strip-components=1
rm python.tar.gz
./configure --prefix "$PREFIX" --with-ensurepip=install
make -j$(nproc)
make install -j$(nproc)
cd ..
rm -rf build
bin/pip3 install numpy scipy pandas pycrypto whoosh bcrypt passlib sympy

View File

@ -1 +0,0 @@
export PATH=$PWD/bin:$PATH

View File

@ -1,5 +0,0 @@
{
"language": "python",
"version": "3.10.0",
"aliases": ["py", "py3", "python3", "python3.10"]
}

View File

@ -1,3 +0,0 @@
#!/bin/bash
python3.10 "$@"

View File

@ -1,7 +0,0 @@
working = True
match working:
case True:
print("OK")
case False:
print()

31
runtimes/crystal.nix Normal file
View File

@ -0,0 +1,31 @@
{pkgs, piston, ...}:
let
pkg = pkgs.crystal;
in piston.mkRuntime {
language = "crystal";
version = pkg.version;
aliases = [
"cr"
];
compile = ''
${pkg}/bin/crystal build "$@" -o out --no-color
chmod +x out
'';
run = ''
shift
./out "$@"
'';
tests = [
(piston.mkTest {
files = {
"test.cr" = ''
puts("OK")
'';
};
})
];
}

25
runtimes/dart.nix Normal file
View File

@ -0,0 +1,25 @@
{pkgs, piston, ...}:
let
pkg = pkgs.dart;
in piston.mkRuntime {
language = "dart";
version = pkg.version;
aliases = [];
run = ''
${pkg}/bin/dart run "$@"
'';
tests = [
(piston.mkTest {
files = {
"test.dart" = ''
void main() {
print('OK');
}
'';
};
})
];
}

22
runtimes/dash.nix Normal file
View File

@ -0,0 +1,22 @@
{pkgs, piston, ...}:
let
pkg = pkgs.dash;
in piston.mkRuntime {
language = "dash";
version = pkg.version;
aliases = [];
run = ''
${pkg}/bin/dash "$@"
'';
tests = [
(piston.mkTest {
files = {
"test.dash" = ''
echo "OK"
'';
};
})
];
}

View File

@ -5,4 +5,12 @@ args: {
"bash" = import ./bash.nix args;
"clojure" = import ./clojure.nix args;
"cobol-gnu-cobol" = import ./cobol-gnu-cobol.nix args;
"crystal" = import ./crystal.nix args;
"dart" = import ./dart.nix args;
"dash" = import ./dash.nix args;
"deno-javascript" = import ./deno-javascript.nix args;
"deno-typescript" = import ./deno-typescript.nix args;
"elixir" = import ./elixir.nix args;
"erlang" = import ./erlang.nix args;
"gawk-awk" = import ./gawk-awk.nix args;
}

View File

@ -0,0 +1,27 @@
{pkgs, piston, ...}:
let
pkg = pkgs.deno;
in piston.mkRuntime {
language = "javascript";
version = pkg.version;
runtime = "deno";
aliases = [
"js"
"deno-js"
];
run = ''
DENO_DIR=$PWD ${pkg}/bin/deno run $@
'';
tests = [
(piston.mkTest {
files = {
"test.js" = ''
console.log("OK");
'';
};
})
];
}

View File

@ -0,0 +1,27 @@
{pkgs, piston, ...}:
let
pkg = pkgs.deno;
in piston.mkRuntime {
language = "typescript";
version = pkg.version;
runtime = "deno";
aliases = [
"ts"
"deno-ts"
];
run = ''
DENO_DIR=$PWD ${pkg}/bin/deno run $@
'';
tests = [
(piston.mkTest {
files = {
"test.ts" = ''
console.log("OK");
'';
};
})
];
}

30
runtimes/elixir.nix Normal file
View File

@ -0,0 +1,30 @@
{pkgs, piston, ...}:
let
pkg = pkgs.elixir;
in piston.mkRuntime {
language = "elixir";
version = pkg.version;
aliases = [
"exs"
];
run = ''
export LC_ALL=en_US.UTF-8
${pkg}/bin/elixir "$@"
'';
tests = [
(piston.mkTest {
files = {
"test.exs" = ''
IO.puts("OK")
'';
};
})
];
limitOverrides = {
"max_file_size" = 100000000; # 100MB
};
}

28
runtimes/erlang.nix Normal file
View File

@ -0,0 +1,28 @@
{pkgs, piston, ...}:
let
pkg = pkgs.erlang;
in piston.mkRuntime {
language = "erlang";
version = pkg.version;
aliases = [
"erl"
"escript"
];
run = ''
${pkg}/bin/escript "$@"
'';
tests = [
(piston.mkTest {
files = {
"test.erl" = ''
main(_) ->
io:format("OK~n").
'';
};
})
];
}

26
runtimes/gawk-awk.nix Normal file
View File

@ -0,0 +1,26 @@
{pkgs, piston, ...}:
let
pkg = pkgs.gawk;
in piston.mkRuntime {
language = "awk";
version = pkg.version;
runtime = "gawk";
aliases = [];
run = ''
${pkg}/bin/gawk -f "$@"
'';
tests = [
(piston.mkTest {
files = {
"test.awk" = ''
{print "OK"}
'';
};
stdin = "\n"; # awk needs some line input
})
];
}