modules: services: put modules into folders
This commit is contained in:
parent
836b54b8eb
commit
ac90c5b11a
29 changed files with 28 additions and 28 deletions
33
modules/services/blog/default.nix
Normal file
33
modules/services/blog/default.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# My blog setup
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.my.services.blog;
|
||||
domain = config.networking.domain;
|
||||
|
||||
makeHostInfo = subdomain: {
|
||||
inherit subdomain;
|
||||
root = "/var/www/${subdomain}";
|
||||
};
|
||||
|
||||
hostsInfo = map makeHostInfo [ "cv" "dev" "key" ];
|
||||
in
|
||||
{
|
||||
options.my.services.blog = {
|
||||
enable = lib.mkEnableOption "Blog hosting";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.nginx.virtualHosts = {
|
||||
# This is not a subdomain, cannot use my nginx wrapper module
|
||||
${domain} = {
|
||||
forceSSL = true;
|
||||
useACMEHost = domain;
|
||||
root = "/var/www/blog";
|
||||
default = true; # Redirect to my blog
|
||||
};
|
||||
};
|
||||
|
||||
# Those are all subdomains, no problem
|
||||
my.services.nginx.virtualHosts = hostsInfo;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue