-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
99 lines (90 loc) · 2.32 KB
/
Copy pathflake.nix
File metadata and controls
99 lines (90 loc) · 2.32 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{
description = "CLI client for Ret2Shell CTF platform";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
nixpkgs,
flake-utils,
fenix,
...
}:
let
inherit (nixpkgs) lib;
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
workspace = builtins.fromTOML (builtins.readFile ./Cargo.toml);
version = workspace.package.version;
in
flake-utils.lib.eachSystem systems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
ret2cli = pkgs.rustPlatform.buildRustPackage {
pname = "ret2cli";
inherit version;
src = lib.cleanSource ./.;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = [ pkgs.pkg-config ];
meta = {
description = "CLI client for Ret2Shell CTF platform";
homepage = "https://github.com/LyCecilion/ret2cli";
license = lib.licenses.mit;
mainProgram = "ret2cli";
};
};
app = {
type = "app";
program = lib.getExe ret2cli;
meta.description = "CLI client for Ret2Shell CTF platform";
};
in
{
packages = {
inherit ret2cli;
default = ret2cli;
};
apps = {
ret2cli = app;
default = app;
};
formatter = pkgs.nixfmt;
}
// lib.optionalAttrs (builtins.hasAttr system fenix.packages) {
devShells.default =
let
toolchain = fenix.packages.${system}.stable.withComponents [
"cargo"
"rustc"
"rust-src"
"rust-analyzer"
"clippy"
"rustfmt"
];
in
pkgs.mkShell {
nativeBuildInputs = [
toolchain
pkgs.cargo-dist
pkgs.pkg-config
pkgs.nixfmt
];
buildInputs = [
pkgs.openssl
];
shellHook = ''
echo "ret2cli dev shell — $(rustc --version)"
'';
};
}
);
}