1 { lib, stdenv, appimageTools, fetchurl, makeWrapper, undmg }:
4 pname = "joplin-desktop";
7 inherit (stdenv.hostPlatform) system;
8 throwSystem = throw "Unsupported system: ${system}";
11 x86_64-linux = ".AppImage";
12 x86_64-darwin = ".dmg";
13 aarch64-darwin = "-arm64.dmg";
14 }.${system} or throwSystem;
17 url = "https://github.com/laurent22/joplin/releases/download/v${version}/Joplin-${version}${suffix}";
19 x86_64-linux = "sha256-u4wEchyljurmwVZsRnmUBITZUR6SxDxyGczZjXNsJkg=";
20 x86_64-darwin = "sha256-KjNwAnJZGX/DvHDPw15vGlSbJ47s6YT59EalARt1mx4=";
21 aarch64-darwin = "sha256-OYpsHPI+7riMVNAp2JpBlmdFdJUSNqNvBmeYHDw6yzY=";
22 }.${system} or throwSystem;
25 appimageContents = appimageTools.extractType2 {
26 inherit pname version src;
30 description = "An open source note taking and to-do application with synchronisation capabilities";
31 mainProgram = "joplin-desktop";
33 Joplin is a free, open source note taking and to-do application, which can
34 handle a large number of notes organised into notebooks. The notes are
35 searchable, can be copied, tagged and modified either from the
36 applications directly or from your own text editor. The notes are in
39 homepage = "https://joplinapp.org";
40 license = licenses.agpl3Plus;
41 maintainers = with maintainers; [ hugoreeves qjoly ];
42 platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin"];
45 linux = appimageTools.wrapType2 rec {
46 inherit pname version src meta;
52 multiArch = false; # no 32bit needed
53 extraPkgs = appimageTools.defaultFhsEnvArgs.multiPkgs;
54 extraInstallCommands = ''
55 mv $out/bin/{${pname}-${version},${pname}}
56 source "${makeWrapper}/nix-support/setup-hook"
57 wrapProgram $out/bin/${pname} \
58 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland --enable-features=WaylandWindowDecorations}}"
59 install -Dm444 ${appimageContents}/@joplinapp-desktop.desktop -t $out/share/applications
60 install -Dm444 ${appimageContents}/@joplinapp-desktop.png -t $out/share/pixmaps
61 substituteInPlace $out/share/applications/@joplinapp-desktop.desktop \
62 --replace 'Exec=AppRun' 'Exec=${pname}' \
63 --replace 'Icon=joplin' "Icon=@joplinapp-desktop"
67 darwin = stdenv.mkDerivation {
68 inherit pname version src meta;
70 nativeBuildInputs = [ undmg ];
72 sourceRoot = "Joplin.app";
75 mkdir -p $out/Applications/Joplin.app
76 cp -R . $out/Applications/Joplin.app