-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlangs.nix
82 lines (80 loc) · 2.1 KB
/
langs.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
{ pkgs }: {
hs = {
name = "Haskell";
slug = "haskell";
url = "https://www.haskell.org/";
full = true;
extension = "hs";
buildInputs =
let
inherit (pkgs) haskellPackages;
aoc = haskellPackages.callPackage ./lib/hs/adventofcode/pkg.nix { };
ghcPkgs = hpkgs:
with hpkgs; [
MonadRandom
aeson
aoc
cryptonite
fingertree
hashable
lens
matrix
megaparsec
multiset
pipes
split
unordered-containers
vector
];
in
[ (haskellPackages.ghcWithPackages ghcPkgs) ];
buildPhase = ''
ghc -O2 run.hs
'';
shellRunHelp = "ghc -O2 run.hs && time ./run";
};
asm = rec {
name = "ASM";
slug = "asm";
url = "https://en.wikipedia.org/wiki/X86_assembly_language";
full = false;
extension = "asm";
buildInputs = with pkgs; [ nasm man-pages gdb glibc.dev ];
buildPhase = ''
nasm -felf64 run.asm && ld -o run run.o
'';
shellRunHelp = "nasm -felf64 run.asm && ld -o run run.o && time ./run < input.txt";
};
koka = {
name = "Koka";
slug = "koka";
url = "https://koka-lang.github.io/koka/doc/index.html";
full = false;
extension = "kk";
buildInputs = [ pkgs.koka ];
# TODO: Add some support for sharing the compilation result of the
# stdlib, otherwise we recompile it for every single derivation.
buildPhase = ''
koka -o run run.kk && chmod +x ./run
'';
shellRunHelp = "koka -o run run.kk && time ./run";
};
nix =
let runner = pkgs.callPackage ./lib/nix/pkg.nix { };
in
rec {
name = "Nix";
slug = "nix";
url = "https://nixos.org/";
full = false;
extension = "nix";
buildInputs = [ pkgs.makeWrapper runner ];
buildPhase = ''
mkdir -p $out/share/
cp $src/run.nix $out/share/
makeWrapper ${runner}/bin/nix-eval run \
--set TARGET $out/share/run.nix
'';
shellRunHelp = "time nix-eval ./run.nix";
};
}