nixpkgs/pkgs/by-name/no/notesnook/package.nix

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

80 lines
2.3 KiB
Nix
Raw Normal View History

2024-05-30 00:26:00 +00:00
{ lib, stdenv, appimageTools, fetchurl, _7zz }:
2023-01-05 17:18:30 +00:00
let
pname = "notesnook";
2024-09-29 01:14:03 +00:00
version = "3.0.19";
2023-01-05 17:18:30 +00: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 = {
2024-09-29 01:14:03 +00:00
x86_64-linux = "sha256-yCzREyFyGoAPXVVnNX6GUrr83oaPtoNOgZOOd6vJD1Q=";
x86_64-darwin = "sha256-WciEpt0vUuXS6YeZkbyFGqQaotXoZkWnkkn5B6/JXwE=";
aarch64-darwin = "sha256-iP3Xd/otYEVwU85U2dlFcX9QjDq2CbIqHmcDYVxzqzI=";
2023-01-05 17:18:30 +00:00
}.${system} or throwSystem;
};
appimageContents = appimageTools.extractType2 {
inherit pname version src;
};
meta = with lib; {
description = "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;
2024-05-29 23:48:08 +00:00
maintainers = with maintainers; [ cig0 j0lol ];
2023-01-05 17:18:30 +00:00
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
2024-02-11 02:19:15 +00:00
mainProgram = "notesnook";
2023-01-05 17:18:30 +00:00
};
linux = appimageTools.wrapType2 rec {
inherit pname version src meta;
profile = ''
export LC_ALL=C.UTF-8
'';
extraInstallCommands = ''
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;
2024-05-29 23:48:08 +00:00
nativeBuildInputs = [ _7zz ];
2023-01-05 17:18:30 +00:00
sourceRoot = "Notesnook.app";
2024-05-29 23:48:08 +00:00
# 7zz did not unpack in setup hook for some reason, done manually here
unpackPhase = ''
7zz x $src
'';
2023-01-05 17:18:30 +00:00
installPhase = ''
mkdir -p $out/Applications/Notesnook.app
cp -R . $out/Applications/Notesnook.app
'';
};
in
if stdenv.hostPlatform.isDarwin
then darwin
else linux