nixpkgs/pkgs/applications/misc/notesnook/default.nix

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

78 lines
2.4 KiB
Nix
Raw Normal View History

2023-01-05 18:18:30 +01:00
{ lib, stdenv, appimageTools, fetchurl, undmg }:
let
pname = "notesnook";
2023-08-13 10:44:25 +02:00
version = "2.6.1";
2023-01-05 18:18:30 +01:00
inherit (stdenv.hostPlatform) system;
throwSystem = throw "Unsupported system: ${system}";
suffix = {
x86_64-linux = "linux_x86_64.AppImage";
x86_64-darwin = "mac_x64.dmg";
aarch64-darwin = "mac_arm64.dmg";
}.${system} or throwSystem;
src = fetchurl {
url = "https://github.com/streetwriters/notesnook/releases/download/v${version}/notesnook_${suffix}";
hash = {
2023-08-13 10:44:25 +02:00
x86_64-linux = "sha256-PLHP1Q4+xcHyr0323K4BD+oH57SspsrAcxRe/C6RFDU=";
2023-08-13 14:45:43 +02:00
x86_64-darwin = "sha256-gOUL3qLSM+/pr519Gc0baUtbmhA40lG6XzuCRyGILkc=";
aarch64-darwin = "sha256-d1nXdCv1mK4+4Gef1upIkHS3J2d9qzTLXbBWabsJwpw=";
2023-01-05 18:18:30 +01:00
}.${system} or throwSystem;
};
appimageContents = appimageTools.extractType2 {
inherit pname version src;
};
meta = with lib; {
description = "A fully open source & end-to-end encrypted note taking alternative to Evernote.";
longDescription = ''
Notesnook is a free (as in speech) & open source note taking app
focused on user privacy & ease of use. To ensure zero knowledge
principles, Notesnook encrypts everything on your device using
XChaCha20-Poly1305 & Argon2.
'';
homepage = "https://notesnook.com";
license = licenses.gpl3Only;
maintainers = with maintainers; [ j0lol ];
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
2024-02-11 03:19:15 +01:00
mainProgram = "notesnook";
2023-01-05 18:18:30 +01:00
};
linux = appimageTools.wrapType2 rec {
inherit pname version src meta;
profile = ''
export LC_ALL=C.UTF-8
'';
multiPkgs = null; # no 32bit needed
extraPkgs = appimageTools.defaultFhsEnvArgs.multiPkgs;
extraInstallCommands = ''
mv $out/bin/{${pname}-${version},${pname}}
install -Dm444 ${appimageContents}/notesnook.desktop -t $out/share/applications
install -Dm444 ${appimageContents}/notesnook.png -t $out/share/pixmaps
substituteInPlace $out/share/applications/notesnook.desktop \
--replace 'Exec=AppRun --no-sandbox %U' 'Exec=${pname}'
'';
};
darwin = stdenv.mkDerivation {
inherit pname version src meta;
nativeBuildInputs = [ undmg ];
sourceRoot = "Notesnook.app";
installPhase = ''
mkdir -p $out/Applications/Notesnook.app
cp -R . $out/Applications/Notesnook.app
'';
};
in
if stdenv.isDarwin
then darwin
else linux