From 5f2d8bf7f23e5e50b1e3ebcc4c253cd3dcc04f41 Mon Sep 17 00:00:00 2001 From: kolaente Date: Fri, 20 Sep 2024 17:52:36 +0200 Subject: [PATCH] vikunja-desktop: init at 0.24.6 --- .../manual/release-notes/rl-2505.section.md | 2 + pkgs/by-name/vi/vikunja-desktop/package.nix | 118 ++++++++++++++++++ pkgs/by-name/vi/vikunja/package.nix | 5 +- 3 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 pkgs/by-name/vi/vikunja-desktop/package.nix diff --git a/nixos/doc/manual/release-notes/rl-2505.section.md b/nixos/doc/manual/release-notes/rl-2505.section.md index d6cf4e1497794..711e91eea43e8 100644 --- a/nixos/doc/manual/release-notes/rl-2505.section.md +++ b/nixos/doc/manual/release-notes/rl-2505.section.md @@ -101,6 +101,8 @@ - [InputPlumber](https://github.com/ShadowBlip/InputPlumber/), an open source input router and remapper daemon for Linux. Available as [services.inputplumber](#opt-services.inputplumber.enable). +- The desktop application of [Vikunja](https://vikunja.io) is now available in nixpkgs. + - [echoip](https://github.com/mpolden/echoip), a simple service for looking up your IP address. Available as [services.echoip](#opt-services.echoip.enable). - [Buffyboard](https://gitlab.postmarketos.org/postmarketOS/buffybox/-/tree/master/buffyboard), a framebuffer on-screen keyboard. Available as [services.buffyboard](option.html#opt-services.buffyboard). diff --git a/pkgs/by-name/vi/vikunja-desktop/package.nix b/pkgs/by-name/vi/vikunja-desktop/package.nix new file mode 100644 index 0000000000000..db285a0bf92d9 --- /dev/null +++ b/pkgs/by-name/vi/vikunja-desktop/package.nix @@ -0,0 +1,118 @@ +{ + lib, + stdenv, + makeWrapper, + makeDesktopItem, + pnpm_9, + nodejs, + electron, + unstableGitUpdater, + fetchFromGitHub, + vikunja, +}: + +let + executableName = "vikunja-desktop"; + version = "0.24.6"; + src = fetchFromGitHub { + owner = "go-vikunja"; + repo = "vikunja"; + rev = "v${version}"; + hash = "sha256-yUUZ6gPI2Bte36HzfUE6z8B/I1NlwWDSJA2pwkuzd34="; + }; +in +stdenv.mkDerivation (finalAttrs: { + name = "vikunja-desktop-${version}"; + pname = finalAttrs.name; + inherit version src; + + sourceRoot = "${finalAttrs.src.name}/desktop"; + pnpmInstallFlags = [ "--shamefully-hoist" ]; + + pnpmDeps = pnpm_9.fetchDeps { + inherit (finalAttrs) + pname + version + src + sourceRoot + pnpmInstallFlags + ; + hash = "sha256-KDi2DGOTdWJNwEabEImHgDTaeqRguE1k/kbqEV9nh3k="; + }; + + env = { + ELECTRON_SKIP_BINARY_DOWNLOAD = 1; + }; + + nativeBuildInputs = [ + makeWrapper + nodejs + pnpm_9.configHook + vikunja.passthru.frontend + ]; + + buildPhase = '' + runHook preBuild + + sed -i "s/\$${version}/${version}/g" package.json + sed -i "s/\"version\": \".*\"/\"version\": \"${version}\"/" package.json + ln -s '${vikunja.passthru.frontend}' frontend + pnpm run pack -c.electronDist="${electron.dist}" -c.electronVersion="${electron.version}" + + runHook postBuild + ''; + + doCheck = false; + + installPhase = '' + runHook preInstall + + mkdir -p "$out/share/lib/vikunja-desktop" + cp -r ./dist/*-unpacked/{locales,resources{,.pak}} "$out/share/lib/vikunja-desktop" + cp -r ./node_modules "$out/share/lib/vikunja-desktop/resources" + + install -Dm644 "build/icon.png" "$out/share/icons/hicolor/256x256/apps/vikunja-desktop.png" + + # use makeShellWrapper (instead of the makeBinaryWrapper provided by wrapGAppsHook3) for proper shell variable expansion + # see https://github.com/NixOS/nixpkgs/issues/172583 + makeShellWrapper "${lib.getExe electron}" "$out/bin/vikunja-desktop" \ + --add-flags "$out/share/lib/vikunja-desktop/resources/app.asar" \ + "''${gappsWrapperArgs[@]}" \ + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=UseOzonePlatform,WaylandWindowDecorations,WebRTCPipeWireCapturer}}" \ + --set-default ELECTRON_IS_DEV 0 \ + --inherit-argv0 + + runHook postInstall + ''; + + # Do not attempt generating a tarball for vikunja-frontend again. + distPhase = '' + true + ''; + + passthru.updateScript = unstableGitUpdater { + url = "${src.meta.homepage}.git"; + }; + + # The desktop item properties should be kept in sync with data from upstream: + desktopItem = makeDesktopItem { + name = "vikunja-desktop"; + exec = executableName; + icon = "vikunja"; + desktopName = "Vikunja Desktop"; + genericName = "To-Do list app"; + comment = finalAttrs.meta.description; + categories = [ + "ProjectManagement" + "Office" + ]; + }; + + meta = with lib; { + description = "Desktop App of the Vikunja to-do list app"; + homepage = "https://vikunja.io/"; + license = licenses.gpl3Plus; + maintainers = with lib.maintainers; [ kolaente ]; + inherit (electron.meta) platforms; + }; +}) diff --git a/pkgs/by-name/vi/vikunja/package.nix b/pkgs/by-name/vi/vikunja/package.nix index 7948d5aa5e35b..ccc2f350a2ab6 100644 --- a/pkgs/by-name/vi/vikunja/package.nix +++ b/pkgs/by-name/vi/vikunja/package.nix @@ -122,7 +122,10 @@ buildGoModule { runHook postInstall ''; - passthru.tests.vikunja = nixosTests.vikunja; + passthru = { + tests.vikunja = nixosTests.vikunja; + frontend = frontend; + }; meta = { changelog = "https://kolaente.dev/vikunja/api/src/tag/v${version}/CHANGELOG.md";