2021-05-03 20:48:10 +00:00
|
|
|
{ lib, stdenv, nixosTests, fetchurl, autoPatchelfHook, atomEnv, makeWrapper, makeDesktopItem, gtk3, libxshmfence, wrapGAppsHook }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
2020-10-19 00:13:06 +00:00
|
|
|
description = "Trilium Notes is a hierarchical note taking application with focus on building large personal knowledge bases";
|
2020-04-24 23:36:52 +00:00
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = "Trilium";
|
|
|
|
exec = "trilium";
|
|
|
|
icon = "trilium";
|
|
|
|
comment = description;
|
|
|
|
desktopName = "Trilium Notes";
|
2022-03-05 16:20:37 +00:00
|
|
|
categories = [ "Office" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
inherit description;
|
|
|
|
homepage = "https://github.com/zadam/trilium";
|
2021-03-23 19:22:30 +00:00
|
|
|
license = licenses.agpl3Plus;
|
2022-06-16 17:23:12 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = [ "x86_64-linux" ];
|
2021-03-23 19:22:30 +00:00
|
|
|
maintainers = with maintainers; [ fliegendewurst ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
version = "0.51.2";
|
2020-05-15 21:57:56 +00:00
|
|
|
|
|
|
|
desktopSource = {
|
|
|
|
url = "https://github.com/zadam/trilium/releases/download/v${version}/trilium-linux-x64-${version}.tar.xz";
|
2022-05-18 14:49:53 +00:00
|
|
|
sha256 = "17bqcnpvflpi5dlz9m294diwd6as5wha5jcv9a3qvhh4pq0nyr4z";
|
2020-05-15 21:57:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
serverSource = {
|
|
|
|
url = "https://github.com/zadam/trilium/releases/download/v${version}/trilium-linux-x64-server-${version}.tar.xz";
|
2022-05-18 14:49:53 +00:00
|
|
|
sha256 = "0jjvg75a4va5d81x8dvpzmzax7p0bqd7psv0alkkl13m91gai6ig";
|
2020-05-15 21:57:56 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
in {
|
2020-08-20 17:08:02 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
trilium-desktop = stdenv.mkDerivation rec {
|
|
|
|
pname = "trilium-desktop";
|
|
|
|
inherit version;
|
|
|
|
inherit meta;
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
src = fetchurl desktopSource;
|
2020-08-20 17:08:02 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
autoPatchelfHook
|
|
|
|
makeWrapper
|
|
|
|
wrapGAppsHook
|
|
|
|
];
|
2020-08-20 17:08:02 +00:00
|
|
|
|
2021-05-03 20:48:10 +00:00
|
|
|
buildInputs = atomEnv.packages ++ [ gtk3 libxshmfence ];
|
2020-08-20 17:08:02 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
installPhase = ''
|
2021-03-23 19:22:30 +00:00
|
|
|
runHook preInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
mkdir -p $out/bin
|
|
|
|
mkdir -p $out/share/trilium
|
2021-12-19 01:06:50 +00:00
|
|
|
mkdir -p $out/share/{applications,icons/hicolor/128x128/apps}
|
2020-08-20 17:08:02 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
cp -r ./* $out/share/trilium
|
|
|
|
ln -s $out/share/trilium/trilium $out/bin/trilium
|
2020-08-20 17:08:02 +00:00
|
|
|
|
2021-12-19 01:06:50 +00:00
|
|
|
ln -s $out/share/trilium/icon.png $out/share/icons/hicolor/128x128/apps/trilium.png
|
2020-04-24 23:36:52 +00:00
|
|
|
cp ${desktopItem}/share/applications/* $out/share/applications
|
2021-03-23 19:22:30 +00:00
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
2020-08-20 17:08:02 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# LD_LIBRARY_PATH "shouldn't" be needed, remove when possible :)
|
|
|
|
preFixup = ''
|
|
|
|
gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : ${atomEnv.libPath})
|
|
|
|
'';
|
2020-08-20 17:08:02 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
dontStrip = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
trilium-server = stdenv.mkDerivation rec {
|
|
|
|
pname = "trilium-server";
|
|
|
|
inherit version;
|
|
|
|
inherit meta;
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
src = fetchurl serverSource;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
autoPatchelfHook
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
stdenv.cc.cc.lib
|
|
|
|
];
|
|
|
|
|
2021-03-23 19:22:30 +00:00
|
|
|
patches = [
|
|
|
|
# patch logger to use console instead of rolling files
|
|
|
|
./0001-Use-console-logger-instead-of-rolling-files.patch
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
installPhase = ''
|
2021-03-23 19:22:30 +00:00
|
|
|
runHook preInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
mkdir -p $out/bin
|
|
|
|
mkdir -p $out/share/trilium-server
|
|
|
|
|
|
|
|
cp -r ./* $out/share/trilium-server
|
2021-03-23 19:22:30 +00:00
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
cat > $out/bin/trilium-server <<EOF
|
|
|
|
#!${stdenv.cc.shell}
|
|
|
|
cd $out/share/trilium-server
|
|
|
|
exec ./node/bin/node src/www
|
|
|
|
EOF
|
|
|
|
chmod a+x $out/bin/trilium-server
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru.tests = {
|
|
|
|
trilium-server = nixosTests.trilium-server;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|