Setup link-in-bio page on astral
This commit is contained in:
parent
8e5b7440a1
commit
60b00f946b
3 changed files with 43 additions and 1 deletions
|
|
@ -6,6 +6,7 @@
|
|||
nixosModules.promptmoji
|
||||
agenix.nixosModules.default
|
||||
./forgejo.nix
|
||||
./links.nix
|
||||
./vaultwarden.nix
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{ config, ... }:
|
||||
{ config, pkgs, ... }:
|
||||
let domain = "git.leaf.ninja";
|
||||
in {
|
||||
services.forgejo = {
|
||||
|
|
@ -18,6 +18,8 @@ in {
|
|||
FROM = "forgejo@leaf.ninja";
|
||||
USER = "forgejo@$leaf.ninja";
|
||||
};
|
||||
webhook.ALLOWED_HOST_LIST =
|
||||
pkgs.lib.concatStringsSep "," [ "localhost" "::1" ];
|
||||
};
|
||||
secrets = {
|
||||
mailer.PASSWD = config.age.secrets.forgejo-mailer-password.path;
|
||||
|
|
|
|||
39
hosts/astral/links.nix
Normal file
39
hosts/astral/links.nix
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
domain = "nettika.leaf.ninja";
|
||||
root = "/srv/links";
|
||||
webhookHandler = pkgs.writeScript "webhook-handler.py" ''
|
||||
#!${pkgs.python3}/bin/python3
|
||||
|
||||
import http.server
|
||||
import socketserver
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
class WebhookHandler(http.server.SimpleHTTPRequestHandler):
|
||||
def do_POST(self):
|
||||
os.chdir('${root}')
|
||||
subprocess.run(['${pkgs.git}/bin/git', 'pull'], check=True)
|
||||
self.send_response(200)
|
||||
self.end_headers()
|
||||
self.wfile.write(b'OK')
|
||||
|
||||
with socketserver.TCPServer(("127.0.0.1", 8081), WebhookHandler) as httpd:
|
||||
httpd.serve_forever()
|
||||
'';
|
||||
in {
|
||||
systemd.services.links-webhook = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = "${pkgs.python3}/bin/python3 ${webhookHandler}";
|
||||
Restart = "always";
|
||||
};
|
||||
};
|
||||
|
||||
services.caddy.virtualHosts.${domain}.extraConfig = ''
|
||||
root * ${root}
|
||||
file_server
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue