biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / tools / graphics / nifskope / default.nix
blob4022c363ef64bffa9dc1338cb73a36feb8102ecd
1 { lib, stdenv, fetchFromGitHub, qmake, qtbase, qttools, substituteAll, libGLU, wrapQtAppsHook, fetchpatch }:
3 stdenv.mkDerivation {
4   pname = "nifskope";
5   version = "2.0.dev7";
7   src = fetchFromGitHub {
8     owner = "niftools";
9     repo = "nifskope";
10     rev = "47b788d26ae0fa12e60e8e7a4f0fa945a510c7b2"; # `v${version}` doesn't work with submodules
11     sha256 = "1wqpn53rkq28ws3apqghkzyrib4wis91x171ns64g8kp4q6mfczi";
12     fetchSubmodules = true;
13   };
15   patches = [
16     ./external-lib-paths.patch
17     (substituteAll {
18       src = ./qttools-bins.patch;
19       qttools = "${qttools.dev}/bin";
20     })
21     (fetchpatch {
22       name = "qt512-build-fix.patch";
23       url = "https://github.com/niftools/nifskope/commit/30954e7f01f3d779a2a1fd37d363e8a6ad560bd3.patch";
24       sha256 = "0d6xjj2mjjhdd7w1aig5f75jksjni16jyj0lxsz51pys6xqb6fpj";
25     })
26   ] ++ (lib.optional stdenv.hostPlatform.isAarch64 ./no-sse-on-arm.patch);
28   buildInputs = [ qtbase qttools libGLU ];
29   nativeBuildInputs = [ qmake wrapQtAppsHook ];
31   preConfigure = ''
32     shopt -s globstar
33     for i in **/*.cpp; do
34       substituteInPlace $i --replace /usr/share/nifskope $out/share/nifskope
35     done
36   '';
38   # Inspired by install/linux-install/nifskope.spec.in.
39   installPhase = ''
40     runHook preInstall
42     d=$out/share/nifskope
43     mkdir -p $out/bin $out/share/applications $out/share/pixmaps $d/{shaders,lang}
44     cp release/NifSkope $out/bin/
45     cp ./res/nifskope.png $out/share/pixmaps/
46     cp release/{nif.xml,kfm.xml,style.qss} $d/
47     cp res/shaders/*.frag res/shaders/*.prog res/shaders/*.vert $d/shaders/
48     cp ./res/lang/*.ts ./res/lang/*.tm $d/lang/
49     cp ./install/linux-install/nifskope.desktop $out/share/applications
51     substituteInPlace $out/share/applications/nifskope.desktop \
52       --replace 'Exec=nifskope' "Exec=$out/bin/NifSkope" \
53       --replace 'Icon=nifskope' "Icon=$out/share/pixmaps/nifskope.png"
55     find $out/share -type f -exec chmod -x {} \;
57     runHook postInstall
58   '';
60   meta = with lib; {
61     homepage = "https://niftools.sourceforge.net/wiki/NifSkope";
62     description = "Tool for analyzing and editing NetImmerse/Gamebryo '*.nif' files";
63     maintainers = [ ];
64     platforms = platforms.linux;
65     license = licenses.bsd3;
66     mainProgram = "NifSkope";
67   };