Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 61 additions & 26 deletions pkgs/by-name/si/sieve-editor-gui/package.nix
Original file line number Diff line number Diff line change
@@ -1,42 +1,75 @@
{
lib,
stdenv,
buildNpmPackage,
fetchFromGitHub,
electron,
nodejs_20,
nodePackages,
makeDesktopItem,
copyDesktopItems,
runCommand,
zip,
}:

let
electronArch = if stdenv.hostPlatform.isAarch64 then "arm64" else "x64";
electronZip =
runCommand "electronZip"
{
nativeBuildInputs = [ zip ];
}
''
mkdir $out

cp -r ${electron.dist} electron-dist
chmod -R u+w electron-dist

cd electron-dist
zip -0Xqr $out/electron-v${electron.version}-darwin-${electronArch}.zip .
'';
in

buildNpmPackage {
pname = "sieve-editor-gui";
version = "0.6.1-unstable-2024-01-06";
nodejs = nodejs_20;
version = "0.6.1-unstable-2025-03-12";

src = fetchFromGitHub {
owner = "thsmi";
repo = "sieve";
rev = "5879679ed8d16a34af760ee56bfec16a1a322b4e";
hash = "sha256-wl6dwKoGan+DrpXk2p1fD/QN/C2qT4h/g3N73gF8sOI=";
rev = "4bcefba15314177521a45a833e53969b50f4351e";
hash = "sha256-jR3+YaVQ+Yd2Xm40SzQNvwWMPe0mJ6bhT96hlUz3/qU=";
};

npmDepsHash = "sha256-a2I9csxFZJekG1uCOHqdRaLLi5v/BLTz4SU+uBd855A=";
npmDepsHash = "sha256-w2i7XsTx3hlsh/JbvShaxvDyFGcBpL66lMy7KL2tnzM=";

nativeBuildInputs = [
electron
copyDesktopItems
nodePackages.gulp
];
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ copyDesktopItems ];

dontNpmBuild = true;

buildPhase = ''
gulp -LLLL app:package
'';
npmBuildScript = "gulp";
npmBuildFlags = [ "app:package" ];

installPhase = ''
runHook preInstall
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
mv build/ $out

install -D $out/electron/resources/libs/icons/linux.png $out/share/icons/hicolor/64x64/apps/sieve.png

makeWrapper ${lib.getExe electron} $out/bin/sieve-editor-gui \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \
--add-flags $out/electron/resources/main_esm.js
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
npx electron-packager ./build/electron/resources \
--electron-zip-dir ${electronZip} \
--electron-version ${electron.version} \
--icon src/common/icons/mac.icns

mkdir -p $out/Applications
cp -r sieve-darwin-*/sieve.app $out/Applications/

makeWrapper $out/Applications/sieve.app/Contents/MacOS/Sieve $out/bin/sieve-editor-gui
''
+ ''
runHook postInstall
'';

Expand All @@ -49,22 +82,24 @@ buildNpmPackage {
name = "sieve-editor-gui";
exec = "sieve-editor-gui";
desktopName = "Sieve Editor";
icon = "sieve-editor-gui";
categories = [ "Utility" ];
icon = "sieve";
categories = [
"Utility"
"Email"
];
comment = "Tool to Manage Sieve Message Filters";
})
];

postInstall = ''
makeWrapper ${lib.getExe electron} $out/bin/sieve-editor-gui \
--add-flags $out/electron/resources/main_esm.js
'';

meta = {
description = "Activate, edit, delete and add Sieve scripts with a convenient interface";
homepage = "https://github.com/thsmi/sieve";
license = lib.licenses.agpl3Only;
maintainers = with lib.maintainers; [ Silver-Golden ];
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [
Silver-Golden
fugi
];
mainProgram = "sieve-editor-gui";
inherit (electron.meta) platforms;
};
}
Loading