Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
94 lines (84 loc) · 2.34 KB
/
Copy pathflake.nix
File metadata and controls
94 lines (84 loc) · 2.34 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
{
description = "SPSCQueue benchmark environment with optional comparison queues";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
mpmcqueue = {
url = "github:rigtorp/MPMCQueue";
flake = false;
};
dro-spsc-queue = {
url = "github:drogalis/SPSC-Queue";
flake = false;
};
atomic-queue = {
url = "github:max0x7ba/atomic_queue";
flake = false;
};
};
outputs = {
self,
nixpkgs,
mpmcqueue,
dro-spsc-queue,
atomic-queue,
}: let
supportedSystems = ["x86_64-linux" "aarch64-linux"];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
in {
packages = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
benchmark = pkgs.stdenv.mkDerivation {
pname = "spscqueue-benchmark";
version = "2.0.1";
src = ./.;
hardeningDisable = ["all"];
nativeBuildInputs = [pkgs.cmake];
buildInputs = [
pkgs.boost.dev
pkgs.dpdk
pkgs.folly.dev
pkgs.readerwriterqueue
];
cmakeFlags = [
"-DCMAKE_BUILD_TYPE=Release"
"-DBUILD_TESTING=ON"
];
env.NIX_CFLAGS_COMPILE = "-isystem ${mpmcqueue}/include -isystem ${dro-spsc-queue}/include -isystem ${atomic-queue}/include";
buildFlags = ["SPSCQueueBenchmark"];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp SPSCQueueBenchmark $out/bin/SPSCQueueBenchmark
runHook postInstall
'';
};
in {
inherit benchmark;
default = benchmark;
});
apps = forAllSystems (system: {
benchmark = {
type = "app";
program = "${self.packages.${system}.benchmark}/bin/SPSCQueueBenchmark";
};
default = self.apps.${system}.benchmark;
});
devShells = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
default = pkgs.mkShell {
packages = [
pkgs.cmake
pkgs.ninja
pkgs.boost.dev
pkgs.dpdk
pkgs.folly.dev
pkgs.readerwriterqueue
];
shellHook = ''
export NIX_CFLAGS_COMPILE="''${NIX_CFLAGS_COMPILE:-} -isystem ${mpmcqueue}/include -isystem ${dro-spsc-queue}/include -isystem ${atomic-queue}/include"
'';
};
});
};
}