Skip to content
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

[nix] Add nix derivation for static builds #21

Closed
wants to merge 1 commit into from
Closed

[nix] Add nix derivation for static builds #21

wants to merge 1 commit into from

Conversation

hswong3i
Copy link

@hswong3i hswong3i commented Jun 3, 2020

Utilize nix's .pkgsStatic for musl based statically linked binary.

Replacing gnutls with openssl for better musl support.

msmtp --version with following result:

msmtp version 1.8.10
Platform: x86_64-unknown-linux-musl
TLS/SSL library: OpenSSL
Authentication library: built-in
Supported authentication methods:
plain external cram-md5 login oauthbearer
IDN support: disabled
NLS: enabled, LOCALEDIR is /usr/share/locale
Keyring support: none
System configuration file name: /etc/msmtprc
User configuration file name: /home/hswong3i/.msmtprc

Copyright (C) 2020 Martin Lambers and others.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Signed-off-by: Wong Hoi Sing Edison [email protected]

Utilize nix's `.pkgsStatic` for musl based statically linked binary.

Replacing gnutls with openssl for better musl support.

`msmtp --version` with following result:

```
msmtp version 1.8.10
Platform: x86_64-unknown-linux-musl
TLS/SSL library: OpenSSL
Authentication library: built-in
Supported authentication methods:
plain external cram-md5 login oauthbearer
IDN support: disabled
NLS: enabled, LOCALEDIR is /usr/share/locale
Keyring support: none
System configuration file name: /etc/msmtprc
User configuration file name: /home/hswong3i/.msmtprc

Copyright (C) 2020 Martin Lambers and others.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
```

Signed-off-by: Wong Hoi Sing Edison <[email protected]>
@marlam
Copy link
Owner

marlam commented Jun 3, 2020

Hi, this pull request is probably not for msmtp, but for the nix project, right?

@marlam marlam closed this Jun 3, 2020
@hswong3i
Copy link
Author

hswong3i commented Jun 3, 2020

@marlam the nixpkgs have a version of msmtp: https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/msmtp/default.nix

But the target is for dynamically linked binary with nix independent folder structure; this PR is target to “use nix to compile msmtp as statically linked binary” so they are different.

As a msmtp and msmtpd user for more then year, with repackaging it into Ansible Role (https://github.com/alvistack/ansible-role-msmtp) and Docker image (https://github.com/alvistack/docker-msmtp) for Kubernetes use cases, current msmtp coming with some limitation:

  1. Only recent modern version with msmtpd support
  2. Most linux distributions are coming with legacy msmtp version ( some even without support...)
  3. In order to support as many OS as possible with Ansible Role with unified experience, currently my answer is compile latest msmtp from source code on every machine

Other detail reasons could be reference from here: containers/buildah#2380 (comment); providing a statically linked binary solution inside msmtp repo shouldn’t with negative drawbacks.

Moreover @marlam this PR also trigger some else improvements potential:

  1. gnutls, gsasl and libidn are not easy to compile statically with both glibc/musl, I would like to ask nixpkgs community for some help
  2. msmtp itself relay on libnss so not easy to compile statically with glibc, too

Therefore if we could improve about points and include those tricks inside msmtp repo, that could be a good reference for people who looking for similar solution, e.g. https://marlam.de/msmtp/old-mailinglist/msg00637.html

@marlam
Copy link
Owner

marlam commented Jun 4, 2020

We generally don't have package build rules as part of msmtp; it's source code only. It does not make sense to start including package build rules for the infinte number of systems, configurations, and use cases that exist. I would suggest to set up a repository and/or web site dedicated to your goals and host these packaging scripts there.

@hswong3i
Copy link
Author

hswong3i commented Jun 4, 2020

We generally don't have package build rules as part of msmtp; it's source code only. It does not make sense to start including package build rules for the infinte number of systems, configurations, and use cases that exist. I would suggest to set up a repository and/or web site dedicated to your goals and host these packaging scripts there.

Yes for sure: https://github.com/alvistack/msmtp/releases/tag/msmtp-1.8.10; I need it to simplify my daily life by simply download the statically linked binary; it may also useful as part of msmtp official release since now a day most project provide it as baseline failsafe alternative installation method ;-)

BTW, could I request for some help to compile msmtp + gnutls + gsasl + libidn + glibc here? As a repackager it is not simple for handle it...

@marlam
Copy link
Owner

marlam commented Jun 4, 2020

I can help with msmtp, but not with the rest. Note that you typically do not need gsasl anymore (only for GSSAPI authentication) and with recent glibc and gnutls versions you also do not need libidn anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants