trilium: 0.51.2 -> 0.53.2 + update script (#177484)

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
This commit is contained in:
FliegendeWurst 2022-08-02 14:01:17 +02:00 committed by GitHub
parent 792d5a34ca
commit 48f4befd44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 55 additions and 27 deletions

View file

@ -10,6 +10,7 @@ let
# Disable automatically generating desktop icon # Disable automatically generating desktop icon
noDesktopIcon=true noDesktopIcon=true
noBackup=${lib.boolToString cfg.noBackup} noBackup=${lib.boolToString cfg.noBackup}
noAuthentication=${lib.boolToString cfg.noAuthentication}
[Network] [Network]
# host setting is relevant only for web deployments - set the host on which the server will listen # host setting is relevant only for web deployments - set the host on which the server will listen
@ -49,6 +50,14 @@ in
''; '';
}; };
noAuthentication = mkOption {
type = types.bool;
default = false;
description = ''
If set to true, no password is required to access the web frontend.
'';
};
host = mkOption { host = mkOption {
type = types.str; type = types.str;
default = "127.0.0.1"; default = "127.0.0.1";

View file

@ -1,18 +1,8 @@
{ lib, stdenv, nixosTests, fetchurl, autoPatchelfHook, atomEnv, makeWrapper, makeDesktopItem, gtk3, libxshmfence, wrapGAppsHook }: { lib, stdenv, nixosTests, fetchurl, autoPatchelfHook, atomEnv, makeWrapper, makeDesktopItem, copyDesktopItems, libxshmfence, wrapGAppsHook }:
let let
description = "Trilium Notes is a hierarchical note taking application with focus on building large personal knowledge bases"; metaCommon = with lib; {
desktopItem = makeDesktopItem { description = "Hierarchical note taking application with focus on building large personal knowledge bases";
name = "Trilium";
exec = "trilium";
icon = "trilium";
comment = description;
desktopName = "Trilium Notes";
categories = [ "Office" ];
};
meta = with lib; {
inherit description;
homepage = "https://github.com/zadam/trilium"; homepage = "https://github.com/zadam/trilium";
license = licenses.agpl3Plus; license = licenses.agpl3Plus;
sourceProvenance = with sourceTypes; [ binaryNativeCode ]; sourceProvenance = with sourceTypes; [ binaryNativeCode ];
@ -20,24 +10,22 @@ let
maintainers = with maintainers; [ fliegendewurst ]; maintainers = with maintainers; [ fliegendewurst ];
}; };
version = "0.51.2"; version = "0.53.2";
desktopSource = { desktopSource.url = "https://github.com/zadam/trilium/releases/download/v${version}/trilium-linux-x64-${version}.tar.xz";
url = "https://github.com/zadam/trilium/releases/download/v${version}/trilium-linux-x64-${version}.tar.xz"; desktopSource.sha256 = "0sjljyn7x0kv1692wccdjsll8h49r9lyqbrfnz4cn147xinclyw4";
sha256 = "17bqcnpvflpi5dlz9m294diwd6as5wha5jcv9a3qvhh4pq0nyr4z";
};
serverSource = { serverSource.url = "https://github.com/zadam/trilium/releases/download/v${version}/trilium-linux-x64-server-${version}.tar.xz";
url = "https://github.com/zadam/trilium/releases/download/v${version}/trilium-linux-x64-server-${version}.tar.xz"; serverSource.sha256 = "0y5xjf4r0c2hw2ch4ml55fq1nlmgnakq4zh3ch8sdgzm86nchavb";
sha256 = "0jjvg75a4va5d81x8dvpzmzax7p0bqd7psv0alkkl13m91gai6ig";
};
in { in {
trilium-desktop = stdenv.mkDerivation rec { trilium-desktop = stdenv.mkDerivation rec {
pname = "trilium-desktop"; pname = "trilium-desktop";
inherit version; inherit version;
inherit meta; meta = metaCommon // {
mainProgram = "trilium";
};
src = fetchurl desktopSource; src = fetchurl desktopSource;
@ -45,21 +33,32 @@ in {
autoPatchelfHook autoPatchelfHook
makeWrapper makeWrapper
wrapGAppsHook wrapGAppsHook
copyDesktopItems
]; ];
buildInputs = atomEnv.packages ++ [ gtk3 libxshmfence ]; buildInputs = atomEnv.packages ++ [ libxshmfence ];
desktopItems = [
(makeDesktopItem {
name = "Trilium";
exec = "trilium";
icon = "trilium";
comment = meta.description;
desktopName = "Trilium Notes";
categories = [ "Office" ];
})
];
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
mkdir -p $out/bin mkdir -p $out/bin
mkdir -p $out/share/trilium mkdir -p $out/share/trilium
mkdir -p $out/share/{applications,icons/hicolor/128x128/apps} mkdir -p $out/share/icons/hicolor/128x128/apps
cp -r ./* $out/share/trilium cp -r ./* $out/share/trilium
ln -s $out/share/trilium/trilium $out/bin/trilium ln -s $out/share/trilium/trilium $out/bin/trilium
ln -s $out/share/trilium/icon.png $out/share/icons/hicolor/128x128/apps/trilium.png ln -s $out/share/trilium/icon.png $out/share/icons/hicolor/128x128/apps/trilium.png
cp ${desktopItem}/share/applications/* $out/share/applications
runHook postInstall runHook postInstall
''; '';
@ -69,13 +68,15 @@ in {
''; '';
dontStrip = true; dontStrip = true;
passthru.updateScript = ./update.sh;
}; };
trilium-server = stdenv.mkDerivation rec { trilium-server = stdenv.mkDerivation rec {
pname = "trilium-server"; pname = "trilium-server";
inherit version; inherit version;
inherit meta; meta = metaCommon;
src = fetchurl serverSource; src = fetchurl serverSource;

View file

@ -0,0 +1,18 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p coreutils curl jq
set -euo pipefail
cd $(dirname "${BASH_SOURCE[0]}")
version=$(curl -s --show-error "https://api.github.com/repos/zadam/trilium/releases/latest" | jq -r '.tag_name' | tail -c +2)
sha256_linux64=$(nix-prefetch-url --quiet https://github.com/zadam/trilium/releases/download/v${version}/trilium-linux-x64-${version}.tar.xz)
sha256_linux64_server=$(nix-prefetch-url --quiet https://github.com/zadam/trilium/releases/download/v${version}/trilium-linux-x64-server-${version}.tar.xz)
setKV () {
sed -i "s|$1 = \".*\"|$1 = \"${2:-}\"|" ./default.nix
}
setKV version $version
setKV desktopSource.sha256 $sha256_linux64
setKV serverSource.sha256 $sha256_linux64_server