Merge pull request #164937 from rhysmdnz/micropad

This commit is contained in:
Sandro 2022-03-21 22:23:50 +01:00 committed by GitHub
commit 3cede648b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 4539 additions and 0 deletions

View File

@ -0,0 +1,101 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchzip
, makeWrapper
, makeDesktopItem
, mkYarnPackage
, electron
, desktopToDarwinBundle
, copyDesktopItems
}:
let
executableName = "micropad";
electron_exec =
if stdenv.isDarwin
then "${electron}/Applications/Electron.app/Contents/MacOS/Electron"
else "${electron}/bin/electron";
in
mkYarnPackage rec {
pname = "micropad";
version = "3.30.6";
src = fetchFromGitHub {
owner = "MicroPad";
repo = "Micropad-Electron";
rev = "v${version}";
sha256 = "sha256-v3hnHG6FMW2xBU/DnenqjFizQv/OZ9cW99n/3SoENe8=";
};
micropad-core = fetchzip {
url = "https://github.com/MicroPad/MicroPad-Core/releases/download/v${version}/micropad.tar.xz";
hash = "sha256-aqshYbVrQg6tYtTlO91FGiH7DuueOA0OU5KGCVc7XvI=";
};
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
makeWrapper '${electron_exec}' "$out/bin/${executableName}" \
--add-flags "$out/share/micropad" \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--enable-features=UseOzonePlatform --ozone-platform=wayland}}"
runHook postInstall
'';
# Do not attempt generating a tarball for micropad again.
# note: `doDist = false;` does not work.
distPhase = ''
true
'';
# 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"];
})
];
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;
};
}

View File

@ -0,0 +1,87 @@
{
"name": "micropad",
"version": "3.30.5",
"description": "A powerful note-taking app that helps you organise + take notes without restrictions.",
"main": "main.js",
"scripts": {
"start": "yarn build && yarn electron . --is-dev --no-sandbox",
"build": "yarn tsc -p tsconfig.json",
"update-core": "rm -rf core && rm -rf tmp && mkdir tmp && wget https://github.com/MicroPad/MicroPad-Core/releases/download/v${npm_package_version}/micropad.tar.xz -P ./tmp && cd tmp && tar -xf micropad.tar.xz && rm build/*.map && rm build/static/*/*.map && cp -r build ../core && cd .. && rm -rf tmp",
"pack": "yarn build && yarn electron-builder --dir",
"dist": "yarn build && yarn electron-builder"
},
"repository": {
"type": "git",
"url": "git+https://github.com/MicroPad/Electron.git"
},
"author": {
"name": "Nick Webster",
"email": "nick@nick.geek.nz"
},
"license": "MPL-2.0",
"bugs": {
"url": "https://github.com/MicroPad/Electron/issues"
},
"homepage": "https://getmicropad.com",
"devDependencies": {
"electron": "^17.1.0",
"electron-builder": "^23.0.2",
"typescript": "~4.5.4"
},
"dependencies": {
"dictionary-en": "^3.0.0",
"dictionary-en-au": "^2.1.1",
"electron-context-menu": "^3.1.2",
"localforage": "^1.10.0",
"typo-js": "^1.2.1"
},
"build": {
"appId": "com.getmicropad.micropad",
"productName": "µPad",
"publish": {
"provider": "github",
"releaseType": "release"
},
"asarUnpack": [
"preload.js"
],
"linux": {
"target": [
"tar.gz",
"AppImage",
"snap",
"deb",
"rpm",
"pacman"
],
"executableName": "micropad",
"category": "Office",
"icon": "build/icons"
},
"pacman": {
"depends": [
"gtk3"
]
},
"snap": {
"publish": {
"provider": "github",
"releaseType": "release"
}
},
"mac": {
"target": {
"target": "dmg",
"arch": "universal"
},
"category": "public.app-category.productivity",
"identity": null
},
"win": {
"target": [
"nsis",
"portable"
]
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -3538,6 +3538,10 @@ with pkgs;
metabase = callPackage ../servers/metabase { };
micropad = callPackage ../applications/office/micropad {
electron = electron_17;
};
midicsv = callPackage ../tools/audio/midicsv { };
miniscript = callPackage ../applications/blockchains/miniscript { };