diff options
author | FliegendeWurst <2012gdwu+github@posteo.de> | 2022-08-02 14:01:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-02 14:01:17 +0200 |
commit | 48f4befd440d272d8405d06f5ef0867300eebc64 (patch) | |
tree | 00fbb0df1c056e8654dbbd135fc9c90c1a5fed2f /pkgs/applications/office | |
parent | 792d5a34cacffc2f248d4a8b4f3ba3fb4fd9f3c2 (diff) |
trilium: 0.51.2 -> 0.53.2 + update script (#177484)
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Diffstat (limited to 'pkgs/applications/office')
-rw-r--r-- | pkgs/applications/office/trilium/default.nix | 55 | ||||
-rwxr-xr-x | pkgs/applications/office/trilium/update.sh | 18 |
2 files changed, 46 insertions, 27 deletions
diff --git a/pkgs/applications/office/trilium/default.nix b/pkgs/applications/office/trilium/default.nix index 1410ab3205938..0f7b4e95ff841 100644 --- a/pkgs/applications/office/trilium/default.nix +++ b/pkgs/applications/office/trilium/default.nix @@ -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 - description = "Trilium Notes is a hierarchical note taking application with focus on building large personal knowledge bases"; - desktopItem = makeDesktopItem { - name = "Trilium"; - exec = "trilium"; - icon = "trilium"; - comment = description; - desktopName = "Trilium Notes"; - categories = [ "Office" ]; - }; - - meta = with lib; { - inherit description; + metaCommon = with lib; { + description = "Hierarchical note taking application with focus on building large personal knowledge bases"; homepage = "https://github.com/zadam/trilium"; license = licenses.agpl3Plus; sourceProvenance = with sourceTypes; [ binaryNativeCode ]; @@ -20,24 +10,22 @@ let maintainers = with maintainers; [ fliegendewurst ]; }; - version = "0.51.2"; + version = "0.53.2"; - desktopSource = { - url = "https://github.com/zadam/trilium/releases/download/v${version}/trilium-linux-x64-${version}.tar.xz"; - sha256 = "17bqcnpvflpi5dlz9m294diwd6as5wha5jcv9a3qvhh4pq0nyr4z"; - }; + desktopSource.url = "https://github.com/zadam/trilium/releases/download/v${version}/trilium-linux-x64-${version}.tar.xz"; + desktopSource.sha256 = "0sjljyn7x0kv1692wccdjsll8h49r9lyqbrfnz4cn147xinclyw4"; - serverSource = { - url = "https://github.com/zadam/trilium/releases/download/v${version}/trilium-linux-x64-server-${version}.tar.xz"; - sha256 = "0jjvg75a4va5d81x8dvpzmzax7p0bqd7psv0alkkl13m91gai6ig"; - }; + serverSource.url = "https://github.com/zadam/trilium/releases/download/v${version}/trilium-linux-x64-server-${version}.tar.xz"; + serverSource.sha256 = "0y5xjf4r0c2hw2ch4ml55fq1nlmgnakq4zh3ch8sdgzm86nchavb"; in { trilium-desktop = stdenv.mkDerivation rec { pname = "trilium-desktop"; inherit version; - inherit meta; + meta = metaCommon // { + mainProgram = "trilium"; + }; src = fetchurl desktopSource; @@ -45,21 +33,32 @@ in { autoPatchelfHook makeWrapper 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 = '' runHook preInstall mkdir -p $out/bin 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 ln -s $out/share/trilium/trilium $out/bin/trilium ln -s $out/share/trilium/icon.png $out/share/icons/hicolor/128x128/apps/trilium.png - cp ${desktopItem}/share/applications/* $out/share/applications runHook postInstall ''; @@ -69,13 +68,15 @@ in { ''; dontStrip = true; + + passthru.updateScript = ./update.sh; }; trilium-server = stdenv.mkDerivation rec { pname = "trilium-server"; inherit version; - inherit meta; + meta = metaCommon; src = fetchurl serverSource; diff --git a/pkgs/applications/office/trilium/update.sh b/pkgs/applications/office/trilium/update.sh new file mode 100755 index 0000000000000..02af29dace2f4 --- /dev/null +++ b/pkgs/applications/office/trilium/update.sh @@ -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 |