Home

nur @main - refs - log -
-
https://git.jolheiser.com/nur.git
My NUR
tree log patch
feat: prospect-mail Signed-off-by: jolheiser <john.olheiser@gmail.com>
Signature
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEgqEQpE3xoo1QwJO/uFOtpdp7v3oFAmSq3VYACgkQuFOtpdp7 v3reeBAAoPL1ZdhVnEkCTWd1xgAqu+2cgn6l9orsdG6eTIKo/QNNt5L7YNTRd90V xwnnpN+V9oO+xQ5Z3pbou5TsRBTBDK6fqmUH/Oea2a2iZNnhw5G8Fh5p5R8wAU2G 8z64JDd56tgFaGbdD/oEyNHzZ6XlKp7tAVhT2JU9yULCB6BpKFYtVRWCX9sY+h/K eXYmLb18xil6AF5JwQZPQtk2nZEda9StYyhpZsN+HKya84fyMC9GDcP7uPgToYi7 EfYTBEmg3f3hhxPPGO4aFY7jZOz+TBs6LxVZj9WWSNw/mCLa0zHq+DenJX1cKiJ2 tThs0yf24U8JMsM3nYriamdZFXIq5Bn9TQqcSTMUZxt9Bkz458wzK8wymDSZo8JU a/gyM6TjK5ct1uX37DqIy+QRn3i0MDCGFZBvJRM0a5ZZvhwte9I5sd3XXy1Cy3e8 5alXk6FXvbxHyu8E9+B7dVfzNRTYJQ4iP7UpZdx3q16wqW/jTHUDb3BS4brOfOrb rvHMWDW3u5rGjQmEQI/kuzSeZEKeA/2oKLJfim9zmR5jLIXGj2C2muOC/VuodSey yw8l6D7RCkEJq8HrKHyoo+SmbX51xUA2NfkPwdljAfpmn3J4VNsa6jPXxWQ/u4ZM w7gGSXX50rQ8nXSZIwSgFoXqWeaJ9Yui1zLz7qDUVlNJI/odCxA= =LDF1 -----END PGP SIGNATURE-----
jolheiser <john.olheiser@gmail.com>
1 year ago
2 changed files, 112 additions(+), 5 deletions(-)
M default.nix -> default.nix
diff --git a/default.nix b/default.nix
index 973042a91fca407a34673a73f2d4b2b4c898da53..2d03df03bcbd697426c7ea57f28b9b70aba54ab6 100644
--- a/default.nix
+++ b/default.nix
@@ -5,16 +5,18 @@ # It should NOT import <nixpkgs>. Instead, you should take pkgs as an argument.
 # Having pkgs default to <nixpkgs> is fine though, and it lets you use short
 # commands such as:
 #     nix-build -A mypackage
-
-{ pkgs ? import <nixpkgs> { } }:
-
 # This file describes your repository contents.
+#     nix-build -A mypackage
   # The `lib`, `modules`, and `overlay` names are special
 # This file describes your repository contents.
-# It should return a set of nix derivations
+
   modules = import ./modules; # NixOS modules
   overlays = import ./overlays; # nixpkgs overlays
 
 # This file describes your repository contents.
-# Having pkgs default to <nixpkgs> is fine though, and it lets you use short
+{ pkgs ? import <nixpkgs> { } }:
+  tmpl = pkgs.callPackage ./pkgs/tmpl {};
+
+  # Other projects
+  prospect-mail = pkgs.callPackage ./pkgs/prospect-mail {};
 }
I pkgs/prospect-mail/default.nix
diff --git a/pkgs/prospect-mail/default.nix b/pkgs/prospect-mail/default.nix
new file mode 100644
index 0000000000000000000000000000000000000000..c2f4140d494f75fcc116beb83deebfcd3ac1797c
--- /dev/null
+++ b/pkgs/prospect-mail/default.nix
@@ -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"];
+    })
+  ];
+}