57 lines
1.7 KiB
Nix
57 lines
1.7 KiB
Nix
{
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/release-24.05";
|
|
outputs = { self, nixpkgs }:
|
|
let
|
|
defaultArchs = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
|
|
forAllSystems = nixpkgs.lib.attrsets.genAttrs defaultArchs;
|
|
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; overlays = [ self.overlay ]; });
|
|
in
|
|
{
|
|
overlay = final: prev: {
|
|
spider2 = final.stdenv.mkDerivation {
|
|
name = "Spider2";
|
|
src = ./.;
|
|
nativeBuildInputs = with final; [
|
|
cmake
|
|
pkg-config
|
|
];
|
|
buildInputs = with final; [ curl html-tidy ];
|
|
dontUnpack = true;
|
|
configurePhase = ''
|
|
runHook preConfigure
|
|
cmake -S $src -B . -DCMAKE_BUILD_TYPE=DEBUG
|
|
runHook postConfigure
|
|
'';
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
cmake --build .
|
|
runHook postBuild
|
|
'';
|
|
installPhase = ''
|
|
runHook preInstall
|
|
cmake --install . --prefix $out
|
|
runHook postInstall
|
|
'';
|
|
};
|
|
spider2WithDebug = final.spider2.overrideAttrs (_: _: {
|
|
hardeningDisable = [ "all" ];
|
|
dontStrip = true;
|
|
});
|
|
};
|
|
packages = forAllSystems (system: {
|
|
default = nixpkgsFor."${system}".spider2;
|
|
inherit (nixpkgsFor."${system}") spider2WithDebug;
|
|
});
|
|
devShells = forAllSystems (system:
|
|
let
|
|
pkgs = nixpkgsFor."${system}";
|
|
debugPkgs = with pkgs; [ clang-tools valgrind gdb ];
|
|
in
|
|
{
|
|
default = pkgs.spider2WithDebug.overrideAttrs (finalAttrs: previousAttrs: {
|
|
nativeBuildInputs = previousAttrs.nativeBuildInputs ++ debugPkgs;
|
|
});
|
|
});
|
|
};
|
|
}
|