Compare commits

...

6 Commits

Author SHA1 Message Date
Ninja3047 c711ddce7b bump ghidra in flake 2023-09-23 18:26:26 -04:00
Ninja3047 5b76dd9ed5 update flake.lock 2023-09-23 18:26:26 -04:00
Ninja3047 0f40864cec debug and asan build 2023-09-23 18:26:26 -04:00
Ninja3047 7ea4feb70e fix deprecation 2023-09-23 18:26:26 -04:00
Ninja3047 daa95e1d6b format nix 2023-09-23 18:26:26 -04:00
Ninja3047 da1b36dfb7 experimental nix flake 2023-09-23 18:17:51 -04:00
4 changed files with 178 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
use flake
+2
View File
@@ -4,3 +4,5 @@ build
# FetchContent Ghidra source directories
/src/ghidra*
cmake_fc_*
.direnv/
Generated
+95
View File
@@ -0,0 +1,95 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1682291304,
"narHash": "sha256-VkufTQNEclnZ0HnSXxmXC2Qvtj6/3/8SyZfRyL4AllI=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "b2d51541a37678ad4e870f75326b6e68daf3b3c7",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1680945546,
"narHash": "sha256-8FuaH5t/aVi/pR1XxnF0qi4WwMYC+YxlfdsA0V+TEuQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d9f759f2ea8d265d974a6e1259bd510ac5844c5d",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"treefmt-nix": "treefmt-nix"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1681486253,
"narHash": "sha256-EjiQZvXQH9tUPCyLC6lQpfGnoq4+kI9v59bDJWPicYo=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "b25d1a3c2c7554d0462ab1dfddf2f13128638b90",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
}
},
"root": "root",
"version": 7
}
+80
View File
@@ -0,0 +1,80 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
treefmt-nix.url = "github:numtide/treefmt-nix";
};
outputs = {
self,
nixpkgs,
flake-utils,
treefmt-nix,
}:
{
overlays.default = final: prev: {
ghidra = with final;
applyPatches {
src = fetchFromGitHub {
owner = "NationalSecurityAgency";
repo = "ghidra";
rev = "refs/tags/Ghidra_10.3.3_build";
sha256 = "sha256-KDSiZ/JwAqX6Obg9UD8ZQut01l/eMXbioJy//GluXn0=";
};
patches = [
./src/patches/stable/0001-Fix-UBSAN-errors-in-decompiler.patch
./src/patches/stable/0002-Use-stroull-instead-of-stroul-to-parse-address-offse.patch
];
};
sleigh = with final;
stdenv.mkDerivation {
name = "sleigh";
src = ./.;
nativeBuildInputs = [
cmake
ninja
git
];
buildInputs = [
ghidra
];
cmakeFlags = [
"-DFETCHCONTENT_SOURCE_DIR_GHIDRASOURCE=${ghidra}"
];
};
sleigh-debug = with final;
final.sleigh.overrideAttrs (o: {
dontStrip = true;
enableDebugging = true;
separateDebugInfo = true;
});
sleigh-asan = with final;
final.sleigh-debug.overrideAttrs (o: {
cmakeFlags = o.cmakeFlags ++ ["-DCMAKE_C_FLAGS=-fsanitize=address" "-DCMAKE_CXX_FLAGS=-fsanitize=address"];
});
};
}
// flake-utils.lib.eachDefaultSystem (
system: let
pkgs = import nixpkgs {
inherit system;
overlays = [self.overlays.default];
};
in {
packages.default = pkgs.sleigh;
devShells.default = pkgs.mkShell {
packages = with pkgs; [
sleigh-asan
clang-tools
];
};
formatter = treefmt-nix.lib.mkWrapper pkgs {
projectRootFile = ".git/config";
programs = {
alejandra.enable = true;
clang-format.enable = true;
};
};
}
);
}