Deploiement 2048 bis ; debug staticWebsites.location
This commit is contained in:
parent
e8c4ce84c2
commit
13e949996d
6 changed files with 32 additions and 29 deletions
|
@ -1,12 +1,12 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
{
|
{
|
||||||
staticWebsites.sites = {
|
services.staticWebsites.sites = {
|
||||||
"2048" = {
|
"2048" = {
|
||||||
root = pkgs.fetchFromGitHub {
|
root = pkgs.fetchFromGitHub {
|
||||||
owner = "hackEns";
|
owner = "hackEns";
|
||||||
repo = "2048NdS";
|
repo = "2048NdS";
|
||||||
rev = "1df6db154ca22c380eb52844c7a6a7f888fb5610";
|
rev = "1df6db154ca22c380eb52844c7a6a7f888fb5610";
|
||||||
sha256 = "087471kpbpcg5920wy6fgcx6jz613zbyy0jn5iiimwjk1im1wa4q";
|
sha256 = "1y2v637j0g03g4l80ag72pm9kc46f07npir7ddp8i6x15bzygj1a";
|
||||||
};
|
};
|
||||||
hostname = config.my.subZone;
|
hostname = config.my.subZone;
|
||||||
location = "/2048";
|
location = "/2048";
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./my.nix
|
./my.nix
|
||||||
./staticWebsite.nix
|
./staticWebsites.nix
|
||||||
./nginx.nix
|
./nginx.nix
|
||||||
./webhook.nix
|
./webhooks.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,27 +36,29 @@ in
|
||||||
config = mkIf (eachSite != {}) {
|
config = mkIf (eachSite != {}) {
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
enable = true;
|
enable = true;
|
||||||
virtualHosts = mapAttrs ( hostName: conf: (mkMerge [
|
virtualHosts = mapAttrs' ( hostname: conf: {
|
||||||
{
|
name = conf.hostname;
|
||||||
serverName = conf.hostname;
|
value = (mkMerge [
|
||||||
forceSSL = if debug then false else true;
|
{
|
||||||
enableACME = if debug then false else true;
|
serverName = conf.hostname;
|
||||||
}
|
forceSSL = if config.services.staticWebsites.debug then false else true;
|
||||||
|
enableACME = if config.services.staticWebsites.debug then false else true;
|
||||||
|
}
|
||||||
|
|
||||||
(mkIf (conf.location == null) {
|
(mkIf (conf.location == null) {
|
||||||
root = conf.root;
|
root = conf.root;
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf (conf.location != null) {
|
(mkIf (conf.location != null) {
|
||||||
location = {
|
locations = {
|
||||||
"~ ^${conf.location}" = {
|
"${conf.location}/" = {
|
||||||
alias = conf.root;
|
alias = "${conf.root}/";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
})
|
||||||
})
|
|
||||||
|
|
||||||
])
|
]);
|
||||||
) eachSite;
|
}) eachSite;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
json = pkgs.formats.json {};
|
json = pkgs.formats.json {};
|
||||||
cfg = config.services.webhook;
|
cfg = config.services.webhooks;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.services.webhooks = {
|
options.services.webhooks = {
|
||||||
|
@ -33,6 +33,7 @@ in
|
||||||
debug = mkOption {
|
debug = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
|
@ -50,6 +51,6 @@ in
|
||||||
};
|
};
|
||||||
script = "${cfg.package}/bin/webhook -nopanic -ip \"127.0.0.1\" -port \"${toString cfg.internalPort}\" -verbose -hooks ${json.generate "conf.json" cfg.hooks}";
|
script = "${cfg.package}/bin/webhook -nopanic -ip \"127.0.0.1\" -port \"${toString cfg.internalPort}\" -verbose -hooks ${json.generate "conf.json" cfg.hooks}";
|
||||||
wantedBy = [ "mulit-user.target" ];
|
wantedBy = [ "mulit-user.target" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
{
|
{
|
||||||
services.staticWebsites.test = {
|
services.staticWebsites.sites.test = {
|
||||||
hostname = "test.${config.my.subZone}";
|
hostname = "test.${config.my.subZone}";
|
||||||
root = pkgs.writeTextDir "index.html" "Hello world!";
|
root = pkgs.writeTextDir "index.html" "Hello world!";
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, config, ... }:
|
||||||
{
|
{
|
||||||
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
||||||
# TODO: move to hackens.org
|
# TODO: move to hackens.org
|
||||||
services.dokuwiki.sites."hackens.ens.fr" = {
|
services.dokuwiki.sites."${config.my.subZone}" = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
|
|
Loading…
Reference in a new issue