forked from dodona-edu/universal-judge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
160 lines (149 loc) · 4.52 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
{
description = "TESTed";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
devshell = {
url = "github:numtide/devshell";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, devshell, flake-utils, mach-nix, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; overlays = [ devshell.overlays.default ]; };
python = pkgs.python311;
ast = pkgs.buildNpmPackage rec {
pname = "abstract-syntax-tree";
version = "2.20.6";
src = pkgs.fetchFromGitHub {
owner = "buxlabs";
repo = pname;
rev = "94115dc1f1fd01731c7d43f3d7773dda12b9446f";
hash = "sha256-jiXZQ0CbU2QSuDKaUBLin4LPSgiasEyBO/TlyNhNqrI=";
};
npmDepsHash = "sha256-ZSJvh3IP1VKJ0WR9axKEm4prUBVGyOKHyacIPSpImsU=";
dontNpmBuild = true;
meta = with pkgs.lib; {
description = "A library for working with abstract syntax trees";
license = licenses.mit;
maintainers = [];
};
};
marko = python.pkgs.buildPythonPackage rec {
pname = "marko";
version = "2.0.0";
format = "pyproject";
src = pkgs.fetchPypi {
inherit pname version;
hash = "sha256-78JkYIkyUME3UQJa6SAuuxOJiHA2/A35AJxquHVGcDA=";
};
nativeBuildInputs = [
python.pkgs.pdm-pep517 python.pkgs.pdm-backend
];
doCheck = false;
meta = with pkgs.lib; {
homepage = "https://github.com/frostming/marko";
license = licenses.mit;
maintainers = [ ];
};
};
core-packages = ps: with ps; [
psutil
pydantic
attrs
cattrs
jsonschema
typing-inspect
pyyaml
pygments
python-i18n
];
python-env = python.withPackages(ps: (core-packages ps) ++ [
ps.pylint
ps.pytest
ps.pytest-mock
ps.pytest-cov
ps.pytest-xdist
# For Pycharm
ps.setuptools
ps.isort
ps.black
ps.jinja2
marko
]);
core-deps = [
(python.withPackages(ps: (core-packages ps) ++ [ps.pylint]))
];
haskell-deps = [
(pkgs.haskell.packages.ghc94.ghcWithPackages (p: [p.aeson]))
pkgs.hlint
];
node-deps = [
pkgs.nodejs-18_x
pkgs.nodePackages.eslint
ast
];
bash-deps = [
pkgs.shellcheck
];
c-deps = [
pkgs.cppcheck
pkgs.gcc
];
java-deps = [
pkgs.openjdk17
pkgs.checkstyle
];
kotlin-deps = [
pkgs.kotlin
pkgs.ktlint
];
csharp-deps = [
pkgs.dotnetCorePackages.sdk_6_0
];
in
{
devShells = rec {
default = tested;
tested = pkgs.devshell.mkShell {
name = "TESTed";
packages = [python-env pkgs.nodePackages.pyright pkgs.pipenv] ++ haskell-deps ++ node-deps ++ bash-deps ++ c-deps ++ java-deps ++ kotlin-deps ++ csharp-deps;
devshell.startup.link.text = ''
mkdir -p "$PRJ_DATA_DIR/current"
ln -sfn "${python-env}/${python-env.sitePackages}" "$PRJ_DATA_DIR/current/python-packages"
ln -sfn "${python-env}" "$PRJ_DATA_DIR/current/python"
'';
env = [
{
name = "DOTNET_ROOT";
eval = "${pkgs.dotnetCorePackages.sdk_6_0}";
}
{
name = "NODE_PATH";
prefix = "$(npm get prefix)";
}
];
commands = [
{
name = "test:stable";
category = "tests";
help = "Run the non-flaky tests.";
command = ''
python -m pytest tests/ -m "not flaky"
'';
}
{
name = "test:all";
category = "tests";
help = "Run all tests.";
command = ''
python -m pytest tests/
'';
}
];
};
};
}
);
}