1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-22 06:05:13 +00:00
nixpkgs/pkgs/applications/misc/simplenote/default.nix

97 lines
2 KiB
Nix
Raw Normal View History

2019-11-28 10:46:33 +00:00
{ atomEnv
, autoPatchelfHook
, dpkg
, fetchurl
, makeDesktopItem
, makeWrapper
, stdenv
, udev
, wrapGAppsHook
}:
2019-09-22 22:02:48 +01:00
let
inherit (stdenv.hostPlatform) system;
2019-11-28 10:46:33 +00:00
throwSystem = throw "Unsupported system: ${system}";
2019-09-22 22:02:48 +01:00
pname = "simplenote";
2020-04-01 20:26:26 +01:00
version = "1.15.1";
2019-09-22 22:02:48 +01:00
sha256 = {
2020-04-01 20:26:26 +01:00
x86_64-linux = "1q1y5favj2ny0l2iq53vq39ns68zfr2z1plskxdg2d93jarvcr8x";
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 22:02:48 +01: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 22:02:48 +01: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 22:02:48 +01:00
comment = "Simplenote for Linux";
2019-11-28 10:46:33 +00:00
desktopName = "Simplenote";
2019-09-22 22:02:48 +01:00
exec = "simplenote %U";
icon = "simplenote";
2019-11-28 10:46:33 +00:00
name = "simplenote";
2019-09-22 22:02:48 +01:00
startupNotify = "true";
2019-11-28 10:46:33 +00:00
type = "Application";
2019-09-22 22:02:48 +01: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 22:02:48 +01:00
2019-11-28 10:46:33 +00:00
buildInputs = atomEnv.packages;
2019-09-22 22:02:48 +01: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 = [
udev.lib
];
2019-09-22 22:02:48 +01: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 22:02:48 +01:00
'';
};
in
2019-11-28 10:46:33 +00:00
linux