mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-03-25 21:30:52 +01:00
feat(pages): clean the module
This commit is contained in:
parent
5a822dee2a
commit
82ab72f102
4 changed files with 326 additions and 581 deletions
|
@ -1,18 +1,40 @@
|
||||||
{ lib, pkgs, ... }:
|
|
||||||
{
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
age.secrets."pages-settings-file".file = ../../secrets/pages-settings-file.age;
|
||||||
|
|
||||||
services.codeberg-pages = {
|
services.codeberg-pages = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.codeberg-pages-custom;
|
package = pkgs.unstable.codeberg-pages.overrideAttrs (_: {
|
||||||
|
src = pkgs.fetchFromGitea {
|
||||||
|
domain = "codeberg.org";
|
||||||
|
owner = "Codeberg";
|
||||||
|
repo = "pages-server";
|
||||||
|
rev = "831ce3d913015e856351dc4d3fc983ada826ef7e";
|
||||||
|
hash = "sha256-Ti9sOppHOaUU72A7Bxyfu4phJUed4m/5e9RyjmVino0=";
|
||||||
|
};
|
||||||
|
patches = [ ../../packages/codeberg-pages-custom/update-lego.patch ];
|
||||||
|
vendorHash = "sha256-MWT51u4rjZB/QcJn91CxpCP+/N+O6gbVWAk+PEQlcUA=";
|
||||||
|
});
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
ACME_ACCEPT_TERMS = "true";
|
ACME_ACCEPT_TERMS = "true";
|
||||||
ACME_EMAIL = "julien@malka.sh";
|
ACME_EMAIL = "julien@malka.sh";
|
||||||
DNS_PROVIDER = "gandiv5";
|
DNS_PROVIDER = "gandiv5";
|
||||||
ENABLE_HTTP_SERVER = "false";
|
ENABLE_HTTP_SERVER = "false";
|
||||||
GITEA_ROOT = "https://git.luj.fr";
|
GITEA_ROOT = "https://git.dgnum.eu";
|
||||||
PORT = "8010";
|
PORT = "8010";
|
||||||
PAGES_DOMAIN = "luj-static.page";
|
PAGES_DOMAIN = "luj-static.page";
|
||||||
RAW_DOMAIN = "raw.luj-static.page";
|
RAW_DOMAIN = "raw.luj-static.page";
|
||||||
|
PAGES_BRANCHES = "pages,main,master";
|
||||||
|
USE_PROXY_PROTOCOL = "true";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
settingsFile = config.age.secrets."pages-settings-file".path;
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [
|
networking.firewall.allowedTCPPorts = [
|
||||||
|
@ -20,22 +42,50 @@
|
||||||
443
|
443
|
||||||
];
|
];
|
||||||
|
|
||||||
|
services.nginx.defaultListen = [
|
||||||
|
{
|
||||||
|
addr = "127.0.0.1";
|
||||||
|
proxyProtocol = true;
|
||||||
|
ssl = true;
|
||||||
|
}
|
||||||
|
{ addr = "127.0.0.2"; }
|
||||||
|
{
|
||||||
|
addr = "127.0.0.3";
|
||||||
|
ssl = false;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
addr = "127.0.0.4";
|
||||||
|
ssl = false;
|
||||||
|
proxyProtocol = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
security.acme.acceptTerms = true;
|
security.acme.acceptTerms = true;
|
||||||
security.acme.defaults.email = "julien@malka.sh";
|
security.acme.defaults.email = "julien@malka.sh";
|
||||||
luj.nginx.enable = lib.mkForce false;
|
luj.nginx.enable = lib.mkForce false;
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
appendHttpConfig = ''
|
||||||
|
set_real_ip_from 127.0.0.1;
|
||||||
|
real_ip_header proxy_protocol;
|
||||||
|
'';
|
||||||
recommendedGzipSettings = true;
|
recommendedGzipSettings = true;
|
||||||
recommendedOptimisation = true;
|
recommendedOptimisation = true;
|
||||||
recommendedProxySettings = true;
|
recommendedProxySettings = true;
|
||||||
recommendedTlsSettings = true;
|
recommendedTlsSettings = true;
|
||||||
|
|
||||||
streamConfig = ''
|
streamConfig = ''
|
||||||
map $ssl_preread_server_name $sni_upstream {
|
map $ssl_preread_server_name $sni_upstream {
|
||||||
hostnames;
|
hostnames;
|
||||||
default 0.0.0.0:8443;
|
default 127.0.0.1:8010;
|
||||||
*.luj-static.page 0.0.0.0:8010;
|
${lib.concatMapStringsSep "\n" (vhost: " ${vhost} 127.0.0.1:8447;") (
|
||||||
luj.sh 0.0.0.0:8010;
|
lib.attrNames config.services.nginx.virtualHosts
|
||||||
|
)}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 127.0.0.1:8447;
|
||||||
|
proxy_pass 127.0.0.1:8446;
|
||||||
|
proxy_protocol on;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
|
@ -46,8 +96,7 @@
|
||||||
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
defaultSSLListenPort = 8443;
|
defaultSSLListenPort = 8446;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -28,6 +28,11 @@ in
|
||||||
for supported values.
|
for supported values.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
settingsFile = mkOption {
|
||||||
|
type = types.nullOr types.path;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -40,6 +45,7 @@ in
|
||||||
environment = cfg.settings;
|
environment = cfg.settings;
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
|
EnvironmentFile = cfg.settingsFile;
|
||||||
StateDirectory = "codeberg-pages";
|
StateDirectory = "codeberg-pages";
|
||||||
WorkingDirectory = "/var/lib/codeberg-pages";
|
WorkingDirectory = "/var/lib/codeberg-pages";
|
||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
fetchFromGitea,
|
|
||||||
buildGoModule,
|
|
||||||
nix-update-script,
|
|
||||||
}:
|
|
||||||
|
|
||||||
buildGoModule rec {
|
|
||||||
pname = "codeberg-pages";
|
|
||||||
version = "5.1";
|
|
||||||
|
|
||||||
src = fetchFromGitea {
|
|
||||||
domain = "codeberg.org";
|
|
||||||
owner = "Codeberg";
|
|
||||||
repo = "pages-server";
|
|
||||||
rev = "9524b1eb12f77fa345cc8a220f67ae244da0ab12";
|
|
||||||
hash = "sha256-RZjwy0Vdqu2XdF14hwXvQ7Bj11+1Q2VxDm1GTU1brA8=";
|
|
||||||
};
|
|
||||||
|
|
||||||
patches = [ ./update-lego.patch ];
|
|
||||||
|
|
||||||
vendorHash = "sha256-TivaGyKR5axr+DX/hvt4u5qbxyc2AqL5jVDuTG7zf3g=";
|
|
||||||
|
|
||||||
postPatch = ''
|
|
||||||
# disable httptest
|
|
||||||
rm server/handler/handler_test.go
|
|
||||||
'';
|
|
||||||
|
|
||||||
ldflags = [
|
|
||||||
"-s"
|
|
||||||
"-w"
|
|
||||||
];
|
|
||||||
|
|
||||||
tags = [
|
|
||||||
"sqlite"
|
|
||||||
"sqlite_unlock_notify"
|
|
||||||
"netgo"
|
|
||||||
];
|
|
||||||
|
|
||||||
passthru.updateScript = nix-update-script { };
|
|
||||||
|
|
||||||
meta = with lib; {
|
|
||||||
mainProgram = "pages";
|
|
||||||
maintainers = with maintainers; [
|
|
||||||
laurent-f1z1
|
|
||||||
christoph-heiss
|
|
||||||
];
|
|
||||||
license = licenses.eupl12;
|
|
||||||
homepage = "https://codeberg.org/Codeberg/pages-server";
|
|
||||||
description = "Static websites hosting from Gitea repositories";
|
|
||||||
changelog = "https://codeberg.org/Codeberg/pages-server/releases/tag/v${version}";
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue