-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
73 lines (69 loc) · 1.97 KB
/
flake.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
{
description = "Luogu Judge Environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
nixpkgs_gcc930.url = "github:NixOS/nixpkgs/99cd95772761842712f77c291d26443ee039d862";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = inputs@{ self, nixpkgs, nixpkgs_gcc930, rust-overlay, ... }: let
system = "x86_64-linux";
inherit(nixpkgs) lib;
pkgs = import nixpkgs {
inherit system;
overlays = [
rust-overlay.overlays.default
(self: super: {
gcc930 = nixpkgs_gcc930.legacyPackages.${super.system}.gcc9;
})
(import ./testlib/overlay.nix)
(import ./gcc/overlay.nix)
(import ./checker/overlay.nix)
];
};
createEnv = name: packages: (pkgs.buildEnv {
name = "ljudge-env_${builtins.replaceStrings ["/"] ["_"] name}";
paths = with pkgs; [coreutils bash] ++ packages;
});
in {
packages."${system}" = lib.mapAttrs createEnv (with pkgs; {
nul = [];
checker = [ljudge-checker];
text = [gnutar gzip];
gcc = [luogu-gcc];
gcc-930 = [luogu-gcc930];
rustc = [rust-bin.nightly.latest.default luogu-gcc];
ghc = [ghc];
python3-c = [(python311.withPackages (p: with p; [
numpy
]))];
python3-py = [pypy3];
pascal-fpc = [fpc binutils];
go = [go];
php = [(php82.buildEnv {
extensions = { all, ... }: with all; [
opcache ctype posix filter bcmath
iconv mbstring readline gmp
];
})];
ruby = [ruby];
js-node = [nodejs_20];
perl = [perl];
java-8 = [jdk8_headless];
java-21 = [jdk21_headless];
kotlin-jvm = [(kotlin.override { jre = jdk21_headless; })];
scala = [(scala.override { jre = jdk21_headless; })];
lua = [lua];
mono = [mono]; # TODO: use dotnet
ocaml = [ocaml luogu-gcc];
julia = [julia];
});
# packages."${system}" = {
# text = createJudgeProfile "text" [gnutar gzip];
# # C-family: GCC
# gcc = pkgs.luogu-gcc;
# gcc9 = pkgs.luogu-gcc-9;
# # Rust
# rust = pkgs.rust-bin.nightly.latest.default;
# };
};
}