mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-03-23 20: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 = {
|
||||
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 = {
|
||||
ACME_ACCEPT_TERMS = "true";
|
||||
ACME_EMAIL = "julien@malka.sh";
|
||||
DNS_PROVIDER = "gandiv5";
|
||||
ENABLE_HTTP_SERVER = "false";
|
||||
GITEA_ROOT = "https://git.luj.fr";
|
||||
GITEA_ROOT = "https://git.dgnum.eu";
|
||||
PORT = "8010";
|
||||
PAGES_DOMAIN = "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 = [
|
||||
|
@ -20,22 +42,50 @@
|
|||
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.defaults.email = "julien@malka.sh";
|
||||
luj.nginx.enable = lib.mkForce false;
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
appendHttpConfig = ''
|
||||
set_real_ip_from 127.0.0.1;
|
||||
real_ip_header proxy_protocol;
|
||||
'';
|
||||
recommendedGzipSettings = true;
|
||||
recommendedOptimisation = true;
|
||||
recommendedProxySettings = true;
|
||||
recommendedTlsSettings = true;
|
||||
|
||||
streamConfig = ''
|
||||
map $ssl_preread_server_name $sni_upstream {
|
||||
hostnames;
|
||||
default 0.0.0.0:8443;
|
||||
*.luj-static.page 0.0.0.0:8010;
|
||||
luj.sh 0.0.0.0:8010;
|
||||
default 127.0.0.1:8010;
|
||||
${lib.concatMapStringsSep "\n" (vhost: " ${vhost} 127.0.0.1:8447;") (
|
||||
lib.attrNames config.services.nginx.virtualHosts
|
||||
)}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 127.0.0.1:8447;
|
||||
proxy_pass 127.0.0.1:8446;
|
||||
proxy_protocol on;
|
||||
}
|
||||
|
||||
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.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsFile = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -40,6 +45,7 @@ in
|
|||
environment = cfg.settings;
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
EnvironmentFile = cfg.settingsFile;
|
||||
StateDirectory = "codeberg-pages";
|
||||
WorkingDirectory = "/var/lib/codeberg-pages";
|
||||
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