1 { lib, stdenv, fetchFromGitHub, qmake, qtbase, qttools, substituteAll, libGLU, wrapQtAppsHook, fetchpatch }:
7 src = fetchFromGitHub {
10 rev = "47b788d26ae0fa12e60e8e7a4f0fa945a510c7b2"; # `v${version}` doesn't work with submodules
11 sha256 = "1wqpn53rkq28ws3apqghkzyrib4wis91x171ns64g8kp4q6mfczi";
12 fetchSubmodules = true;
16 ./external-lib-paths.patch
18 src = ./qttools-bins.patch;
19 qttools = "${qttools.dev}/bin";
22 name = "qt512-build-fix.patch";
23 url = "https://github.com/niftools/nifskope/commit/30954e7f01f3d779a2a1fd37d363e8a6ad560bd3.patch";
24 sha256 = "0d6xjj2mjjhdd7w1aig5f75jksjni16jyj0lxsz51pys6xqb6fpj";
26 ] ++ (lib.optional stdenv.hostPlatform.isAarch64 ./no-sse-on-arm.patch);
28 buildInputs = [ qtbase qttools libGLU ];
29 nativeBuildInputs = [ qmake wrapQtAppsHook ];
34 substituteInPlace $i --replace /usr/share/nifskope $out/share/nifskope
38 # Inspired by install/linux-install/nifskope.spec.in.
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 {} \;
61 homepage = "https://niftools.sourceforge.net/wiki/NifSkope";
62 description = "Tool for analyzing and editing NetImmerse/Gamebryo '*.nif' files";
64 platforms = platforms.linux;
65 license = licenses.bsd3;
66 mainProgram = "NifSkope";