Site statique, my : Typos

This commit is contained in:
Your Name 2022-03-31 08:19:43 +00:00
parent 72bde6e8d8
commit 06add9c83e
4 changed files with 25 additions and 23 deletions

View file

@ -1,10 +1,12 @@
# Inspire du club reseau
{ ... }:
{
imports = [ ./my.nix ];
imports = [ ./modules/my.nix ];
my = {
email = "hackens@clipper.ens.fr";
acmeStaging = true;
debug = true;
subZone = "new.hackens.org";
};
}

View file

@ -1,6 +1,7 @@
# Inspiré du club réseau
{ config, lib, ... }:
with lib;
with types;
{
options.my = {
email = mkOption {
@ -16,12 +17,12 @@ with lib;
};
subZone = mkOption {
description = "Sub zone for hosting the services";
type = str
type = str;
};
debug = mkOption {
description = "Debug mode";
type = bool;
default = false;
}
};
};
};
}

View file

@ -1,8 +1,8 @@
{ lib, config }:
{ lib, config , ... }:
with lib;
let
eachSite = config.services.static-website;
website = { pkgs, config, name, ... }: {
eachSite = config.services.staticWebsite;
website = { name, ... }: {
options = {
root = mkOption {
type = types.path;
@ -10,7 +10,7 @@ let
description = "Static files path for the website";
};
hostname = mkOption {
type = str;
type = types.str;
default = name;
description = "Website hostname";
};
@ -19,21 +19,20 @@ let
debug = config.my.debug;
in
{
services.staticWebsite = lib.mkOption {
type = types.attrsOf (types.submodule website;)
options.services.staticWebsite = lib.mkOption {
type = types.attrsOf (types.submodule website);
description = "Specification of one or more static-websites to serve";
};
config = (mkIf eachSite != {}) {
services.nginx.enable = cfg;
config = mkIf (eachSite != {}) {
services.nginx = {
enable = true;
virtualHosts = mapAttrs ( hostName: conf: {
serverName = conf.path;
serverName = conf.hostname;
root = conf.root;
forceSSL = if debug then false else true;
enableACME = if debug then false else true;
}) eachSite;
};
};
}
/* TODO
ACME
*/

View file

@ -1,4 +1,4 @@
{ config, ... }:
{
services.staticWebsite.testStatic.hostname = "test.${my.subZone}";
services.staticWebsite.test.hostname = "test.${config.my.subZone}";
}