From d460e9ff62ea1238fb3348a87326b743ae177902 Mon Sep 17 00:00:00 2001 From: Nigel Bray Date: Sun, 1 Jan 2023 17:38:07 +0000 Subject: [PATCH] Fix and improve the setup guide --- README.md | 43 ++++--------------------------------------- docs/setup-guide.rst | 27 +++++++++++++++------------ 2 files changed, 19 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index cf8bbc2..5e8db21 100644 --- a/README.md +++ b/README.md @@ -71,46 +71,11 @@ can stay up to date with bug fixes and updates. - Subscribe to the [mailing list](https://www.freelists.org/archive/snm/) - Join the Libera Chat IRC channel `#nixos-mailserver` -### Quick Start - -```nix - { config, pkgs, ... }: - let release = "nixos-21.11"; - in { - imports = [ - (builtins.fetchTarball { - url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/${release}/nixos-mailserver-${release}.tar.gz"; - # This hash needs to be updated - sha256 = "0000000000000000000000000000000000000000000000000000"; - }) - ]; - - mailserver = { - enable = true; - fqdn = "mail.example.com"; - domains = [ "example.com" "example2.com" ]; - loginAccounts = { - "user1@example.com" = { - # nix-shell -p mkpasswd --run 'mkpasswd -sm bcrypt' > /hashed/password/file/location - hashedPasswordFile = "/hashed/password/file/location"; - - aliases = [ - "info@example.com" - "postmaster@example.com" - "postmaster@example2.com" - ]; - }; - }; - }; - } -``` - -For a complete list of options, see `default.nix`. - - - ## How to Set Up a 10/10 Mail Server Guide -Check out the [Complete Setup Guide](https://nixos-mailserver.readthedocs.io/en/latest/setup-guide.html) in the project's documentation. + +Check out the [Setup Guide](https://nixos-mailserver.readthedocs.io/en/latest/setup-guide.html) in the project's documentation. + +For a complete list of options, [see in readthedocs](https://nixos-mailserver.readthedocs.io/en/latest/options.html). ## Development diff --git a/docs/setup-guide.rst b/docs/setup-guide.rst index c74a53d..dafe60c 100644 --- a/docs/setup-guide.rst +++ b/docs/setup-guide.rst @@ -48,18 +48,19 @@ Setup the server ~~~~~~~~~~~~~~~~ The following describes a server setup that is fairly complete. Even -though there are more possible options (see the ``default.nix`` file), -these should be the most common ones. +though there are more possible options (see the `NixOS Mailserver +options documentation `_), these should be the most +common ones. .. code:: nix - { config, pkgs, ... }: - { + { config, pkgs, ... }: { imports = [ (builtins.fetchTarball { - # Pick a commit from the branch you are interested in - url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/A-COMMIT-ID/nixos-mailserver-A-COMMIT-ID.tar.gz"; - # And set its hash + # Pick a release version you are interested in and set its hash, e.g. + url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/nixos-23.05/nixos-mailserver-nixos-23.05.tar.gz"; + # To get the sha256 of the nixos-mailserver tarball, we can use the nix-prefetch-url command: + # release="nixos-23.05"; nix-prefetch-url "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/${release}/nixos-mailserver-${release}.tar.gz" --unpack sha256 = "0000000000000000000000000000000000000000000000000000"; }) ]; @@ -72,17 +73,19 @@ these should be the most common ones. # A list of all login accounts. To create the password hashes, use # nix-shell -p mkpasswd --run 'mkpasswd -sm bcrypt' loginAccounts = { - "user1@example.com" = { - hashedPasswordFile = "/a/file/containing/a/hashed/password"; - aliases = ["postmaster@example.com"]; - }; - "user2@example.com" = { ... }; + "user1@example.com" = { + hashedPasswordFile = "/a/file/containing/a/hashed/password"; + aliases = ["postmaster@example.com"]; + }; + "user2@example.com" = { ... }; }; # Use Let's Encrypt certificates. Note that this needs to set up a stripped # down nginx and opens port 80. certificateScheme = "acme-nginx"; }; + security.acme.acceptTerms = true; + security.acme.defaults.email = "security@example.com"; } After a ``nixos-rebuild switch`` your server should be running all