Skip to content

nylas-mail: 2.0.32 #25600

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jul 6, 2017
Merged

nylas-mail: 2.0.32 #25600

merged 13 commits into from
Jul 6, 2017

Conversation

johnramsden
Copy link
Member

@johnramsden johnramsden commented May 7, 2017

Nylas-Mail

Packaged up the email client Nylas-Mail.

An open-source mail client built on the modern web with Electron, React, and Flux. It is designed to be extensible, so it's easy to create new experiences and workflows around email

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Sorry, something went wrong.

Added new email client Nylas-Mail.
@pSub pSub added the 8.has: package (new) This PR adds a new package label May 8, 2017
Onboard was left in accidentally.
@rht
Copy link
Member

rht commented May 10, 2017

(Thank you very much for making this PR!!!! In the past, I had been trying to patchelf the binaries to no avail, tried several times. I thought it was not possible, but here we are)

meta = {
description = "Nylas Mail is an open-source mail client built on the modern web with Electron, React, and Flux. It is designed to be extensible, so it's easy to create new experiences and workflows around email.";
license = stdenv.lib.licenses.gpl3;
homepage = https://nylas.com;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you want to maintain this package?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I don't have any experience maintaining a package so i'm not sure what it entails, but I'll give it a shot.

@rht
Copy link
Member

rht commented May 10, 2017

I keep getting this error message:

message: 'Password Management Error: We couldn\'t store your password securely! For more information, visit https://support.nylas.com/hc/en-us/articles/223790028'

@johnramsden
Copy link
Member Author

@rht Yes, it was challenging to get working, it had quite a few requirements.

Regarding your error message, It requires gnome keyring to be running.

I had to set services.gnome3.gnome-keyring.enable = true;

@a4d442663580
Copy link

Verified: I have reproduced the build and tested linking an account successfully.
Thank you very much, @johnramsden

meta = with stdenv.lib; {
description = "pen-source mail client built on the modern web with Electron, React, and Flux";
longDescription = ''
Nylas Mail is an open-source mail client built on the modern web with Electron, React, and Flux. It is designed to be extensible, so it's easy to create new experiences and workflows around email. Nylas-Mail requires gnome3 keyring. It can be enabled with "services.gnome3.gnome-keyring.enable = true;".
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last two sents should be put in a new line. As it is currently (buried down), it is easy for people to miss.

I think the statement should be more imperative, as it is required to have the daemon running after all.
"To run nylas-mail, an additional manual step is required. Make sure to have services.gnome3.gnome-keyring.enable = true; in your configuration.nix before running nylas-mail. If you happen to miss this step, you should remove ~/.nylas-mail and ~/.config/Nylas\ Mail for a blank setup".

'';

meta = with stdenv.lib; {
description = "pen-source mail client built on the modern web with Electron, React, and Flux";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(truncated description)

@apeyroux
Copy link
Member

apeyroux commented May 31, 2017

Hello, thx for your pr. I propose :

@@ -38,10 +38,14 @@ stdenv.mkDerivation rec {
    version = "2.0.31";
    subVersion = "e675deb";
 
-   src = fetchurl {
-     url = "https://edgehill.s3-us-west-2.amazonaws.com/${version}-${subVersion}/linux-deb/x64/NylasMail.deb";
-     sha256 = "b036956174f998bd4a2662a1f59cb4a302465b3ed06c487de88ff2721e372f6e";
-   };
+   src =
+   if stdenv.system == "x86_64-linux" then
+     fetchurl {
+       url = "https://edgehill.s3-us-west-2.amazonaws.com/${version}-${subVersion}/linux-deb/x64/NylasMail.deb";
+       sha256 = "b036956174f998bd4a2662a1f59cb4a302465b3ed06c487de88ff2721e372f6e";
+     }
+   else
+     throw "NylasMail is not supported on ${stdenv.system}";
@@ -134,5 +138,6 @@ stdenv.mkDerivation rec {
      license = licenses.gpl3;
      maintainers = with maintainers; [ johnramsden ];
      homepage = https://nylas.com;
+     platforms = [ "x86_64-linux" ];
    };
 }

and today version is 2.0.32-fec7941.

regards

@apeyroux
Copy link
Member

apeyroux commented May 31, 2017

Check indentation and sort name

diff --git a/pkgs/applications/networking/mailreaders/nylas-mail/default.nix b/pkgs/applications/networking/mailreaders/nylas-mail/default.nix
index 6816c49033c..7c3ee456f25 100644
--- a/pkgs/applications/networking/mailreaders/nylas-mail/default.nix
+++ b/pkgs/applications/networking/mailreaders/nylas-mail/default.nix
@@ -1,30 +1,35 @@
-{ dpkg, fetchurl, lib, pkgs, stdenv, config
+{ config
+, stdenv
+, pkgs
+, fetchurl
+, dpkg
+, lib
+, gnome2
+, libgnome_keyring
+, desktop_file_utils
+, python2
+, nodejs
+, libnotify
 , alsaLib
 , atk
+, glib
+, pango
+, gdk_pixbuf
 , cairo
-, coreutils
-, cups
-, dbus
-, desktop_file_utils
-, expat
-, fontconfig
 , freetype
-, gcc-unwrapped
-, gdk_pixbuf
-, glib
-, gnome2
-, libgcrypt
-, libgnome_keyring
-, libnotify
-, makeWrapper
-, nodejs
-, nspr
+, fontconfig
+, dbus
 , nss
-, pango
-, python2
-, udev
+, nspr
+, cups
+, expat
 , wget
+, udev
 , xorg
+, libgcrypt
+, makeWrapper
+, gcc-unwrapped
+, coreutils
 }:
 
 stdenv.mkDerivation rec {
@@ -33,52 +38,48 @@ stdenv.mkDerivation rec {
    version = "2.0.31";
    subVersion = "e675deb";
 
-   src =
-   if stdenv.system == "x86_64-linux" then
-     fetchurl {
-       url = "https://edgehill.s3-us-west-2.amazonaws.com/${version}-${subVersion}/linux-deb/x64/NylasMail.deb";
-       sha256 = "b036956174f998bd4a2662a1f59cb4a302465b3ed06c487de88ff2721e372f6e";
-     }
-   else
-     throw "NylasMail is not supported on ${stdenv.system}";
+   src = fetchurl {
+     url = "https://edgehill.s3-us-west-2.amazonaws.com/${version}-${subVersion}/linux-deb/x64/NylasMail.deb";
+     sha256 = "b036956174f998bd4a2662a1f59cb4a302465b3ed06c487de88ff2721e372f6e";
+   };
 
    # Build dependencies
    propagatedBuildInputs = [
+     gnome2.gtk
+     gnome2.GConf
+     libgnome_keyring
+     desktop_file_utils
+     python2
+     nodejs
+     libnotify
      alsaLib
      atk
+     glib
+     pango
+     gdk_pixbuf
      cairo
-     coreutils
-     cups
-     dbus
-     desktop_file_utils
-     expat
-     fontconfig
      freetype
-     gcc-unwrapped
-     gdk_pixbuf
-     glib
-     gnome2.GConf
-     gnome2.gtk
-     libgnome_keyring
-     libnotify
-     nodejs
-     nspr
+     fontconfig
+     dbus
      nss
-     pango
-     python2
-     udev
+     nspr
+     cups
+     expat
      wget
-     xorg.libX11
+     udev
+     gcc-unwrapped
+     coreutils
      xorg.libXScrnSaver
-     xorg.libXcomposite
+     xorg.libXi
+     xorg.libXtst
      xorg.libXcursor
      xorg.libXdamage
+     xorg.libXrandr
+     xorg.libXcomposite
      xorg.libXext
      xorg.libXfixes
-     xorg.libXi
-     xorg.libXrandr
      xorg.libXrender
-     xorg.libXtst
+     xorg.libX11
      xorg.libxkbfile
    ];
 
@@ -88,59 +89,50 @@ stdenv.mkDerivation rec {
    phases = [ "unpackPhase" ];
 
    unpackPhase = ''
-     mkdir -p $out
+    mkdir -p $out
 
-     ${dpkg}/bin/dpkg-deb -x $src unpacked
-     mv unpacked/usr/* $out/
+    ${dpkg}/bin/dpkg-deb -x $src unpacked
+    mv unpacked/usr/* $out/
 
-     # Fix path in desktop file
-     substituteInPlace $out/share/applications/nylas-mail.desktop \
-       --replace /usr/bin/nylas-mail $out/bin/nylas-mail
+    # Fix path in desktop file
+    substituteInPlace $out/share/applications/nylas-mail.desktop \
+        --replace /usr/bin/nylas-mail $out/bin/nylas-mail
 
      # Patch librariess
      noderp=$(patchelf --print-rpath $out/share/nylas-mail/libnode.so)
      patchelf --set-rpath $noderp:$out/lib:${stdenv.cc.cc.lib}/lib:${xorg.libxkbfile.out}/lib:${lib.makeLibraryPath propagatedBuildInputs } \
-       $out/share/nylas-mail/libnode.so
+         $out/share/nylas-mail/libnode.so
 
      ffrp=$(patchelf --print-rpath $out/share/nylas-mail/libffmpeg.so)
      patchelf --set-rpath $ffrp:$out/lib:${stdenv.cc.cc.lib}/lib:${lib.makeLibraryPath propagatedBuildInputs } \
-       $out/share/nylas-mail/libffmpeg.so
+         $out/share/nylas-mail/libffmpeg.so
 
      # Patch binaries
      binrp=$(patchelf --print-rpath $out/share/nylas-mail/nylas)
      patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
-       --set-rpath $binrp:$out/lib:${stdenv.cc.cc.lib}/lib:${lib.makeLibraryPath propagatedBuildInputs } \
-       $out/share/nylas-mail/nylas
+         --set-rpath $binrp:$out/lib:${stdenv.cc.cc.lib}/lib:${lib.makeLibraryPath propagatedBuildInputs } \
+         $out/share/nylas-mail/nylas
 
-     wrapProgram $out/share/nylas-mail/nylas \
-       --set LD_LIBRARY_PATH "${xorg.libxkbfile}/lib:${pkgs.gnome3.libgnome_keyring}/lib";
+    wrapProgram $out/share/nylas-mail/nylas --set LD_LIBRARY_PATH "${xorg.libxkbfile}/lib:${pkgs.gnome3.libgnome_keyring}/lib";
 
-     # Fix path to bash so apm can install plugins.
-     substituteInPlace $out/share/nylas-mail/resources/apm/bin/apm \
-       --replace /bin/bash ${stdenv.shell}
+    # Fix path to bash so apm can install plugins.
+    substituteInPlace $out/share/nylas-mail/resources/apm/bin/apm \
+          --replace /bin/bash ${stdenv.shell}
 
-     wrapProgram $out/share/nylas-mail/resources/apm/bin/apm \
-       --set PATH "${coreutils}/bin"
-     patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
-       --set-rpath ${gcc-unwrapped.lib}/lib \
-         $out/share/nylas-mail/resources/apm/bin/node
+    wrapProgram $out/share/nylas-mail/resources/apm/bin/apm \
+        --set PATH "${coreutils}/bin"
+    patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
+             --set-rpath ${gcc-unwrapped.lib}/lib \
+        $out/share/nylas-mail/resources/apm/bin/node
    '';
 
    meta = with stdenv.lib; {
      description = "Open-source mail client built on the modern web with Electron, React, and Flux";
      longDescription = ''
-       Nylas Mail is an open-source mail client built on the modern web with Electron, React, and Flux. 
-       It is designed to be extensible, so it's easy to create new experiences and workflows around email. 
-
-       To run nylas-mail, an additional manual step is required. Make sure to have
-       services.gnome3.gnome-keyring.enable = true; 
-       in your configuration.nix before running nylas-mail. 
-
-       If you happen to miss this step, you should remove ~/.nylas-mail and "~/.config/Nylas Mail" for a blank setup".
+        Nylas Mail is an open-source mail client built on the modern web with Electron, React, and Flux. It is designed to be extensible, so it's easy to create new experiences and workflows around email. To run nylas-mail, an additional manual step is required. Make sure to have services.gnome3.gnome-keyring.enable = true; in your configuration.nix before running nylas-mail. If you happen to miss this step, you should remove ~/.nylas-mail and "~/.config/Nylas Mail" for a blank setup".
      '';
      license = licenses.gpl3;
      maintainers = with maintainers; [ johnramsden ];
      homepage = https://nylas.com;
-     platforms = [ "x86_64-linux" ];
    };
 }

@johnramsden
Copy link
Member Author

Thanks @apeyroux I added the changes and bumped the version.

@johnramsden johnramsden changed the title nylas-mail: 2.0.31 nylas-mail: 2.0.32 Jun 1, 2017
# Runtime dependencies
buildInputs = [ makeWrapper gnome2.gnome_keyring ];

phases = [ "unpackPhase" ];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider using buildCommand instead of phases & unpackPhase.

python2
udev
wget
xorg.libX11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider passing the xorg packages explicitly, callPackage has them in scope and will be able to fill them in.

Copy link
Member Author

@johnramsden johnramsden Jun 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joachifm What do you mean by passing them in explicitly? Are you talking about where I list them as library paths in ${lib.makeLibraryPath propagatedBuildInputs }?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing them as parameters to the expression

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, could you elaborate? Isn't that what i'm currently doing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. You're passing the entire xorg package set to the expression. What I'm saying is instead of accessing xorg.libX11, pass libX11 to the expression directly. Putting things in propagatedBuildInputs has nothing to do with it (nor is it really appropriate).

Copy link
Member Author

@johnramsden johnramsden Jun 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in?:

  propagatedBuildInputs = with xorg; [
    alsaLib
    atk
    cairo
    coreutils
    cups
    dbus
    desktop_file_utils
    expat
    fontconfig
    freetype
    gcc-unwrapped
    gdk_pixbuf
    glib
    gnome2.GConf
    gnome2.gtk
    libgnome_keyring
    libnotify
    nodejs
    nspr
    nss
    pango
    python2
    udev
    wget
    libX11
    libXScrnSaver
    libXcomposite
    libXcursor
    libXdamage
    libXext
    libXfixes
    libXi
    libXrandr
    libXrender
    libXtst
    libxkbfile
  ];

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Nevermind.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joachifm If you were talking about the lib.makeLibraryPath section I could do this, I just passed in the propagatedBuildInputs because they were the right packages.

else
throw "NylasMail is not supported on ${stdenv.system}";

# Build dependencies
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Input propagation refers to build environments not runtime.

xorg.libxkbfile
];

# Runtime dependencies
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makeWrapper could in fact be nativeBuildInputs


# Patch binaries
binrp=$(patchelf --print-rpath $out/share/nylas-mail/nylas)
patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIX_CC needs quotes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I'm mistaken, I don't believe it does. Right now the entire cat command gets quoted and that's how it appears to be done everywhere I looked. Is there a problem with how it is currently?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnramsden You are mistaken. Experiment in your terminal if you want or just add the quotes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0xABAB It works both ways for me in my terminal.

If you search for NIX_CC there seems to be hundreds of packages that are doing it the same way I am.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnramsden Compare
sometestcommand "$(NIX_CC='look here are spaces' cat $NIX_CC/nix-support/dynamic-linker)"
vs
sometestcommand "$(NIX_CC='look here are spaces' cat "$NIX_CC"/nix-support/dynamic-linker)"

Regarding your last comment; correctness is not a democracy.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I am aware, I was just wondering if all the other packages were doing it wrong as well.

It seems to work fine for me, maybe I'm misinterpreting what you're saying but this is what I get:

$ NIX_CC=/nix/store/b43ww9wkpwjxha7ql7mizxpa2vb6yk5r-gcc-wrapper-5.4.0
$ echo "$(cat $NIX_CC/nix-support/dynamic-linker)" 
/nix/store/7crrmih8c52r8fbnqb933dxrsp44md93-glibc-2.25/lib/ld-linux-x86-64.so.2
$ echo $(cat "$NIX_CC"/nix-support/dynamic-linker) 
/nix/store/7crrmih8c52r8fbnqb933dxrsp44md93-glibc-2.25/lib/ld-linux-x86-64.so.2

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIX_CC does not need quotes (though it doesn't hurt). No sane person would set the store prefix to something containing whitespace.

meta = with stdenv.lib; {
description = "Open-source mail client built on the modern web with Electron, React, and Flux";
longDescription = ''
Nylas Mail is an open-source mail client built on the modern web with Electron, React, and Flux. It is designed to be extensible, so it's easy to create new experiences and workflows around email. To run nylas-mail, an additional manual step is required. Make sure to have services.gnome3.gnome-keyring.enable = true; in your configuration.nix before running nylas-mail. If you happen to miss this step, you should remove ~/.nylas-mail and "~/.config/Nylas Mail" for a blank setup".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add a module for NixOS, such that people don't need to care about knowing about implementation details like enabling a key ring.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I added a module. I'm still working on the configuration, let me know if you have any recommendations.

src =
if stdenv.system == "x86_64-linux" then
fetchurl {
url = "https://edgehill.s3-us-west-2.amazonaws.com/${version}-${subVersion}/linux-deb/x64/NylasMail.deb";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More users would be interested in packages built by Nix infrastructure, not some binary package created by some random person.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is coming straight from them, not some random person. I tried to build it from source but there is a lot involved. You're welcome to create a package that builds it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In risk management terms, it means that we are broadening the number of people who we need to trust and that's a bad thing in most environments. If I say "random person", that's what I meant. Having said that, I am of course happy that you made the effort to provided more than there was before, so it's an improvement. Your effort has probably made it easier to package it from source now, so thanks for your efforts again.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course. I too would prefer to have it built by Nixpkgs. If I get the chance to look at it again, maybe I'll see if I can get it to build.

@0xABAB
Copy link
Contributor

0xABAB commented Jun 28, 2017

I am happy with how this is progressing.

@@ -15910,6 +15910,8 @@ with pkgs;

thinkingRock = callPackage ../applications/misc/thinking-rock { };

nylas-mail = callPackage ../applications/networking/mailreaders/nylas-mail { };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe call it nylas-mail-bin?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@7c6f434c Even though there's no other version? Wont that be confusing for users?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure: it could remind that it is a binary patching and maybe incentivise someone to do a source build (and adding a source build would not be confusing in this case)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, i'll change it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please ping me when you do — GitHub PR update notifications are either buggy or non-existent, not sure which

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@7c6f434c Done.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you have missed the attribute name in all-packages.nix

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops. Thanks.

One other thing, this is my first time creating a module for a package - someone might want to look it over to make sure everything looks alright.

Change pkg in module, and name in pkg.
@7c6f434c 7c6f434c merged commit 05aa2a5 into NixOS:master Jul 6, 2017
@johnramsden
Copy link
Member Author

nylas-mail has since been sunsetted and discontinued, there is a fork called mailspring that is a rewrite in C++, and a fork called nylas-mail-lives. As a result, I was wondering if this package should be removed from nixpkgs.

@johnramsden johnramsden deleted the nylas-mail branch November 23, 2017 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.has: package (new) This PR adds a new package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet