1 { stdenv, lib, unzip, autoPatchelfHook
2 , fetchurl, makeWrapper
3 , alsa-lib, mesa, nss, nspr, systemd
4 , makeDesktopItem, copyDesktopItems, wrapGAppsHook
9 pname = "trilium-desktop";
12 linuxSource.url = "https://github.com/zadam/trilium/releases/download/v${version}/trilium-linux-x64-${version}.tar.xz";
13 linuxSource.sha256 = "02vbghvi2sbh943rslgm712x9zccvpjab3jvr5b1bw4bq5fzppgq";
15 darwinSource.url = "https://github.com/zadam/trilium/releases/download/v${version}/trilium-mac-x64-${version}.zip";
16 darwinSource.sha256 = "0z6dk16xdzkiyxrm1yh3iz5351c8sdzvk8v5l3jdqy7davxw9f86";
18 meta = metaCommon // {
19 mainProgram = "trilium";
20 platforms = [ "x86_64-linux" "x86_64-darwin" ];
23 linux = stdenv.mkDerivation rec {
24 inherit pname version meta;
26 src = fetchurl linuxSource;
28 # TODO: migrate off autoPatchelfHook and use nixpkgs' electron
50 comment = meta.description;
51 desktopName = "Trilium Notes";
52 categories = [ "Office" ];
53 startupWMClass = "trilium notes";
57 # Remove trilium-portable.sh, so trilium knows it is packaged making it stop auto generating a desktop item on launch
59 rm ./trilium-portable.sh
65 mkdir -p $out/share/trilium
66 mkdir -p $out/share/icons/hicolor/128x128/apps
68 cp -r ./* $out/share/trilium
69 ln -s $out/share/trilium/trilium $out/bin/trilium
71 ln -s $out/share/trilium/icon.png $out/share/icons/hicolor/128x128/apps/trilium.png
75 # LD_LIBRARY_PATH "shouldn't" be needed, remove when possible :)
76 # Error: libstdc++.so.6: cannot open shared object file: No such file or directory
78 gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath buildInputs})
83 passthru.updateScript = ./update.sh;
86 darwin = stdenv.mkDerivation {
87 inherit pname version meta;
89 src = fetchurl darwinSource;
90 nativeBuildInputs = [ unzip ];
93 mkdir -p $out/Applications
94 cp -r *.app $out/Applications
99 if stdenv.isDarwin then darwin else linux