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

98 lines
2 KiB
Nix
Raw Normal View History

2019-11-28 10:46:33 +00:00
{ atomEnv
, autoPatchelfHook
, dpkg
, fetchurl
, makeDesktopItem
, makeWrapper
, lib
2019-11-28 10:46:33 +00:00
, stdenv
, udev
, wrapGAppsHook
}:
2019-09-22 21:02:48 +00:00
let
inherit (stdenv.hostPlatform) system;
2019-11-28 10:46:33 +00:00
throwSystem = throw "Unsupported system: ${system}";
2019-09-22 21:02:48 +00:00
pname = "simplenote";
2020-12-05 00:22:16 +00:00
version = "2.2.0";
2019-09-22 21:02:48 +00:00
sha256 = {
2020-12-05 00:22:16 +00:00
x86_64-linux = "123b0fh14068s2z3k6s5mmh46xwlz02qfnpmj838zlm5hckjmifv";
2019-11-28 10:46:33 +00:00
}.${system} or throwSystem;
meta = with stdenv.lib; {
description = "The simplest way to keep notes";
2019-09-22 21:02:48 +00:00
homepage = "https://github.com/Automattic/simplenote-electron";
license = licenses.gpl2;
2019-11-28 10:46:33 +00:00
maintainers = with maintainers; [
kiwi
];
platforms = [
"x86_64-linux"
];
};
2019-09-22 21:02:48 +00: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 10:46:33 +00:00
categories = "Development";
2019-09-22 21:02:48 +00:00
comment = "Simplenote for Linux";
2019-11-28 10:46:33 +00:00
desktopName = "Simplenote";
2019-09-22 21:02:48 +00:00
exec = "simplenote %U";
icon = "simplenote";
2019-11-28 10:46:33 +00:00
name = "simplenote";
2019-09-22 21:02:48 +00:00
startupNotify = "true";
2019-11-28 10:46:33 +00:00
type = "Application";
2019-09-22 21:02:48 +00:00
};
dontBuild = true;
dontConfigure = true;
dontPatchELF = true;
dontWrapGApps = true;
2019-11-28 10:46:33 +00:00
nativeBuildInputs = [
autoPatchelfHook
dpkg
makeWrapper
wrapGAppsHook
];
2019-09-22 21:02:48 +00:00
2019-11-28 10:46:33 +00:00
buildInputs = atomEnv.packages;
2019-09-22 21:02:48 +00: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 10:46:33 +00:00
runtimeDependencies = [
(lib.getLib udev)
2019-11-28 10:46:33 +00:00
];
2019-09-22 21:02:48 +00: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 22:01:36 +00:00
--prefix LD_LIBRARY_PATH : "${stdenv.lib.makeLibraryPath [ stdenv.cc.cc ] }" \
2019-11-28 10:46:33 +00:00
"''${gappsWrapperArgs[@]}"
2019-09-22 21:02:48 +00:00
'';
};
in
2019-11-28 10:46:33 +00:00
linux