10 stdenv.mkDerivation (finalAttrs: rec {
15 url = "mirror://sourceforge/geoserver/GeoServer/${version}/geoserver-${version}-bin.zip";
16 hash = "sha256-WeItL0j50xWYXIFmH4EFhHjxv9Xr6rG0YO8re1jUnNM=";
20 # set GEOSERVER_DATA_DIR to current working directory if not provided
25 nativeBuildInputs = [ unzip makeWrapper ];
29 inputs = finalAttrs.buildInputs or [ ];
30 ldLibraryPathEnvName = if stdenv.hostPlatform.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH";
34 mkdir -p $out/share/geoserver
35 cp -r . $out/share/geoserver
36 rm -fr $out/share/geoserver/bin/*.bat
38 makeWrapper $out/share/geoserver/bin/startup.sh $out/bin/geoserver-startup \
39 --prefix PATH : "${lib.makeBinPath inputs}" \
40 --prefix ${ldLibraryPathEnvName} : "${lib.makeLibraryPath inputs}" \
41 --set JAVA_HOME "${jre}" \
42 --set GEOSERVER_HOME "$out/share/geoserver"
43 makeWrapper $out/share/geoserver/bin/shutdown.sh $out/bin/geoserver-shutdown \
44 --prefix PATH : "${lib.makeBinPath inputs}" \
45 --prefix ${ldLibraryPathEnvName} : "${lib.makeLibraryPath inputs}" \
46 --set JAVA_HOME "${jre}" \
47 --set GEOSERVER_HOME "$out/share/geoserver"
54 geoserver = finalAttrs.finalPackage;
55 extensions = lib.attrsets.filterAttrs (n: v: lib.isDerivation v) (callPackage ./extensions.nix { });
58 withExtensions = selector:
60 selectedExtensions = selector extensions;
62 geoserver.overrideAttrs (finalAttrs: previousAttrs: {
63 pname = previousAttrs.pname + "-with-extensions";
64 buildInputs = lib.lists.unique ((previousAttrs.buildInputs or [ ]) ++ lib.lists.concatMap (drv: drv.buildInputs) selectedExtensions);
65 postInstall = (previousAttrs.postInstall or "") + ''
66 for extension in ${builtins.toString selectedExtensions} ; do
67 cp -r $extension/* $out
68 # Some files are the same for all/several extensions. We allow overwriting them again.
73 tests.geoserver = nixosTests.geoserver;
74 updateScript = ./update.sh;
78 description = "Open source server for sharing geospatial data";
79 homepage = "https://geoserver.org/";
80 sourceProvenance = with sourceTypes; [ binaryBytecode ];
81 license = licenses.gpl2Plus;
82 maintainers = teams.geospatial.members;
83 platforms = platforms.all;