1
0
Fork 0

feat: prospect-mail

Signed-off-by: jolheiser <john.olheiser@gmail.com>
main
jolheiser 2023-07-09 11:16:22 -05:00
parent 7b4d9fc2d9
commit a0eb64bbfa
Signed by: jolheiser
GPG Key ID: B853ADA5DA7BBF7A
2 changed files with 112 additions and 6 deletions

View File

@ -5,14 +5,15 @@
# Having pkgs default to <nixpkgs> is fine though, and it lets you use short
# commands such as:
# nix-build -A mypackage
{ pkgs ? import <nixpkgs> { } }:
{
{pkgs ? import <nixpkgs> {}}: {
# The `lib`, `modules`, and `overlay` names are special
lib = import ./lib { inherit pkgs; }; # functions
lib = import ./lib {inherit pkgs;}; # functions
modules = import ./modules; # NixOS modules
overlays = import ./overlays; # nixpkgs overlays
tmpl = pkgs.callPackage ./pkgs/tmpl { };
# Personal projects
tmpl = pkgs.callPackage ./pkgs/tmpl {};
# Other projects
prospect-mail = pkgs.callPackage ./pkgs/prospect-mail {};
}

View File

@ -0,0 +1,105 @@
{
lib,
stdenv,
fetchFromGitHub,
makeWrapper,
makeDesktopItem,
copyDesktopItems,
nodejs_18,
fetchYarnDeps,
fixup_yarn_lock,
electron,
libpulseaudio,
pipewire,
alsa-utils,
which,
}:
stdenv.mkDerivation rec {
pname = "prospect-mail";
version = "0.5.2";
src = fetchFromGitHub {
owner = "jolheiser";
repo = pname;
rev = "v${version}";
sha256 = "sha256-ptbxXYWwvalkC1PdCRUbtj23KrAv42HhUS6EUhLgjNY=";
};
offlineCache = fetchYarnDeps {
yarnLock = "${src}/yarn.lock";
sha256 = "sha256-tenHW93GF9rQs9AyEv4Nkike0IAry3qI+geZ5LKbrgo=";
};
nativeBuildInputs = [nodejs_18.pkgs.yarn fixup_yarn_lock nodejs_18 copyDesktopItems makeWrapper];
configurePhase = ''
runHook preConfigure
export HOME=$(mktemp -d)
yarn config --offline set yarn-offline-mirror $offlineCache
fixup_yarn_lock yarn.lock
yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
patchShebangs node_modules/
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
yarn --offline electron-builder \
--dir ${
if stdenv.isDarwin
then "--macos"
else "--linux"
} ${
if stdenv.hostPlatform.isAarch64
then "--arm64"
else "--x64"
} \
-c.electronDist=${electron}/lib/electron \
-c.electronVersion=${electron.version}
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/share/{applications,prospect-mail}
cp dist/${
if stdenv.isDarwin
then "darwin-"
else "linux-"
}${lib.optionalString stdenv.hostPlatform.isAarch64 "arm64-"}unpacked/resources/app.asar $out/share/prospect-mail/
pushd build/icons
for image in *png; do
mkdir -p $out/share/icons/hicolor/''${image%.png}/apps
cp -r $image $out/share/icons/hicolor/''${image%.png}/apps/prospect-mail.png
done
popd
# Linux needs 'aplay' for notification sounds, 'libpulse' for meeting sound, and 'libpipewire' for screen sharing
makeWrapper '${electron}/bin/electron' "$out/bin/prospect-mail" \
${lib.optionalString stdenv.isLinux ''
--prefix PATH : ${lib.makeBinPath [alsa-utils which]} \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [libpulseaudio pipewire]} \
''} \
--add-flags "$out/share/prospect-mail/app.asar" \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"
runHook postInstall
'';
desktopItems = [
(makeDesktopItem {
name = pname;
exec = pname;
icon = pname;
desktopName = "Outlook for Linux";
comment = "Outlook wrapper client for Linux";
categories = ["Network" "Email"];
})
];
}