You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.2 KiB

{ lib, fetchgit
, makeWrapper, makeDesktopItem, mkYarnPackage, callPackage
, electron_12
}:
let
executableName = "vikunja-desktop";
version = "unstable";
src = fetchgit {
url = "https://kolaente.dev/vikunja/desktop.git";
rev = "03402a65dc99efe3eeacc952cfc59eb9551709a1";
sha256 = "1bqix2my5sz4nlldrk0lvcw7xsb7135s9sgkjgd6l9z4s5xw7r3i";
};
electron = electron_12;
vikunja-frontend = callPackage ./frontend {};
in mkYarnPackage rec {
name = "vikunja-desktop-${version}";
inherit version src;
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
# resources
mkdir -p "$out/share/vikunja"
cp -r './deps/vikunja-desktop' "$out/share/vikunja/electron"
rm "$out/share/vikunja/electron/node_modules"
cp -r './node_modules' "$out/share/vikunja/electron"
ln -s '${vikunja-frontend}' "$out/share/vikunja/electron/frontend"
# icons
for icon in $out/share/vikunja/electron/build/icons/*.png; do
mkdir -p "$out/share/icons/hicolor/$(basename $icon .png)/apps"
ln -s "$icon" "$out/share/icons/hicolor/$(basename $icon .png)/apps/vikunja.png"
done
# desktop item
mkdir -p "$out/share"
ln -s "${desktopItem}/share/applications" "$out/share/applications"
# executable wrapper
makeWrapper '${electron}/bin/electron' "$out/bin/${executableName}" \
--add-flags "$out/share/vikunja/electron"
'';
# Do not attempt generating a tarball for vikunja-frontend again.
# note: `doDist = false;` does not work.
distPhase = ''
true
'';
# 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 = meta.description;
categories = "ProjectManagement;Office;";
extraEntries = ''
StartupWMClass=vikunja
'';
};
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;
};
}