nixpkgs/pkgs/by-name/to/todoist-electron/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

44 lines
1.5 KiB
Nix

{ lib, appimageTools, fetchurl, asar }: let
pname = "todoist-electron";
version = "9.8.0";
src = fetchurl {
url = "https://electron-dl.todoist.com/linux/Todoist-linux-${version}-x86_64-latest.AppImage";
hash = "sha256-ZuoeeQ7SusRhr5BXBYEWCZ9pjdcWClKoR0mnom1XkPg=";
};
appimageContents = (appimageTools.extract { inherit pname version src; }).overrideAttrs (oA: {
buildCommand = ''
${oA.buildCommand}
# Get rid of the autoupdater
${asar}/bin/asar extract $out/resources/app.asar app
sed -i 's/async isUpdateAvailable.*/async isUpdateAvailable(updateInfo) { return false;/g' app/node_modules/electron-updater/out/AppUpdater.js
${asar}/bin/asar pack app $out/resources/app.asar
'';
});
in appimageTools.wrapAppImage {
inherit pname version;
src = appimageContents;
extraPkgs = pkgs: [ pkgs.hidapi ];
extraInstallCommands = ''
# Add desktop convencience stuff
install -Dm444 ${appimageContents}/todoist.desktop -t $out/share/applications
install -Dm444 ${appimageContents}/todoist.png -t $out/share/pixmaps
substituteInPlace $out/share/applications/todoist.desktop \
--replace 'Exec=AppRun' "Exec=$out/bin/${pname} --"
'';
meta = with lib; {
homepage = "https://todoist.com";
description = "Official Todoist electron app";
platforms = [ "x86_64-linux" ];
license = licenses.unfree;
maintainers = with maintainers; [ kylesferrazza pokon548 ];
mainProgram = "todoist-electron";
};
}