nixpkgs/pkgs/applications/misc/joplin-desktop/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

82 lines
2.7 KiB
Nix
Raw Normal View History

{ lib, stdenv, appimageTools, fetchurl, makeWrapper, undmg }:
2019-01-28 22:00:03 +00:00
let
2019-04-24 01:48:19 +00:00
pname = "joplin-desktop";
2024-03-03 20:31:01 +00:00
version = "2.14.17";
2020-09-23 17:54:10 +00:00
inherit (stdenv.hostPlatform) system;
throwSystem = throw "Unsupported system: ${system}";
suffix = {
2023-09-13 10:56:45 +00:00
x86_64-linux = ".AppImage";
x86_64-darwin = ".dmg";
aarch64-darwin = "-arm64.dmg";
2020-09-23 17:54:10 +00:00
}.${system} or throwSystem;
2019-01-28 22:00:03 +00:00
src = fetchurl {
2023-09-13 10:56:45 +00:00
url = "https://github.com/laurent22/joplin/releases/download/v${version}/Joplin-${version}${suffix}";
2020-09-23 17:54:10 +00:00
sha256 = {
2024-03-03 20:31:01 +00:00
x86_64-linux = "sha256-u4wEchyljurmwVZsRnmUBITZUR6SxDxyGczZjXNsJkg=";
x86_64-darwin = "sha256-KjNwAnJZGX/DvHDPw15vGlSbJ47s6YT59EalARt1mx4=";
aarch64-darwin = "sha256-OYpsHPI+7riMVNAp2JpBlmdFdJUSNqNvBmeYHDw6yzY=";
2020-09-23 17:54:10 +00:00
}.${system} or throwSystem;
2019-01-28 22:00:03 +00:00
};
appimageContents = appimageTools.extractType2 {
2023-10-02 21:16:32 +00:00
inherit pname version src;
};
2020-09-23 17:54:10 +00:00
meta = with lib; {
2019-01-28 22:00:03 +00:00
description = "An open source note taking and to-do application with synchronisation capabilities";
mainProgram = "joplin-desktop";
2019-01-28 22:00:03 +00:00
longDescription = ''
Joplin is a free, open source note taking and to-do application, which can
handle a large number of notes organised into notebooks. The notes are
searchable, can be copied, tagged and modified either from the
applications directly or from your own text editor. The notes are in
Markdown format.
'';
homepage = "https://joplinapp.org";
license = licenses.agpl3Plus;
2023-06-06 12:24:01 +00:00
maintainers = with maintainers; [ hugoreeves qjoly ];
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin"];
2020-09-23 17:54:10 +00:00
};
linux = appimageTools.wrapType2 rec {
2023-10-02 21:16:32 +00:00
inherit pname version src meta;
2020-09-23 17:54:10 +00:00
profile = ''
export LC_ALL=C.UTF-8
'';
multiArch = false; # no 32bit needed
2020-09-23 17:54:10 +00:00
extraPkgs = appimageTools.defaultFhsEnvArgs.multiPkgs;
extraInstallCommands = ''
source "${makeWrapper}/nix-support/setup-hook"
wrapProgram $out/bin/${pname} \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland --enable-features=WaylandWindowDecorations}}"
2020-11-27 15:01:47 +00:00
install -Dm444 ${appimageContents}/@joplinapp-desktop.desktop -t $out/share/applications
install -Dm444 ${appimageContents}/@joplinapp-desktop.png -t $out/share/pixmaps
substituteInPlace $out/share/applications/@joplinapp-desktop.desktop \
2021-07-04 12:28:25 +00:00
--replace 'Exec=AppRun' 'Exec=${pname}' \
--replace 'Icon=joplin' "Icon=@joplinapp-desktop"
2020-09-23 17:54:10 +00:00
'';
};
darwin = stdenv.mkDerivation {
2023-10-02 21:16:32 +00:00
inherit pname version src meta;
2020-09-23 17:54:10 +00:00
nativeBuildInputs = [ undmg ];
sourceRoot = "Joplin.app";
installPhase = ''
mkdir -p $out/Applications/Joplin.app
cp -R . $out/Applications/Joplin.app
'';
2019-01-28 22:00:03 +00:00
};
2020-09-23 17:54:10 +00:00
in
if stdenv.isDarwin
then darwin
else linux