nixpkgs/pkgs/applications/editors/standardnotes/default.nix
Alexis Hildebrandt 755b915a15 treewide: Remove indefinite article from meta.description
nix run nixpkgs#silver-searcher -- -G '\.nix$' -0l 'description.*"[Aa]n?' pkgs \
  | xargs -0 nix run nixpkgs#gnused -- -i '' -Ee 's/(description.*")[Aa]n? (.)/\1\U\2/'
2024-06-09 23:07:45 +02:00

82 lines
2.1 KiB
Nix

{ lib
, stdenv
, fetchurl
, dpkg
, makeWrapper
, electron
, libsecret
, asar
, glib
, desktop-file-utils
, callPackage
}:
let
srcjson = builtins.fromJSON (builtins.readFile ./src.json);
throwSystem = throw "Unsupported system: ${stdenv.hostPlatform.system}";
in
stdenv.mkDerivation rec {
pname = "standardnotes";
src = fetchurl (srcjson.deb.${stdenv.hostPlatform.system} or throwSystem);
inherit (srcjson) version;
dontConfigure = true;
dontBuild = true;
nativeBuildInputs = [ makeWrapper dpkg desktop-file-utils asar ];
unpackPhase = "dpkg-deb --fsys-tarfile $src | tar -x --no-same-permissions --no-same-owner";
installPhase = let
libPath = lib.makeLibraryPath [
libsecret
glib
stdenv.cc.cc.lib
];
in
''
runHook preInstall
mkdir -p $out/bin $out/share/standardnotes
cp -R usr/share/{applications,icons} $out/share
cp -R opt/Standard\ Notes/resources/app.asar $out/share/standardnotes/
asar e $out/share/standardnotes/app.asar asar-unpacked
find asar-unpacked -name '*.node' -exec patchelf \
--add-rpath "${libPath}" \
{} \;
asar p asar-unpacked $out/share/standardnotes/app.asar
makeWrapper ${electron}/bin/electron $out/bin/standardnotes \
--add-flags $out/share/standardnotes/app.asar
${desktop-file-utils}/bin/desktop-file-install --dir $out/share/applications \
--set-key Exec --set-value standardnotes usr/share/applications/standard-notes.desktop
runHook postInstall
'';
passthru.updateScript = callPackage ./update.nix {};
meta = with lib; {
description = "Simple and private notes app";
longDescription = ''
Standard Notes is a private notes app that features unmatched simplicity,
end-to-end encryption, powerful extensions, and open-source applications.
'';
homepage = "https://standardnotes.org";
license = licenses.agpl3Only;
maintainers = with maintainers; [ mgregoire chuangzhu squalus ];
sourceProvenance = [ sourceTypes.binaryNativeCode ];
platforms = builtins.attrNames srcjson.deb;
mainProgram = "standardnotes";
};
}