Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
118 lines (99 loc) · 3.65 KB
/
Copy pathflake.nix
File metadata and controls
118 lines (99 loc) · 3.65 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
{
description = "PulseScan C++ — asynchronous network scanner and host monitor";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
# Create patched source with Nix-compatible CMakeLists.txt
# (nixpkgs boost is monolithic — no per-component cmake configs)
src = pkgs.runCommandLocal "pulsescan-cpp-src" {
} ''
# Copy clean source tree (respects .gitignore)
mkdir -p $out
cp -r ${pkgs.lib.cleanSource ./.}/* $out/
# Patch CMakeLists.txt: remove Boost COMPONENTS for nixpkgs monolithic boost
sed -i 's/find_package(Boost REQUIRED COMPONENTS system)/find_package(Boost REQUIRED)/' \
$out/CMakeLists.txt
# Remove Boost::system from link libraries (monolithic boost has no per-component cmake config)
sed -i '/target_link_libraries.*Boost::system/s/Boost::system //g' \
$out/CMakeLists.txt
'';
in
{
packages.default = self.packages.${system}.pulsescan-cpp;
packages.pulsescan-cpp = pkgs.stdenv.mkDerivation {
pname = "pulsescan-cpp";
version = "1.0.0";
src = src;
nativeBuildInputs = with pkgs; [
cmake
ninja
];
buildInputs = with pkgs;
# catch2_3 provides Catch2::Catch2WithMain (v2 only has Catch2::Catch2)
[ boost ];
dontUseCmakeConfigure = true;
buildPhase = ''
export CMAKE_PREFIX_PATH="${pkgs.cli11}:${pkgs.catch2_3}:${pkgs.boost}"
cmake -B build \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=ON \
-DENABLE_STACKTRACE=OFF \
-DENABLE_ASIO_SSL=OFF \
-DCMAKE_INSTALL_PREFIX=$out
cmake --build build -j $NIX_BUILD_CORES
'';
testPhase = ''
ctest --test-dir build --output-on-failure -j $NIX_BUILD_CORES
'';
installPhase = ''
cmake --install build
'';
meta = with pkgs.lib; {
description = "Asynchronous network scanner supporting TCP connect, banner, UDP probing, and ICMP host checks";
homepage = "https://github.com/richyo-codes/port-scanner-cpp";
license = licenses.gpl3Only;
platforms = platforms.linux ++ platforms.freebsd;
maintainers = [ "ryoung" ];
};
};
devShells.default = pkgs.mkShell {
name = "pulsescan-cpp-dev";
nativeBuildInputs = with pkgs; [
cmake
ninja
];
buildInputs = with pkgs; [
boost
cli11
catch2_3
];
packages = [
pkgs.gdb
pkgs.valgrind
pkgs.bear
];
shellHook = ''
echo "=== PulseScan C++ development shell ==="
echo "CMake: ${pkgs.cmake}"
echo "Ninja: ${pkgs.ninja}"
echo "Boost: ${pkgs.boost}"
echo "CLI11: ${pkgs.cli11}"
echo "Catch2: ${pkgs.catch2_3}"
echo "g++: ${pkgs.gcc}"
echo ""
echo "Quick start:"
echo " cmake -B build -DCMAKE_BUILD_TYPE=Release"
echo " cmake --build build -j"
echo " ctest --test-dir build"
echo " cmake --install build --prefix ~/.local"
'';
};
}
);
}