Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 rustPlatform,
4 fetchFromGitHub,
5 ccloader,
6}:
7
8let
9 # for whatever reason, rustPlatform fetches it the wrong way, so do it manually
10 pcf = fetchFromGitHub {
11 owner = "MinusKelvin";
12 repo = "pcf";
13 rev = "64cd95557f3cf56e11e4c91a963fce9700d85325";
14 hash = "sha256-2/Y5thDN5fwthk+I/D7pORe7yQ1H0UpNjVvAeSYpD5Q=";
15 };
16in
17
18rustPlatform.buildRustPackage {
19 pname = "libcoldclear";
20 version = "0.1.0";
21
22 src = "${ccloader.src}/cold-clear";
23
24 # remove workspace cargo.toml so we don't load all of workspace's deps
25 postPatch = ''
26 rm Cargo.toml
27 sed -i 's%git = "https://github.com/MinusKelvin/pcf", rev = "64cd955"%path = "../pcf"%g' */Cargo.toml
28 ln -s ${pcf} pcf
29 cd c-api
30 ln -s ${./Cargo.lock} Cargo.lock
31 '';
32
33 cargoLock = {
34 lockFile = ./Cargo.lock;
35 outputHashes = {
36 "webutil-0.1.0" = "sha256-Zg98VmCUd/ZTlRTfTfkPJh4xX0QrepGxICbszebQw0I=";
37 };
38 };
39
40 postInstall = ''
41 mkdir -p $out/include
42 cp coldclear.h $out/include
43 '';
44
45 meta = with lib; {
46 description = "Tetris AI";
47 homepage = "https://github.com/26F-Studio/cold-clear";
48 license = licenses.mpl20;
49 maintainers = with maintainers; [ chayleaf ];
50 };
51}