init: mailserver

This commit is contained in:
admin 2024-04-04 15:05:25 +02:00
parent 49df755c44
commit 7f1e38c11d
3 changed files with 136 additions and 1 deletions

View file

@ -1,5 +1,37 @@
{ {
"nodes": { "nodes": {
"blobs": {
"flake": false,
"locked": {
"lastModified": 1604995301,
"narHash": "sha256-wcLzgLec6SGJA8fx1OEN1yV/Py5b+U5iyYpksUY/yLw=",
"owner": "simple-nixos-mailserver",
"repo": "blobs",
"rev": "2cccdf1ca48316f2cfd1c9a0017e8de5a7156265",
"type": "gitlab"
},
"original": {
"owner": "simple-nixos-mailserver",
"repo": "blobs",
"type": "gitlab"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
@ -39,6 +71,29 @@
"url": "https://git.sondell.org/glennwso/home.git" "url": "https://git.sondell.org/glennwso/home.git"
} }
}, },
"nixos-mailserver": {
"inputs": {
"blobs": "blobs",
"flake-compat": "flake-compat",
"nixpkgs": [
"nixpkgs"
],
"utils": "utils"
},
"locked": {
"lastModified": 1710449465,
"narHash": "sha256-2orO8nfplp6uQJBFqKkj1iyNMC6TysmwbWwbb4osTag=",
"owner": "simple-nixos-mailserver",
"repo": "nixos-mailserver",
"rev": "79c8cfcd5873a85559da6201b116fb38b490d030",
"type": "gitlab"
},
"original": {
"owner": "simple-nixos-mailserver",
"repo": "nixos-mailserver",
"type": "gitlab"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1711703276, "lastModified": 1711703276,
@ -58,6 +113,7 @@
"root": { "root": {
"inputs": { "inputs": {
"home": "home", "home": "home",
"nixos-mailserver": "nixos-mailserver",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
}, },
@ -75,6 +131,39 @@
"repo": "default", "repo": "default",
"type": "github" "type": "github"
} }
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1709126324,
"narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "d465f4819400de7c8d874d50b982301f28a84605",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -2,11 +2,16 @@
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.home.url = "git+https://git.sondell.org/glennwso/home.git"; inputs.home.url = "git+https://git.sondell.org/glennwso/home.git";
inputs.home.inputs.nixpkgs.follows = "nixpkgs"; inputs.home.inputs.nixpkgs.follows = "nixpkgs";
inputs.nixos-mailserver = {
url = "gitlab:simple-nixos-mailserver/nixos-mailserver";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, home }@attrs: outputs = { self, nixpkgs, home, nixos-mailserver}@attrs:
let let
system = "x86_64-linux"; system = "x86_64-linux";
homepage = home.packages.${system}.default; homepage = home.packages.${system}.default;
mailserver = nixos-mailserver.nixosModules.default;
in in
{ {
# replace 'joes-desktop' with your hostname here. # replace 'joes-desktop' with your hostname here.
@ -25,6 +30,7 @@
./tail.nix ./tail.nix
./matrix.nix ./matrix.nix
./coturn.nix ./coturn.nix
(import ./mail.nix {inherit mailserver;})
(import ./homepage.nix {inherit homepage;}) (import ./homepage.nix {inherit homepage;})
]; ];

40
mail.nix Normal file
View file

@ -0,0 +1,40 @@
{ mailserver , ... }:
{
imports = [
mailserver
];
mailserver = {
enable = true;
fqdn = "mail.sondell.org";
domains = [ "sondell.org" ];
# A list of all login accounts. To create the password hashes, use
# cat .secrets/nextadminpw | nix-shell -p mkpasswd --run 'mkpasswd -sm bcrypt' > .secrets/mailpw.hash
loginAccounts = {
"admin@sondell.org" = {
hashedPasswordFile = "/etc/nixos/.secrets/mailpw.hash";
aliases = ["info@sondell.org"];
};
};
# Use Let's Encrypt certificates. Note that this needs to set up a stripped
# down nginx and opens port 80.
certificateScheme = "acme-nginx";
};
# services.roundcube = {
# enable = true;
# # this is the url of the vhost, not necessarily the same as the fqdn of
# # the mailserver
# hostName = "webmail.sondell.org";
# extraConfig = ''
# # starttls needed for authentication, so the fqdn required to match
# # the certificate
# $config['smtp_server'] = "tls://${mailserver.fqdn}";
# $config['smtp_user'] = "%u";
# $config['smtp_pass'] = "%p";
# '';
# };
}