-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
79 lines (67 loc) · 2.25 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
{
description = "ESM Arma - A Rust-based server component";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
rustToolchain = pkgs.rust-bin.stable.latest.default.override
{
extensions = [ "rust-src" "rust-analyzer" "clippy" ];
targets = [
"x86_64-unknown-linux-gnu"
"i686-unknown-linux-gnu"
"x86_64-pc-windows-gnu"
"i686-pc-windows-gnu"
];
};
in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
# Rust
rustToolchain
# Build essentials
pkg-config
openssl_3
openssl.dev
# Docker tools (for containerization)
docker-compose
docker-client
patchelf
mysql84
];
shellHook = ''
OPENSSL_LIB="${pkgs.openssl_3.out}/lib"
echo "setting up binary wrappers..."
mkdir -p tools/wrappers
if [ -f tools/sqfvm ]; then
echo "patching sqfvm..."
cp -f tools/sqfvm tools/wrappers/sqfvm
patchelf --set-interpreter "${pkgs.stdenv.cc.bintools.dynamicLinker}" tools/wrappers/sqfvm || true
fi
if [ -f tools/armake2 ]; then
echo "patching armake2..."
cp -f tools/armake2 tools/wrappers/armake2
patchelf --set-interpreter "${pkgs.stdenv.cc.bintools.dynamicLinker}" tools/wrappers/armake2 || true
patchelf --set-rpath "$OPENSSL_LIB" tools/wrappers/armake2 || true
fi
chmod +x tools/wrappers/*
'';
# Environment variables
RUST_BACKTRACE = "1";
RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library";
};
}
);
}