base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / ne / networkminer / package.nix
blobf83c6b3e2415e6e266c324d4c9c3888385b299df
1 { lib
2 , buildDotnetModule
3 , fetchurl
4 , unzip
5 , dos2unix
6 , msbuild
7 , mono
8 }:
9 buildDotnetModule rec {
10   pname = "networkminer";
11   version = "2.8";
13   src = fetchurl {
14     # Upstream does not provide versioned releases, a mirror has been uploaded
15     # to archive.org
16     url = "https://archive.org/download/networkminer-${lib.replaceStrings ["."] ["-"] version}/NetworkMiner_${lib.replaceStrings ["."] ["-"] version}_source.zip";
17     sha256 = "1n2312acq5rq0jizlcfk0crslx3wgcsd836p47nk3pnapzw0cqvv";
18   };
20   nativeBuildInputs = [ unzip dos2unix msbuild ];
22   patches = [
23     # Store application data in XDG_DATA_DIRS instead of trying to write to nix store
24     ./xdg-dirs.patch
25   ];
27   postPatch = ''
28     # Not all files have UTF-8 BOM applied consistently
29     find . -type f -exec dos2unix -m {} \+
31     # Embedded base64-encoded app icon in resx fails to parse. Delete it
32     sed -zi 's|<data name="$this.Icon".*</data>||g' NetworkMiner/NamedPipeForm.resx
33     sed -zi 's|<data name="$this.Icon".*</data>||g' NetworkMiner/UpdateCheck.resx
34   '';
36   nugetDeps = ./deps.nix;
38   buildPhase = ''
39     runHook preBuild
41     msbuild /p:Configuration=Release NetworkMiner.sln
43     runHook postBuild
44   '';
46   installPhase = ''
47     runHook preInstall
49     mkdir -p $out/bin $out/share
50     cp -r NetworkMiner/bin/Release $out/share/NetworkMiner
51     makeWrapper ${mono}/bin/mono $out/bin/NetworkMiner \
52       --add-flags "$out/share/NetworkMiner/NetworkMiner.exe" \
53       --add-flags "--noupdatecheck"
55     install -D NetworkMiner/NetworkMiner.desktop $out/share/applications/NetworkMiner.desktop
56     substituteInPlace $out/share/applications/NetworkMiner.desktop \
57       --replace "Exec=mono NetworkMiner.exe %f" "Exec=NetworkMiner" \
58       --replace "Icon=./networkminericon-96x96.png" "Icon=NetworkMiner"
59     install -D NetworkMiner/networkminericon-96x96.png $out/share/pixmaps/NetworkMiner.png
61     runHook postInstall
62   '';
64   meta = with lib; {
65     description = "Open Source Network Forensic Analysis Tool (NFAT)";
66     homepage = "https://www.netresec.com/?page=NetworkMiner";
67     license = licenses.gpl2Only;
68     maintainers = with maintainers; [ emilytrau ];
69     platforms = platforms.linux;
70     mainProgram = "NetworkMiner";
71   };