Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
76 lines (70 loc) · 2.33 KB
/
Copy pathflake.nix
File metadata and controls
76 lines (70 loc) · 2.33 KB
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
{
description = "ret2console — Ret2Shell (回归终端) CTF 比赛平台的终端用户接口";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs }:
let
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = f:
nixpkgs.lib.genAttrs systems (system: f (import nixpkgs { inherit system; }));
ret2console = pkgs:
let
libwsrx = pkgs.python3.pkgs.buildPythonPackage rec {
pname = "libwsrx";
version = "0.1.0";
pyproject = true;
src = pkgs.fetchPypi {
inherit pname version;
hash = "sha256-M2ZaRPsEl10JxxdXmMM64ZaskciaouPuV2QtwZb5pLg=";
};
cargoDeps = pkgs.rustPlatform.fetchCargoVendor {
inherit src;
hash = "sha256-J5w+3P4mFZEWVqFME4m0lQK7rntg6bmUDqAN0QHa6bs=";
};
nativeBuildInputs = with pkgs.rustPlatform; [
cargoSetupHook
maturinBuildHook
];
};
in
pkgs.python3.pkgs.buildPythonPackage {
pname = "ret2console";
version = (builtins.fromTOML (builtins.readFile ./pyproject.toml)).project.version;
pyproject = true;
src = ./.;
build-system = [ pkgs.python3.pkgs.hatchling ];
dependencies = with pkgs.python3.pkgs; [
prompt-toolkit
rich
httpx
pillow
libwsrx
];
# 测试在 devShell 里用 uv run pytest 跑(本机另有完整测试套件)
doCheck = false;
meta = with pkgs.lib; {
description = "Ret2Shell 比赛平台的终端接口(ret2console / r2c)";
mainProgram = "ret2console";
license = licenses.gpl3Only;
};
};
mkApp = program: { type = "app"; program = "${program}"; };
in
{
packages = forAllSystems (pkgs: {
default = ret2console pkgs;
ret2console = ret2console pkgs;
});
apps = forAllSystems (pkgs: {
default = mkApp "${ret2console pkgs}/bin/ret2console";
ret2console = mkApp "${ret2console pkgs}/bin/ret2console";
r2c = mkApp "${ret2console pkgs}/bin/r2c";
});
};
}