|
| 1 | +{ |
| 2 | + fetchurl, |
| 3 | + appimageTools, |
| 4 | + makeWrapper, |
| 5 | + imagemagick, |
| 6 | + lib, |
| 7 | +}: |
| 8 | +let |
| 9 | + pname = "capacities"; |
| 10 | + version = "1.48.7"; |
| 11 | + name = "${pname}-${version}"; |
| 12 | + |
| 13 | + src = fetchurl { |
| 14 | + url = "https://web.archive.org/web/20250519011655/https://capacities-desktop-app.fra1.cdn.digitaloceanspaces.com/capacities-${version}.AppImage"; |
| 15 | + hash = "sha256-fa1Wk3w+f467n0JtRz+Zjw9QKDKKnhS23biEtNqO17Y="; |
| 16 | + }; |
| 17 | + |
| 18 | + appimageContents = appimageTools.extractType2 { |
| 19 | + inherit |
| 20 | + pname |
| 21 | + src |
| 22 | + version |
| 23 | + ; |
| 24 | + }; |
| 25 | +in |
| 26 | +appimageTools.wrapType2 { |
| 27 | + inherit |
| 28 | + pname |
| 29 | + src |
| 30 | + version |
| 31 | + ; |
| 32 | + |
| 33 | + extraInstallCommands = '' |
| 34 | + source "${makeWrapper}/nix-support/setup-hook" |
| 35 | + wrapProgram $out/bin/capacities \ |
| 36 | + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" |
| 37 | +
|
| 38 | + # Check for required desktop file |
| 39 | + if [ ! -f ${appimageContents}/capacities.desktop ]; then |
| 40 | + echo "Error: Missing .desktop file in ${appimageContents}" |
| 41 | + exit 1 |
| 42 | + else |
| 43 | + # Install and modify the desktop file |
| 44 | + install -m 444 -D ${appimageContents}/capacities.desktop $out/share/applications/capacities.desktop |
| 45 | + fi |
| 46 | +
|
| 47 | + # Check for required icon file |
| 48 | + if [ ! -f ${appimageContents}/capacities.png ]; then |
| 49 | + echo "Error: Missing icon file in ${appimageContents}" |
| 50 | + exit 1 |
| 51 | + else |
| 52 | + # Resize and install the icon |
| 53 | + ${lib.getExe imagemagick} ${appimageContents}/capacities.png -resize 512x512 capacities_512.png |
| 54 | + install -m 444 -D capacities_512.png $out/share/icons/hicolor/512x512/apps/capacities.png |
| 55 | + fi |
| 56 | + ''; |
| 57 | + |
| 58 | + meta = { |
| 59 | + description = "Calm place to make sense of the world and create amazing things"; |
| 60 | + homepage = "https://capacities.io/"; |
| 61 | + platforms = [ "x86_64-linux" ]; |
| 62 | + sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; |
| 63 | + license = lib.licenses.unfree; |
| 64 | + mainProgram = "capacities"; |
| 65 | + }; |
| 66 | +} |
0 commit comments