sweethome3d: Improvements

- Replace non freedesktop `CAD` desktop category
by categories taken from debian's desktop item.

This make the desktop items appear under the
`Graphic` category in DE menus instead of `Others`.

- Moved to new package icons as specified by
upstream release notes.

- Moved to icon name instead of full path to
a single icon as specified by freedesktop
specification.

- Human readable desktop item names.

+41 -13
+33 -9
pkgs/applications/misc/sweethome3d/default.nix
··· 1 - { stdenv, fetchurl, fetchcvs, makeWrapper, makeDesktopItem, jdk, jre, ant 2 , gtk3, gsettings_desktop_schemas, p7zip }: 3 4 let 5 6 mkSweetHome3D = 7 - { name, module, version, src, license, description, icon }: 8 9 stdenv.mkDerivation rec { 10 - inherit name version src description icon; 11 exec = stdenv.lib.toLower module; 12 sweethome3dItem = makeDesktopItem { 13 - inherit name exec icon; 14 comment = description; 15 - desktopName = name; 16 genericName = "Computer Aided (Interior) Design"; 17 - categories = "Application;CAD;"; 18 }; 19 20 buildInputs = [ ant jdk jre makeWrapper p7zip gtk3 gsettings_desktop_schemas ]; ··· 29 installPhase = '' 30 mkdir -p $out/bin 31 cp install/${module}-${version}.jar $out/share/java/. 32 cp "${sweethome3dItem}/share/applications/"* $out/share/applications 33 makeWrapper ${jre}/bin/java $out/bin/$exec \ 34 --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gtk3}/share:${gsettings_desktop_schemas}/share:$out/share:$GSETTINGS_SCHEMAS_PATH" \ 35 --add-flags "-jar $out/share/java/${module}-${version}.jar -cp $out/share/java/Furniture.jar:$out/share/java/Textures.jar:$out/share/java/Help.jar ${if stdenv.system == "x86_64-linux" then "-d64" else "-d32"}" ··· 62 module = module; 63 tag = "V_" + d2u version; 64 }; 65 - icon = fetchurl { 66 - url = "http://sweethome3d.cvs.sourceforge.net/viewvc/sweethome3d/SweetHome3D/src/com/eteks/sweethome3d/viewcontroller/resources/help/images/sweethome3d.png"; 67 - sha256 = "0lnv2sz2d3m8jx25hz92gzardf0iblykhy5q0q2cyb7mw2qb2p92"; 68 }; 69 }; 70
··· 1 + { lib, stdenv, fetchurl, fetchcvs, makeWrapper, makeDesktopItem, jdk, jre, ant 2 , gtk3, gsettings_desktop_schemas, p7zip }: 3 4 let 5 6 + getDesktopFileName = drvName: (builtins.parseDrvName drvName).name; 7 + 8 + # TODO: Should we move this to `lib`? Seems like its would be useful in many cases. 9 + extensionOf = filePath: 10 + lib.concatStringsSep "." (lib.tail (lib.splitString "." 11 + (builtins.baseNameOf filePath))); 12 + 13 + installIcons = iconName: icons: lib.concatStringsSep "\n" (lib.mapAttrsToList (size: iconFile: '' 14 + mkdir -p "$out/share/icons/hicolor/${size}/apps" 15 + ln -s -T "${iconFile}" "$out/share/icons/hicolor/${size}/apps/${iconName}.${extensionOf iconFile}" 16 + '') icons); 17 + 18 mkSweetHome3D = 19 + { name, module, version, src, license, description, desktopName, icons }: 20 21 stdenv.mkDerivation rec { 22 + inherit name version src description; 23 exec = stdenv.lib.toLower module; 24 sweethome3dItem = makeDesktopItem { 25 + inherit exec desktopName; 26 + name = getDesktopFileName name; 27 + icon = getDesktopFileName name; 28 comment = description; 29 genericName = "Computer Aided (Interior) Design"; 30 + categories = "Application;Graphics;2DGraphics;3DGraphics;"; 31 }; 32 33 buildInputs = [ ant jdk jre makeWrapper p7zip gtk3 gsettings_desktop_schemas ]; ··· 42 installPhase = '' 43 mkdir -p $out/bin 44 cp install/${module}-${version}.jar $out/share/java/. 45 + 46 + ${installIcons (getDesktopFileName name) icons} 47 + 48 cp "${sweethome3dItem}/share/applications/"* $out/share/applications 49 + 50 makeWrapper ${jre}/bin/java $out/bin/$exec \ 51 --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gtk3}/share:${gsettings_desktop_schemas}/share:$out/share:$GSETTINGS_SCHEMAS_PATH" \ 52 --add-flags "-jar $out/share/java/${module}-${version}.jar -cp $out/share/java/Furniture.jar:$out/share/java/Textures.jar:$out/share/java/Help.jar ${if stdenv.system == "x86_64-linux" then "-d64" else "-d32"}" ··· 79 module = module; 80 tag = "V_" + d2u version; 81 }; 82 + desktopName = "Sweet Home 3D"; 83 + icons = { 84 + "32x32" = fetchurl { 85 + url = "http://sweethome3d.cvs.sourceforge.net/viewvc/sweethome3d/SweetHome3D/deploy/SweetHome3DIcon32x32.png"; 86 + sha256 = "1r2fhfg27mx00nfv0qj66rhf719s2g1vhdis7bdc9mqk9x0mb0ir"; 87 + }; 88 + "48x48" = fetchurl { 89 + url = "http://sweethome3d.cvs.sourceforge.net/viewvc/sweethome3d/SweetHome3D/deploy/SweetHome3DIcon48x48.png"; 90 + sha256 = "1ap6d75dyqqvx21wddvn8vw2apq3v803vmbxdriwd0dw9rq3zn4g"; 91 + }; 92 }; 93 }; 94
+8 -4
pkgs/applications/misc/sweethome3d/editors.nix
··· 9 + "-editor"; 10 sweetName = m: v: sweetExec m + "-" + v; 11 12 mkEditorProject = 13 - { name, module, version, src, license, description }: 14 15 stdenv.mkDerivation rec { 16 application = sweethome3dApp; 17 inherit name module version src description; 18 exec = sweetExec module; 19 editorItem = makeDesktopItem { 20 - inherit name exec; 21 comment = description; 22 - desktopName = name; 23 genericName = "Computer Aided (Interior) Design"; 24 - categories = "Application;CAD;"; 25 }; 26 27 buildInputs = [ ant jre jdk makeWrapper gtk3 gsettings_desktop_schemas ]; ··· 72 module = module; 73 tag = "V_" + d2u version; 74 }; 75 }; 76 77 furniture-editor = mkEditorProject rec { ··· 86 module = module; 87 tag = "V_" + d2u version; 88 }; 89 }; 90 91 }
··· 9 + "-editor"; 10 sweetName = m: v: sweetExec m + "-" + v; 11 12 + getDesktopFileName = drvName: (builtins.parseDrvName drvName).name; 13 + 14 mkEditorProject = 15 + { name, module, version, src, license, description, desktopName }: 16 17 stdenv.mkDerivation rec { 18 application = sweethome3dApp; 19 inherit name module version src description; 20 exec = sweetExec module; 21 editorItem = makeDesktopItem { 22 + inherit exec desktopName; 23 + name = getDesktopFileName name; 24 comment = description; 25 genericName = "Computer Aided (Interior) Design"; 26 + categories = "Application;Graphics;2DGraphics;3DGraphics;"; 27 }; 28 29 buildInputs = [ ant jre jdk makeWrapper gtk3 gsettings_desktop_schemas ]; ··· 74 module = module; 75 tag = "V_" + d2u version; 76 }; 77 + desktopName = "Sweet Home 3D - Textures Library Editor"; 78 }; 79 80 furniture-editor = mkEditorProject rec { ··· 89 module = module; 90 tag = "V_" + d2u version; 91 }; 92 + desktopName = "Sweet Home 3D - Furniture Library Editor"; 93 }; 94 95 }