Silvan Mosberger 374e6bcc40 treewide: Format all Nix files
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:

  nix-build ci -A fmt.check

This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).

This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).

Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase).

If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
2025-04-01 20:10:43 +02:00

110 lines
2.7 KiB
Nix

{
lib,
stdenv,
appimageTools,
fetchurl,
makeWrapper,
_7zz,
}:
let
pname = "notesnook";
version = "3.0.19";
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 =
{
x86_64-linux = "sha256-yCzREyFyGoAPXVVnNX6GUrr83oaPtoNOgZOOd6vJD1Q=";
x86_64-darwin = "sha256-WciEpt0vUuXS6YeZkbyFGqQaotXoZkWnkkn5B6/JXwE=";
aarch64-darwin = "sha256-iP3Xd/otYEVwU85U2dlFcX9QjDq2CbIqHmcDYVxzqzI=";
}
.${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;
maintainers = with maintainers; [
cig0
j0lol
];
platforms = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
mainProgram = "notesnook";
};
linux = appimageTools.wrapType2 rec {
inherit
pname
version
src
meta
;
nativeBuildInputs = [ makeWrapper ];
profile = ''
export LC_ALL=C.UTF-8
'';
extraInstallCommands = ''
wrapProgram $out/bin/notesnook \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"
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 = [ _7zz ];
sourceRoot = "Notesnook.app";
# 7zz did not unpack in setup hook for some reason, done manually here
unpackPhase = ''
7zz x $src
'';
installPhase = ''
mkdir -p $out/Applications/Notesnook.app
cp -R . $out/Applications/Notesnook.app
'';
};
in
if stdenv.hostPlatform.isDarwin then darwin else linux