2022-08-12 12:06:08 +00:00
|
|
|
{ lib, stdenv, nixosTests, fetchurl, autoPatchelfHook, atomEnv, makeWrapper, makeDesktopItem, copyDesktopItems, libxshmfence, wrapGAppsHook }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
2022-08-12 12:06:08 +00:00
|
|
|
metaCommon = with lib; {
|
|
|
|
description = "Hierarchical note taking application with focus on building large personal knowledge bases";
|
2020-04-24 23:36:52 +00:00
|
|
|
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-08-12 12:06:08 +00:00
|
|
|
version = "0.53.2";
|
2020-05-15 21:57:56 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
desktopSource.url = "https://github.com/zadam/trilium/releases/download/v${version}/trilium-linux-x64-${version}.tar.xz";
|
|
|
|
desktopSource.sha256 = "0sjljyn7x0kv1692wccdjsll8h49r9lyqbrfnz4cn147xinclyw4";
|
2020-05-15 21:57:56 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
serverSource.url = "https://github.com/zadam/trilium/releases/download/v${version}/trilium-linux-x64-server-${version}.tar.xz";
|
|
|
|
serverSource.sha256 = "0y5xjf4r0c2hw2ch4ml55fq1nlmgnakq4zh3ch8sdgzm86nchavb";
|
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;
|
2022-08-12 12:06:08 +00:00
|
|
|
meta = metaCommon // {
|
|
|
|
mainProgram = "trilium";
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
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
|
2022-08-12 12:06:08 +00:00
|
|
|
copyDesktopItems
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
2020-08-20 17:08:02 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
buildInputs = atomEnv.packages ++ [ libxshmfence ];
|
|
|
|
|
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = "Trilium";
|
|
|
|
exec = "trilium";
|
|
|
|
icon = "trilium";
|
|
|
|
comment = meta.description;
|
|
|
|
desktopName = "Trilium Notes";
|
|
|
|
categories = [ "Office" ];
|
|
|
|
})
|
|
|
|
];
|
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
|
2022-08-12 12:06:08 +00:00
|
|
|
mkdir -p $out/share/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
|
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;
|
2022-08-12 12:06:08 +00:00
|
|
|
|
|
|
|
passthru.updateScript = ./update.sh;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
trilium-server = stdenv.mkDerivation rec {
|
|
|
|
pname = "trilium-server";
|
|
|
|
inherit version;
|
2022-08-12 12:06:08 +00:00
|
|
|
meta = metaCommon;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|