nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at netboot-syslinux-multiplatform 135 lines 4.5 kB view raw
1{ lib 2, stdenv 3, fetchurl 4, makeWrapper 5, makeDesktopItem 6# sweethome3d 6.5.2 does not yet fully build&run with jdk 9 and later? 7, jdk8 8, jre8 9, ant 10, gtk3 11, gsettings-desktop-schemas 12, p7zip 13, autoPatchelfHook 14, libXxf86vm 15, unzip 16}: 17 18let 19 20 # TODO: Should we move this to `lib`? Seems like its would be useful in many cases. 21 extensionOf = filePath: 22 lib.concatStringsSep "." (lib.tail (lib.splitString "." (builtins.baseNameOf filePath))); 23 24 installIcons = iconName: icons: lib.concatStringsSep "\n" (lib.mapAttrsToList (size: iconFile: '' 25 mkdir -p "$out/share/icons/hicolor/${size}/apps" 26 ln -s -T "${iconFile}" "$out/share/icons/hicolor/${size}/apps/${iconName}.${extensionOf iconFile}" 27 '') icons); 28 29 mkSweetHome3D = 30 { pname, module, version, src, license, description, desktopName, icons }: 31 32 stdenv.mkDerivation rec { 33 inherit pname version src description; 34 exec = lib.toLower module; 35 sweethome3dItem = makeDesktopItem { 36 inherit exec desktopName; 37 name = pname; 38 icon = pname; 39 comment = description; 40 genericName = "Computer Aided (Interior) Design"; 41 categories = [ "Graphics" "2DGraphics" "3DGraphics" ]; 42 }; 43 44 postPatch = '' 45 addAutoPatchelfSearchPath ${jre8}/lib/openjdk/jre/lib/ 46 autoPatchelf lib 47 48 # Nix cannot see the runtime references to the paths we just patched in 49 # once they've been compressed into the .jar. Scan for and remember them 50 # as plain text so they don't get overlooked. 51 find . -name '*.so' | xargs strings | { grep '/nix/store' || :; } >> ./.jar-paths 52 ''; 53 54 nativeBuildInputs = [ makeWrapper unzip autoPatchelfHook ]; 55 buildInputs = [ ant jdk8 p7zip gtk3 gsettings-desktop-schemas libXxf86vm ]; 56 57 buildPhase = '' 58 runHook preBuild 59 60 ant furniture textures help 61 mkdir -p $out/share/{java,applications} 62 mv "build/"*.jar $out/share/java/. 63 ant 64 65 runHook postBuild 66 ''; 67 68 installPhase = '' 69 runHook preInstall 70 71 mkdir -p $out/bin 72 cp install/${module}-${version}.jar $out/share/java/. 73 74 ${installIcons pname icons} 75 76 cp "${sweethome3dItem}/share/applications/"* $out/share/applications 77 78 # MESA_GL_VERSION_OVERRIDE is needed since the update from MESA 19.3.3 to 20.0.2: 79 # without it a "Profiles [GL4bc, GL3bc, GL2, GLES1] not available on device null" 80 # exception is thrown on startup. 81 # https://discourse.nixos.org/t/glx-not-recognised-after-mesa-update/6753 82 makeWrapper ${jre8}/bin/java $out/bin/$exec \ 83 --set MESA_GL_VERSION_OVERRIDE 2.1 \ 84 --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gtk3.out}/share:${gsettings-desktop-schemas}/share:$out/share:$GSETTINGS_SCHEMAS_PATH" \ 85 --add-flags "-Dsun.java2d.opengl=true -jar $out/share/java/${module}-${version}.jar -cp $out/share/java/Furniture.jar:$out/share/java/Textures.jar:$out/share/java/Help.jar -d${toString stdenv.hostPlatform.parsed.cpu.bits}" 86 87 88 # remember the store paths found inside the .jar libraries. note that 89 # which file they are in does not matter in particular, just that some 90 # file somewhere lists them in plain-text 91 mkdir -p $out/nix-support 92 cp .jar-paths $out/nix-support/depends 93 94 runHook postInstall 95 ''; 96 97 dontStrip = true; 98 99 meta = { 100 homepage = "http://www.sweethome3d.com/index.jsp"; 101 inherit description; 102 inherit license; 103 maintainers = [ lib.maintainers.edwtjo ]; 104 platforms = lib.platforms.linux; 105 }; 106 }; 107 108 d2u = lib.replaceStrings ["."] ["_"]; 109 110in { 111 112 application = mkSweetHome3D rec { 113 pname = lib.toLower module + "-application"; 114 version = "7.0.2"; 115 module = "SweetHome3D"; 116 description = "Design and visualize your future home"; 117 license = lib.licenses.gpl2Plus; 118 src = fetchurl { 119 url = "mirror://sourceforge/sweethome3d/${module}-${version}-src.zip"; 120 sha256 = "sha256-9Jv/U7afG6+LwPB6IhqLePjQA67bPKelP+UcuvizBqo="; 121 }; 122 desktopName = "Sweet Home 3D"; 123 icons = { 124 "32x32" = fetchurl { 125 url = "http://sweethome3d.cvs.sourceforge.net/viewvc/sweethome3d/SweetHome3D/deploy/SweetHome3DIcon32x32.png"; 126 sha256 = "1r2fhfg27mx00nfv0qj66rhf719s2g1vhdis7bdc9mqk9x0mb0ir"; 127 }; 128 "48x48" = fetchurl { 129 url = "http://sweethome3d.cvs.sourceforge.net/viewvc/sweethome3d/SweetHome3D/deploy/SweetHome3DIcon48x48.png"; 130 sha256 = "1ap6d75dyqqvx21wddvn8vw2apq3v803vmbxdriwd0dw9rq3zn4g"; 131 }; 132 }; 133 }; 134 135}