nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 48 lines 1.4 kB view raw
1{ 2 lib, 3 stdenv, 4 callPackage, 5 symlinkJoin, 6 makeBinaryWrapper, 7 desktopToDarwinBundle, 8 ghidra, 9}: 10 11let 12 ghidra-extensions = callPackage ./extensions.nix { inherit ghidra; }; 13 allExtensions = lib.filterAttrs (n: pkg: lib.isDerivation pkg) ghidra-extensions; 14 15 /* 16 Make Ghidra with additional extensions 17 Example: 18 pkgs.ghidra.withExtensions (p: with p; [ 19 ghostrings 20 ]); 21 => /nix/store/3yn0rbnz5mbrxf0x70jbjq73wgkszr5c-ghidra-with-extensions-10.2.2 22 */ 23 withExtensions = 24 f: 25 (symlinkJoin { 26 name = "${ghidra.pname}-with-extensions-${lib.getVersion ghidra}"; 27 paths = (f allExtensions); 28 nativeBuildInputs = [ 29 makeBinaryWrapper 30 ] 31 ++ lib.optional stdenv.hostPlatform.isDarwin desktopToDarwinBundle; 32 postBuild = '' 33 # Prevent attempted creation of plugin lock files in the Nix store. 34 touch $out/lib/ghidra/Ghidra/.dbDirLock 35 36 makeWrapper '${ghidra}/bin/ghidra' "$out/bin/ghidra" \ 37 --set NIX_GHIDRAHOME "$out/lib/ghidra/Ghidra" 38 makeWrapper '${ghidra}/bin/ghidra-analyzeHeadless' "$out/bin/ghidra-analyzeHeadless" \ 39 --set NIX_GHIDRAHOME "$out/lib/ghidra/Ghidra" 40 ln -s ${ghidra}/share $out/share 41 '' 42 + lib.optionalString stdenv.hostPlatform.isDarwin '' 43 convertDesktopFiles $prefix 44 ''; 45 inherit (ghidra) meta; 46 }); 47in 48withExtensions