2016-10-19 14:58:46 +02:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
let
|
2016-10-20 21:40:11 +02:00
|
|
|
inherit (import <stockholm/lib>)
|
2018-12-03 09:47:35 +01:00
|
|
|
genid_uint31
|
2016-10-19 14:58:46 +02:00
|
|
|
;
|
|
|
|
|
|
|
|
in {
|
|
|
|
imports = [
|
2017-08-01 20:47:34 +02:00
|
|
|
./default.nix
|
2016-10-19 14:58:46 +02:00
|
|
|
../git.nix
|
|
|
|
];
|
|
|
|
|
|
|
|
security.acme = {
|
|
|
|
certs."lassul.us" = {
|
|
|
|
allowKeysForGroup = true;
|
|
|
|
group = "lasscert";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2016-11-10 22:34:15 +01:00
|
|
|
krebs.tinc_graphs.enable = true;
|
|
|
|
|
2016-10-19 14:58:46 +02:00
|
|
|
users.groups.lasscert.members = [
|
|
|
|
"dovecot2"
|
|
|
|
"ejabberd"
|
|
|
|
"exim"
|
|
|
|
"nginx"
|
|
|
|
];
|
|
|
|
|
2016-12-26 14:18:08 +01:00
|
|
|
services.nginx.virtualHosts."lassul.us" = {
|
2017-10-03 23:51:11 +02:00
|
|
|
addSSL = true;
|
2017-09-18 00:04:06 +02:00
|
|
|
enableACME = true;
|
2016-12-26 14:18:08 +01:00
|
|
|
locations."/".extraConfig = ''
|
|
|
|
root /srv/http/lassul.us;
|
|
|
|
'';
|
|
|
|
locations."= /retiolum-hosts.tar.bz2".extraConfig = ''
|
|
|
|
alias ${config.krebs.tinc.retiolum.hostsArchive};
|
|
|
|
'';
|
2019-10-10 14:27:52 +02:00
|
|
|
locations."= /hosts".extraConfig = ''
|
|
|
|
alias ${pkgs.krebs-hosts_combined};
|
|
|
|
'';
|
2017-05-09 22:45:49 +02:00
|
|
|
locations."= /retiolum.hosts".extraConfig = ''
|
2019-01-31 14:40:57 +01:00
|
|
|
alias ${pkgs.krebs-hosts-retiolum};
|
2017-05-09 22:45:49 +02:00
|
|
|
'';
|
2018-12-25 14:28:41 +01:00
|
|
|
locations."= /wireguard-key".extraConfig = ''
|
|
|
|
alias ${pkgs.writeText "prism.wg" config.krebs.hosts.prism.nets.wiregrill.wireguard.pubkey};
|
|
|
|
'';
|
2019-10-10 14:27:52 +02:00
|
|
|
locations."/tinc/".extraConfig = ''
|
2020-01-11 20:51:33 +01:00
|
|
|
index index.html;
|
|
|
|
alias ${config.krebs.tinc_graphs.workingDir}/external/;
|
2016-12-26 14:18:08 +01:00
|
|
|
'';
|
2019-10-10 14:27:52 +02:00
|
|
|
locations."= /krebspage".extraConfig = ''
|
2018-09-09 12:07:13 +02:00
|
|
|
default_type "text/html";
|
|
|
|
alias ${pkgs.krebspage}/index.html;
|
|
|
|
'';
|
2019-10-10 14:27:52 +02:00
|
|
|
locations."= /init".extraConfig = let
|
2017-01-17 18:44:08 +01:00
|
|
|
initscript = pkgs.init.override {
|
|
|
|
pubkey = config.krebs.users.lass.pubkey;
|
|
|
|
};
|
|
|
|
in ''
|
|
|
|
alias ${initscript};
|
2017-01-17 16:24:36 +01:00
|
|
|
'';
|
2020-01-11 20:51:53 +01:00
|
|
|
locations."= /blue.pub".extraConfig = ''
|
2017-11-12 13:22:34 +01:00
|
|
|
alias ${pkgs.writeText "pub" config.krebs.users.lass.pubkey};
|
|
|
|
'';
|
2020-01-11 20:51:53 +01:00
|
|
|
locations."= /mors.pub".extraConfig = ''
|
2019-01-04 17:31:43 +01:00
|
|
|
alias ${pkgs.writeText "pub" config.krebs.users.lass-mors.pubkey};
|
|
|
|
'';
|
2016-10-19 14:58:46 +02:00
|
|
|
};
|
|
|
|
|
2017-11-12 13:23:06 +01:00
|
|
|
security.acme.certs."cgit.lassul.us" = {
|
2017-12-13 18:30:34 +01:00
|
|
|
email = "lassulus@lassul.us";
|
|
|
|
webroot = "/var/lib/acme/acme-challenge";
|
2017-11-12 13:23:06 +01:00
|
|
|
group = "nginx";
|
2017-12-13 18:30:34 +01:00
|
|
|
user = "nginx";
|
2017-11-12 13:23:06 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-12-26 14:18:08 +01:00
|
|
|
services.nginx.virtualHosts.cgit = {
|
2017-10-05 05:01:00 +02:00
|
|
|
serverName = "cgit.lassul.us";
|
2017-10-03 23:51:11 +02:00
|
|
|
addSSL = true;
|
2017-11-12 13:23:06 +01:00
|
|
|
sslCertificate = "/var/lib/acme/cgit.lassul.us/fullchain.pem";
|
|
|
|
sslCertificateKey = "/var/lib/acme/cgit.lassul.us/key.pem";
|
2017-12-13 18:30:34 +01:00
|
|
|
locations."/.well-known/acme-challenge".extraConfig = ''
|
|
|
|
root /var/lib/acme/acme-challenge;
|
|
|
|
'';
|
2016-10-19 14:58:46 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
users.users.blog = {
|
2018-12-03 09:47:35 +01:00
|
|
|
uid = genid_uint31 "blog";
|
2020-01-11 20:53:03 +01:00
|
|
|
group = "nginx";
|
2016-10-19 14:58:46 +02:00
|
|
|
description = "lassul.us blog deployment";
|
|
|
|
home = "/srv/http/lassul.us";
|
|
|
|
useDefaultShell = true;
|
|
|
|
createHome = true;
|
2018-10-23 15:45:09 +02:00
|
|
|
openssh.authorizedKeys.keys = with config.krebs.users; [
|
|
|
|
lass.pubkey
|
|
|
|
lass-mors.pubkey
|
2016-10-19 14:58:46 +02:00
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|