nixpkgs/pkgs/by-name/tr/treedome/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

141 lines
3.0 KiB
Nix
Raw Normal View History

2023-12-29 03:38:42 +00:00
{ lib
, cargo-tauri_1
2023-12-29 03:38:42 +00:00
, cmake
, dbus
2024-02-18 07:08:03 +00:00
, fetchgit
2023-12-29 03:38:42 +00:00
, fetchYarnDeps
, freetype
, gsettings-desktop-schemas
, gtk3
, libsoup
, stdenv
, yarnConfigHook
, yarnBuildHook
, nodejs
2023-12-29 03:38:42 +00:00
, openssl
, pkg-config
, rustPlatform
, webkitgtk_4_0
, wrapGAppsHook3
2023-12-29 03:38:42 +00:00
, sqlite
}:
let
pname = "treedome";
2024-08-19 12:06:12 +00:00
version = "0.5.1";
2023-12-29 03:38:42 +00:00
2024-02-18 07:08:03 +00:00
src = fetchgit {
url = "https://codeberg.org/solver-orgz/treedome";
2023-12-29 03:38:42 +00:00
rev = version;
2024-08-19 12:06:12 +00:00
hash = "sha256-EYSB9BJhk0yIwT1h8cIo6fpDI10av6yCtOR4FuAY5dM=";
2024-02-18 07:08:03 +00:00
fetchLFS = true;
2023-12-29 03:38:42 +00:00
};
frontend-build = stdenv.mkDerivation (finalAttrs: {
2023-12-29 03:38:42 +00:00
pname = "treedome-ui";
inherit version src;
2023-12-29 03:38:42 +00:00
offlineCache = fetchYarnDeps {
yarnLock = "${src}/yarn.lock";
2024-08-19 12:06:12 +00:00
hash = "sha256-H9Y/heYEPU5LvIZAgVn0FhiNQ0QKAQEDQ1/oFogi9vc=";
2023-12-29 03:38:42 +00:00
};
nativeBuildInputs = [
yarnConfigHook
yarnBuildHook
nodejs
];
2023-12-29 03:38:42 +00:00
installPhase = ''
runHook preInstall
mkdir -p $out/dist
cp -r dist/** $out/dist
runHook postInstall
'';
});
2023-12-29 03:38:42 +00:00
in
rustPlatform.buildRustPackage {
inherit version pname src;
sourceRoot = "${src.name}/src-tauri";
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"fix-path-env-0.0.0" = "sha256-ewE3CwqLC8dvi94UrQsWbp0mjmrzEJIGPDYtdmQ/sGs=";
};
};
2024-03-12 06:18:41 +00:00
env = {
VERGEN_GIT_DESCRIBE = version;
};
2023-12-29 03:38:42 +00:00
preConfigure = ''
mkdir -p dist
cp -R ${frontend-build}/dist/** dist
'';
# copy the frontend static resources to final build directory
# Also modify tauri.conf.json so that it expects the resources at the new location
postPatch = ''
substituteInPlace ./tauri.conf.json \
--replace '"distDir": "../dist",' '"distDir": "dist",' \
--replace '"beforeBuildCommand": "yarn run build",' '"beforeBuildCommand": "",'
'';
nativeBuildInputs = [
cmake
pkg-config
cargo-tauri_1
wrapGAppsHook3
2023-12-29 03:38:42 +00:00
];
buildInputs = [
dbus
openssl
freetype
libsoup
gtk3
webkitgtk_4_0
2023-12-29 03:38:42 +00:00
gsettings-desktop-schemas
sqlite
];
buildPhase = ''
runHook preBuild
cargo tauri build
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin/
mkdir -p $out/share/
cp target/release/bundle/deb/treedome_0.0.0_amd64/data/usr/bin/treedome $out/bin/treedome
cp -R target/release/bundle/deb/treedome_0.0.0_amd64/data/usr/share/** $out/share/
runHook postInstall
'';
# WEBKIT_DISABLE_COMPOSITING_MODE essential in NVIDIA + compositor https://github.com/NixOS/nixpkgs/issues/212064#issuecomment-1400202079
postFixup = ''
wrapProgram "$out/bin/treedome" \
--set WEBKIT_DISABLE_COMPOSITING_MODE 1
'';
meta = with lib; {
2024-03-12 06:18:41 +00:00
description = "Local-first, encrypted, note taking application organized in tree-like structures";
2023-12-29 03:38:42 +00:00
homepage = " https://codeberg.org/solver-orgz/treedome";
2024-03-19 12:26:06 +00:00
license = licenses.agpl3Only;
2023-12-29 03:38:42 +00:00
platforms = [ "x86_64-linux" ];
mainProgram = "treedome";
maintainers = with maintainers; [ tengkuizdihar ];
2024-02-18 07:08:03 +00:00
changelog = "https://codeberg.org/solver-orgz/treedome/releases/tag/${version}";
2023-12-29 03:38:42 +00:00
};
}