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