base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / we / weasis / package.nix
blob999d815186228c5ce332f3bb779ea204081869a6
1 { lib
2 , stdenv
3 , fetchzip
4 , jre
5 , copyDesktopItems
6 , makeDesktopItem
7 }:
9 let
10   throwSystem = throw "Unsupported system: ${stdenv.system}";
11   platform = {
12     "x86_64-linux" = "linux-x86-64";
13   }.${stdenv.system} or throwSystem;
15 in stdenv.mkDerivation rec {
16   pname = "weasis";
17   version = "4.4.0";
19   # Their build instructions indicate to use the packaging script
20   src = fetchzip {
21     url = "https://github.com/nroduit/Weasis/releases/download/v${version}/weasis-native.zip";
22     hash = "sha256-+Bi9rTuM9osKzbKVA4exqsFm8p9+1OHgJqRSNnCC6QQ=";
23     stripRoot = false;
24   };
26   nativeBuildInputs = [
27     copyDesktopItems
28   ];
30   desktopItems = [
31     (makeDesktopItem {
32       name = "DICOMizer";
33       exec = "Dicomizer";
34       icon = "Dicomizer";
35       desktopName = "DICOMizer";
36       comment = "Convert standard images into DICOM";
37     })
38     (makeDesktopItem {
39       name = "Weasis";
40       exec = "Weasis";
41       icon = "Weasis";
42       desktopName = "Weasis";
43       comment = meta.description;
44     })
45   ];
47   postPatch = ''
48     patchShebangs ./build/script/package-weasis.sh
49   '';
51   buildPhase = ''
52     runHook preBuild
54     ./build/script/package-weasis.sh --no-installer --jdk ${jre}
56     runHook postBuild
57   '';
59   installPhase = ''
60     runHook preInstall
62     mkdir -p $out/share/{applications,pixmaps}
64     mv weasis-${platform}-jdk${lib.versions.major jre.version}-${version}/Weasis/* $out/
65     mv $out/lib/*.png $out/share/pixmaps/
67     runHook postInstall
68   '';
70   meta = {
71     description = "Multipurpose standalone and web-based DICOM viewer with a highly modular architecture";
72     homepage = "https://weasis.org";
73     # Using changelog from releases as it is more accurate
74     changelog = "https://github.com/nroduit/Weasis/releases/tag/v${version}";
75     license = with lib.licenses; [ asl20 epl20 ];
76     maintainers = [ ];
77     platforms = [ "x86_64-linux" ];
78     mainProgram = "Weasis";
79   };