2022-03-30 09:31:56 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchzip
|
|
|
|
, makeWrapper
|
|
|
|
, makeDesktopItem
|
|
|
|
, mkYarnPackage
|
|
|
|
, electron
|
|
|
|
, desktopToDarwinBundle
|
|
|
|
, copyDesktopItems
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
executableName = "micropad";
|
|
|
|
in
|
|
|
|
mkYarnPackage rec {
|
|
|
|
pname = "micropad";
|
2022-10-21 18:38:19 +00:00
|
|
|
version = "4.1.0";
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "MicroPad";
|
|
|
|
repo = "Micropad-Electron";
|
|
|
|
rev = "v${version}";
|
2022-10-21 18:38:19 +00:00
|
|
|
sha256 = "sha256-ity5oU6TCBpQgimoiaMswOV3FY7Z0GmBcFWqQzdYmao=";
|
2022-03-30 09:31:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
micropad-core = fetchzip {
|
|
|
|
url = "https://github.com/MicroPad/MicroPad-Core/releases/download/v${version}/micropad.tar.xz";
|
2022-10-21 18:38:19 +00:00
|
|
|
sha256 = "0br8lsdrbjkr5gl434r5ngdhbwbzhav94q8kizsixb8k0wwyfxy5";
|
2022-03-30 09:31:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
packageJSON = ./package.json;
|
|
|
|
yarnLock = ./yarn.lock;
|
|
|
|
yarnNix = ./yarn.nix;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ copyDesktopItems makeWrapper ]
|
|
|
|
++ lib.optionals stdenv.isDarwin [ desktopToDarwinBundle ];
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
pushd deps/micropad/
|
|
|
|
yarn --offline build
|
|
|
|
popd
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
# resources
|
|
|
|
mkdir -p "$out/share/"
|
|
|
|
cp -r './deps/micropad' "$out/share/micropad"
|
|
|
|
ln -s '${micropad-core}' "$out/share/micropad/core"
|
|
|
|
rm "$out/share/micropad/node_modules"
|
|
|
|
cp -r './node_modules' "$out/share/micropad"
|
|
|
|
|
|
|
|
# icons
|
|
|
|
for icon in $out/share/micropad/build/icons/*.png; do
|
|
|
|
mkdir -p "$out/share/icons/hicolor/$(basename $icon .png | sed -e 's/^icon-//')/apps"
|
|
|
|
ln -s "$icon" "$out/share/icons/hicolor/$(basename $icon .png | sed -e 's/^icon-//')/apps/micropad.png"
|
|
|
|
done
|
|
|
|
|
|
|
|
# executable wrapper
|
2022-08-12 12:06:08 +00:00
|
|
|
makeWrapper '${electron}/bin/electron' "$out/bin/${executableName}" \
|
2022-03-30 09:31:56 +00:00
|
|
|
--add-flags "$out/share/micropad" \
|
2022-10-06 18:32:54 +00:00
|
|
|
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Do not attempt generating a tarball for micropad again.
|
2022-06-16 17:23:12 +00:00
|
|
|
doDist = false;
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
|
|
# The desktop item properties should be kept in sync with data from upstream:
|
|
|
|
# https://github.com/MicroPad/MicroPad-Electron/blob/master/package.json
|
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = "micropad";
|
|
|
|
exec = "${executableName} %u";
|
|
|
|
icon = "micropad";
|
|
|
|
desktopName = "µPad";
|
|
|
|
startupWMClass = "µPad";
|
|
|
|
comment = meta.description;
|
|
|
|
categories = ["Office"];
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2022-09-22 12:36:57 +00:00
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "A powerful note-taking app that helps you organise + take notes without restrictions";
|
|
|
|
homepage = "https://getmicropad.com/";
|
|
|
|
license = licenses.mpl20;
|
|
|
|
maintainers = with maintainers; [rhysmdnz];
|
|
|
|
inherit (electron.meta) platforms;
|
|
|
|
};
|
|
|
|
}
|