nixpkgs/pkgs/by-name/au/autopsy/package.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

50 lines
1.8 KiB
Nix

{ stdenv, lib, makeWrapper, fetchzip, testdisk, imagemagick, jdk, findutils, sleuthkit, ... }:
let
jdkWithJfx = jdk.override (lib.optionalAttrs stdenv.hostPlatform.isLinux {
enableJavaFX = true;
});
in
stdenv.mkDerivation rec {
pname = "autopsy";
version = "4.21.0";
src = fetchzip {
url = "https://github.com/sleuthkit/autopsy/releases/download/autopsy-${version}/autopsy-${version}.zip";
hash = "sha256-32iOQA3+ykltCYW/MpqCVxyhh3mm6eYzY+t0smAsWRw=";
};
nativeBuildInputs = [ makeWrapper findutils ];
buildInputs = [ testdisk imagemagick jdkWithJfx ];
installPhase = ''
runHook preInstall
cp -r . $out
# Run the provided setup script to make files executable and copy sleuthkit
TSK_JAVA_LIB_PATH="${sleuthkit}/share/java" bash $out/unix_setup.sh -j '${jdkWithJfx}' -n autopsy
substituteInPlace $out/bin/autopsy \
--replace-warn 'APPNAME=`basename "$PRG"`' 'APPNAME=autopsy'
wrapProgram $out/bin/autopsy \
--run 'export SOLR_LOGS_DIR="$HOME/.autopsy/dev/var/log"' \
--run 'export SOLR_PID_DIR="$HOME/.autopsy/dev"' \
--prefix PATH : "${lib.makeBinPath [ testdisk imagemagick jdkWithJfx ]}"
runHook postInstall
'';
meta = {
description = "Graphical interface to The Sleuth Kit and other open source digital forensics tools";
homepage = "https://www.sleuthkit.org/autopsy";
changelog = "https://github.com/sleuthkit/autopsy/releases/tag/autopsy-${version}";
# Autopsy brings a lot of vendored dependencies
license = with lib.licenses; [ asl20 ipl10 lgpl3Only lgpl21Only zlib wtfpl bsd3 cc-by-30 mit gpl2Only ];
maintainers = with lib.maintainers; [ zebreus ];
mainProgram = "autopsy";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
# Autopsy theoretically also supports darwin
platforms = lib.platforms.x86_64;
};
}