summary refs log tree commit diff
path: root/pkgs/applications/graphics
diff options
context:
space:
mode:
authorDoron Behar <doron.behar@gmail.com>2021-06-25 10:41:59 +0300
committerDoron Behar <doron.behar@gmail.com>2021-06-27 19:41:23 +0300
commite1d6051d81835079f0e37e1d5fc5f029f32df512 (patch)
tree4b1fe866a29bdbe6a2e3fcfa2a66d5670ac78081 /pkgs/applications/graphics
parentc223fd60072771c8dea3bba2f8f866302aa4c956 (diff)
downloadnixpkgs-e1d6051d81835079f0e37e1d5fc5f029f32df512.tar
nixpkgs-e1d6051d81835079f0e37e1d5fc5f029f32df512.tar.gz
nixpkgs-e1d6051d81835079f0e37e1d5fc5f029f32df512.tar.bz2
nixpkgs-e1d6051d81835079f0e37e1d5fc5f029f32df512.tar.lz
nixpkgs-e1d6051d81835079f0e37e1d5fc5f029f32df512.tar.xz
nixpkgs-e1d6051d81835079f0e37e1d5fc5f029f32df512.tar.zst
nixpkgs-e1d6051d81835079f0e37e1d5fc5f029f32df512.zip
imagej: reformat expression
- Use 1 line per input argument.
- Don't use let ... in if not needed.
- Use ${version} in url string.
- Run hooks in explicit installPhase.
Diffstat (limited to 'pkgs/applications/graphics')
-rw-r--r--pkgs/applications/graphics/imagej/default.nix87
1 files changed, 45 insertions, 42 deletions
diff --git a/pkgs/applications/graphics/imagej/default.nix b/pkgs/applications/graphics/imagej/default.nix
index 65d3c9735df..5050669c524 100644
--- a/pkgs/applications/graphics/imagej/default.nix
+++ b/pkgs/applications/graphics/imagej/default.nix
@@ -1,48 +1,51 @@
-{ lib, stdenv, fetchurl, jre, unzip, makeWrapper }:
+{ lib
+, stdenv
+, fetchurl
+, jre
+, unzip
+, makeWrapper
+}:
 
-# Note:
-# - User config dir is hard coded by upstream to $HOME/.imagej on linux systems
-#   and to $HOME/Library/Preferences on macOS.
-#  (The current trend appears to be to use $HOME/.config/imagej
-#    on linux systems, but we here do not attempt to fix it.)
+stdenv.mkDerivation {
+  pname = "imagej";
+  version = "150";
 
-let
-  imagej150 = stdenv.mkDerivation {
-    pname = "imagej";
-    version = "150";
-
-    src = fetchurl {
-      url = "https://wsr.imagej.net/distros/cross-platform/ij150.zip";
-      sha256 = "97aba6fc5eb908f5160243aebcdc4965726693cb1353d9c0d71b8f5dd832cb7b";
-    };
-    nativeBuildInputs = [ makeWrapper unzip ];
+  src = fetchurl {
+    url = "https://wsr.imagej.net/distros/cross-platform/ij${version}.zip";
+    sha256 = "97aba6fc5eb908f5160243aebcdc4965726693cb1353d9c0d71b8f5dd832cb7b";
+  };
+  nativeBuildInputs = [ makeWrapper unzip ];
+  passthru = {
     inherit jre;
+  };
+
+  # JAR files that are intended to be used by other packages
+  # should go to $out/share/java.
+  # (Some uses ij.jar as a library not as a standalone program.)
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out/share/java $out/bin
+    # Read permisssion suffices for the jar and others.
+    # Simple cp shall clear suid bits, if any.
+    cp ij.jar $out/share/java
+    cp -dR luts macros plugins $out/share
+    makeWrapper ${jre}/bin/java $out/bin/imagej \
+      --add-flags "-jar $out/share/java/ij.jar -ijpath $out/share"
+
+    runHook postInstall
+  '';
 
-    # JAR files that are intended to be used by other packages
-    # should go to $out/share/java.
-    # (Some uses ij.jar as a library not as a standalone program.)
-    installPhase = ''
-      mkdir -p $out/share/java
-      # Read permisssion suffices for the jar and others.
-      # Simple cp shall clear suid bits, if any.
-      cp ij.jar $out/share/java
-      cp -dR luts macros plugins $out/share
-      mkdir $out/bin
-      makeWrapper ${jre}/bin/java $out/bin/imagej \
-        --add-flags "-jar $out/share/java/ij.jar -ijpath $out/share"
+  meta = with lib; {
+    homepage = "https://imagej.nih.gov/ij/";
+    description = "Image processing and analysis in Java";
+    longDescription = ''
+      ImageJ is a public domain Java image processing program
+      inspired by NIH Image for the Macintosh.
+      It runs on any computer with a Java 1.4 or later virtual machine.
     '';
-    meta = with lib; {
-      homepage = "https://imagej.nih.gov/ij/";
-      description = "Image processing and analysis in Java";
-      longDescription = ''
-        ImageJ is a public domain Java image processing program
-        inspired by NIH Image for the Macintosh.
-        It runs on any computer with a Java 1.4 or later virtual machine.
-      '';
-      license = licenses.publicDomain;
-      platforms = with platforms; linux ++ darwin;
-      maintainers = with maintainers; [ yuriaisaka ];
-    };
+    license = licenses.publicDomain;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ yuriaisaka ];
   };
-in
-  imagej150
+}