2023-08-13 17:00:41 +01:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
inputs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: let
|
2022-10-23 00:06:39 +01:00
|
|
|
port = 8081;
|
|
|
|
domain = "fossil.cyplo.dev";
|
|
|
|
baseurl = "https://${domain}";
|
2022-10-23 09:48:16 +01:00
|
|
|
path = "/var/lib/fossil";
|
2022-10-23 00:06:39 +01:00
|
|
|
in {
|
2023-08-13 17:00:41 +01:00
|
|
|
imports = [../nginx.nix];
|
2022-10-23 00:06:39 +01:00
|
|
|
|
|
|
|
services.nginx = {
|
|
|
|
virtualHosts = {
|
|
|
|
"${domain}" = {
|
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
2023-08-13 17:00:41 +01:00
|
|
|
locations."/" = {proxyPass = "http://localhost:" + toString port;};
|
2022-10-23 00:06:39 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
containers.fossil = {
|
|
|
|
autoStart = true;
|
2023-08-13 17:00:41 +01:00
|
|
|
forwardPorts = [
|
|
|
|
{
|
|
|
|
containerPort = port;
|
|
|
|
hostPort = port;
|
|
|
|
}
|
|
|
|
];
|
2022-10-23 09:48:16 +01:00
|
|
|
bindMounts = {
|
|
|
|
"${path}" = {
|
|
|
|
hostPath = "${path}";
|
|
|
|
isReadOnly = false;
|
|
|
|
};
|
|
|
|
};
|
2023-08-13 17:00:41 +01:00
|
|
|
config = {
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
user = "fossil";
|
|
|
|
group = "fossil";
|
|
|
|
in {
|
|
|
|
system.stateVersion = "23.05";
|
|
|
|
environment.systemPackages = [pkgs.fossil];
|
|
|
|
users.groups = {"${group}" = {};};
|
|
|
|
users.users = {
|
|
|
|
fossil = {
|
|
|
|
inherit group;
|
|
|
|
description = "Fossil Service";
|
|
|
|
home = path;
|
|
|
|
useDefaultShell = true;
|
|
|
|
isSystemUser = true;
|
2022-10-23 00:06:39 +01:00
|
|
|
};
|
2023-08-13 17:00:41 +01:00
|
|
|
};
|
2022-10-23 00:06:39 +01:00
|
|
|
|
2023-08-13 17:00:41 +01:00
|
|
|
systemd.tmpfiles.rules = ["d '${path}' 0770 ${user} ${group} - -"];
|
|
|
|
systemd.services.fossil = {
|
|
|
|
description = "fossil server";
|
|
|
|
after = ["network-online.target"];
|
|
|
|
wantedBy = ["multi-user.target"];
|
|
|
|
path = [pkgs.fossil pkgs.git];
|
2022-10-23 00:06:39 +01:00
|
|
|
|
2023-08-13 17:00:41 +01:00
|
|
|
serviceConfig = {
|
|
|
|
User = user;
|
|
|
|
Group = group;
|
|
|
|
WorkingDirectory = path;
|
|
|
|
ReadWritePaths = [path];
|
|
|
|
ExecStart =
|
|
|
|
"${pkgs.fossil}/bin/fossil server"
|
|
|
|
+ " --localhost"
|
|
|
|
+ " --https"
|
|
|
|
+ " --port ${toString port}"
|
|
|
|
+ " --baseurl ${baseurl}"
|
|
|
|
+ " --repolist ${path}";
|
|
|
|
Restart = "always";
|
|
|
|
RestartSec = 3;
|
2022-10-23 00:06:39 +01:00
|
|
|
};
|
|
|
|
};
|
2023-08-13 17:00:41 +01:00
|
|
|
};
|
2022-10-23 00:06:39 +01:00
|
|
|
};
|
|
|
|
}
|