Skip to content

Commit

Permalink
super-productivity: 10.0.11 -> 10.1.1, build from source
Browse files Browse the repository at this point in the history
  • Loading branch information
pineapplehunter committed Nov 12, 2024
1 parent fa72bc2 commit 00ac037
Showing 1 changed file with 91 additions and 29 deletions.
120 changes: 91 additions & 29 deletions pkgs/by-name/su/super-productivity/package.nix
Original file line number Diff line number Diff line change
@@ -1,51 +1,113 @@
{ stdenv , lib , fetchurl , appimageTools , makeWrapper , electron }:

stdenv.mkDerivation rec {
{
buildNpmPackage,
lib,
fetchFromGitHub,
electron,
makeDesktopItem,
super-productivity,
copyDesktopItems,
npm-lockfile-fix,
nix-update-script,
}:
buildNpmPackage rec {
pname = "super-productivity";
version = "10.0.11";
version = "10.1.1";

src = fetchurl {
url = "https://github.com/johannesjo/super-productivity/releases/download/v${version}/superProductivity-${version}.AppImage";
sha256 = "sha256-sYHfzqP/Vla0DEReVjaPvo8fe1wNdZnNDhefqPrPFPE=";
name = "${pname}-${version}.AppImage";
};
src = fetchFromGitHub {
owner = "johannesjo";
repo = "super-productivity";
rev = "v${version}";
hash = "sha256-4eTzt1c55Tqw80aDJPECMdTpazh5dNxTSsA0U51dCZY=";

appimageContents = appimageTools.extractType2 {
inherit pname version src;
postFetch = ''
${lib.getExe npm-lockfile-fix} -r $out/package-lock.json
'';
};

dontUnpack = true;
dontConfigure = true;
dontBuild = true;
npmDepsHash = "sha256-CGaIhsf7twbPf1PkE6arFIYC0nDZ7Jvs1ES6c7tQF80=";
npmFlags = [ "--legacy-peer-deps" ];
makeCacheWritable = true;

ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
CHROMEDRIVER_SKIP_DOWNLOAD = "true";

nativeBuildInputs = [ copyDesktopItems ];

postPatch = ''
# package.json does not include `core-js`
# and the comment suggests it is only needed
# on some mobile platforms
substituteInPlace src/polyfills.ts \
--replace-fail "import 'core-js/es/object';" ""
'';

nativeBuildInputs = [ makeWrapper ];
buildPhase = ''
runHook preBuild
npm run buildFrontend:prod:es6
npm run electron:build
npm exec electron-builder -- \
--dir \
-c.electronDist=${electron}/libexec/electron \
-c.electronVersion=${electron.version}
runHook postBuild
'';

installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/share/${pname} $out/share/applications
mkdir -p $out/share/super-productivity/{app,defaults,static/plugins,static/resources/plugins}
cp -r app-builds/*-unpacked/{locales,resources{,.pak}} "$out/share/super-productivity/app"
cp -a ${appimageContents}/{locales,resources} $out/share/${pname}
cp -a ${appimageContents}/superproductivity.desktop $out/share/applications/${pname}.desktop
cp -a ${appimageContents}/usr/share/icons $out/share
for size in 16 32 48 64 128 256 512 1024; do
local sizexsize="''${size}x''${size}"
mkdir -p $out/share/icons/hicolor/$sizexsize/apps
cp -v build/icons/$sizexsize.png \
$out/share/icons/hicolor/$sizexsize/apps/super-productivity.png
done
substituteInPlace $out/share/applications/${pname}.desktop \
--replace 'Exec=AppRun' 'Exec=${pname}'
makeWrapper '${lib.getExe electron}' "$out/bin/super-productivity" \
--add-flags "$out/share/super-productivity/app/resources/app.asar" \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
--set-default ELECTRON_FORCE_IS_PACKAGED 1 \
--inherit-argv0
runHook postInstall
'';

postFixup = ''
makeWrapper ${electron}/bin/electron $out/bin/${pname} \
--add-flags $out/share/${pname}/resources/app.asar
'';
# copied from deb file
desktopItems = [
(makeDesktopItem {
name = "super-productivity";
desktopName = "superProductivity";
exec = "super-productivity %u";
terminal = false;
type = "Application";
icon = "super-productivity";
startupWMClass = "superProductivity";
comment = builtins.replaceStrings [ "\n" ] [ " " ] super-productivity.meta.longDescription;
categories = [ "Utility" ];
})
];

passthru.updateScript = nix-update-script { };

meta = with lib; {
meta = {
description = "To Do List / Time Tracker with Jira Integration";
longDescription = ''
Experience the best ToDo app for digital professionals and get more done!
Super Productivity comes with integrated time-boxing and time tracking capabilities
and you can load your task from your calendars and from
Jira, Gitlab, GitHub, Open Project and others all into a single ToDo list.
'';
homepage = "https://super-productivity.com";
license = licenses.mit;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ offline ];
license = lib.licenses.mit;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [
offline
pineapplehunter
];
mainProgram = "super-productivity";
};
}

0 comments on commit 00ac037

Please sign in to comment.