nixpkgs-suyu/pkgs/applications/misc/simplenote/default.nix

98 lines
2 KiB
Nix
Raw Normal View History

2019-11-28 11:46:33 +01:00
{ atomEnv
, autoPatchelfHook
, dpkg
, fetchurl
, makeDesktopItem
, makeWrapper
, lib
2019-11-28 11:46:33 +01:00
, stdenv
, udev
, wrapGAppsHook
}:
2019-09-22 23:02:48 +02:00
let
inherit (stdenv.hostPlatform) system;
2019-11-28 11:46:33 +01:00
throwSystem = throw "Unsupported system: ${system}";
2019-09-22 23:02:48 +02:00
pname = "simplenote";
2020-11-26 21:21:51 +01:00
version = "2.1.0";
2019-09-22 23:02:48 +02:00
sha256 = {
2020-11-26 21:21:51 +01:00
x86_64-linux = "0lg48nq493anpnm20vw72y242nxa1g903bxzp4pngzxyi986jddz";
2019-11-28 11:46:33 +01:00
}.${system} or throwSystem;
meta = with stdenv.lib; {
description = "The simplest way to keep notes";
2019-09-22 23:02:48 +02:00
homepage = "https://github.com/Automattic/simplenote-electron";
license = licenses.gpl2;
2019-11-28 11:46:33 +01:00
maintainers = with maintainers; [
kiwi
];
platforms = [
"x86_64-linux"
];
};
2019-09-22 23:02:48 +02:00
linux = stdenv.mkDerivation rec {
inherit pname version meta;
src = fetchurl {
url =
"https://github.com/Automattic/simplenote-electron/releases/download/"
+ "v${version}/Simplenote-linux-${version}-amd64.deb";
inherit sha256;
};
desktopItem = makeDesktopItem {
2019-11-28 11:46:33 +01:00
categories = "Development";
2019-09-22 23:02:48 +02:00
comment = "Simplenote for Linux";
2019-11-28 11:46:33 +01:00
desktopName = "Simplenote";
2019-09-22 23:02:48 +02:00
exec = "simplenote %U";
icon = "simplenote";
2019-11-28 11:46:33 +01:00
name = "simplenote";
2019-09-22 23:02:48 +02:00
startupNotify = "true";
2019-11-28 11:46:33 +01:00
type = "Application";
2019-09-22 23:02:48 +02:00
};
dontBuild = true;
dontConfigure = true;
dontPatchELF = true;
dontWrapGApps = true;
2019-11-28 11:46:33 +01:00
nativeBuildInputs = [
autoPatchelfHook
dpkg
makeWrapper
wrapGAppsHook
];
2019-09-22 23:02:48 +02:00
2019-11-28 11:46:33 +01:00
buildInputs = atomEnv.packages;
2019-09-22 23:02:48 +02:00
unpackPhase = "dpkg-deb -x $src .";
installPhase = ''
mkdir -p "$out/bin"
cp -R "opt" "$out"
cp -R "usr/share" "$out/share"
chmod -R g-w "$out"
mkdir -p "$out/share/applications"
cp "${desktopItem}/share/applications/"* "$out/share/applications"
'';
2019-11-28 11:46:33 +01:00
runtimeDependencies = [
(lib.getLib udev)
2019-11-28 11:46:33 +01:00
];
2019-09-22 23:02:48 +02:00
postFixup = ''
makeWrapper $out/opt/Simplenote/simplenote $out/bin/simplenote \
simplenote: fix libstdc++ error Fixes a bug that was noticed during an automated version bump. What was needed was to add an LD_LIBRARY_PATH entry for stdenv.cc.cc in makeWrapper ``` --prefix LD_LIBRARY_PATH : "${stdenv.lib.makeLibraryPath [ stdenv.cc.cc ] }" \ ``` The error as seen in developer tools console was: ``` /nix/store/d4b2xcpdf4y4hspbwrmjdz540m493894-simplenote-1.12.0/opt/Simplenote/resources/electron.asar/renderer/init.js:158 Unable to load preload script: /nix/store/d4b2xcpdf4y4hspbwrmjdz540m493894-simplenote-1.12.0/opt/Simplenote/resources/app.asar/desktop/preload.js (anonymous) @ /nix/store/d4b2xcpdf4y4hspbwrmjdz540m493894-simplenote-1.12.0/opt/Simplenote/resources/electron.asar/renderer/init.js:158 /nix/store/d4b2xcpdf4y4hspbwrmjdz540m493894-simplenote-1.12.0/opt/Simplenote/resources/electron.asar/renderer/init.js:159 Error: libstdc++.so.6: cannot open shared object file: No such file or directory at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:160:31) at Object.Module._extensions..node (internal/modules/cjs/loader.js:722) at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:169:18) at Module.load (internal/modules/cjs/loader.js:602) at tryModuleLoad (internal/modules/cjs/loader.js:541) at Function.Module._load (internal/modules/cjs/loader.js:533) at Module.require (internal/modules/cjs/loader.js:640) at require (internal/modules/cjs/helpers.js:20) at Object.<anonymous> (/nix/store/d4b2xcpdf4y4hspbwrmjdz540m493894-simplenote-1.12.0/opt/Simplenote/resources/app.asar/node_modules/@paulcbetts/spellchecker/lib/spellchecker.js:3) at Object.<anonymous> (/nix/store/d4b2xcpdf4y4hspbwrmjdz540m493894-simplenote-1.12.0/opt/Simplenote/resources/app.asar/node_modules/@paulcbetts/spellchecker/lib/spellchecker.js:116) ``` To (help) anyone that may find have errors like this in the future: makeWrapper requiring the makeLibraryPath with stdenv.cc.cc is fairly common for electron apps. At least ones that use dpkg on prebuilt debian .deb files (my `bitwarden` derivation requires it, too) that use gappsWrapperArgs Thanks @ryantm / r-ryantm and @worldofpeace :) Reference: https://github.com/NixOS/nixpkgs/pull/76421#pullrequestreview-336359695
2019-12-26 23:01:36 +01:00
--prefix LD_LIBRARY_PATH : "${stdenv.lib.makeLibraryPath [ stdenv.cc.cc ] }" \
2019-11-28 11:46:33 +01:00
"''${gappsWrapperArgs[@]}"
2019-09-22 23:02:48 +02:00
'';
};
in
2019-11-28 11:46:33 +01:00
linux