This commit is contained in:
parent
e7a93efafa
commit
50b333a5a9
6 changed files with 121 additions and 4 deletions
6
flake.lock
generated
6
flake.lock
generated
|
|
@ -40,11 +40,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1794819152,
|
"lastModified": 1795185942,
|
||||||
"narHash": "sha256-a7ymvqbsg5NlcTrtJLF26UqbfLFNiHpxnaE9em5NzT8=",
|
"narHash": "sha256-hbwNkItzp5Nyn7yW2PIBqMiGMNSbFA4Ft22q+T3+d9I=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "c089fab3b46743911df4c60199f6d0b20c4fb834",
|
"rev": "d1a20261ac3d05e0ba3e1ce9d35370f77dfd2063",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
||||||
10
flake.nix
10
flake.nix
|
|
@ -260,6 +260,16 @@
|
||||||
./hosts/forgejo-runner
|
./hosts/forgejo-runner
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
prusa-connect = nixpkgs.lib.nixosSystem {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
modules = [
|
||||||
|
agenix.nixosModules.default
|
||||||
|
{
|
||||||
|
age.secrets = {};
|
||||||
|
}
|
||||||
|
./hosts/prusa-connect
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
(flake-utils.lib.eachDefaultSystem (
|
(flake-utils.lib.eachDefaultSystem (
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
../common.nix
|
../common.nix
|
||||||
../../services/openssh.nix
|
../../services/openssh.nix
|
||||||
../../services/prometheus-node.nix
|
../../services/prometheus-node.nix
|
||||||
./podman.nix
|
../../services/podman.nix
|
||||||
./forgejo-runner.nix
|
./forgejo-runner.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
40
hosts/prusa-connect/default.nix
Normal file
40
hosts/prusa-connect/default.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
../common.nix
|
||||||
|
../../services/openssh.nix
|
||||||
|
../../services/prometheus-node.nix
|
||||||
|
./podman.nix
|
||||||
|
./prusa-connect.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
hostName = "prusa-connect";
|
||||||
|
firewall = {
|
||||||
|
allowedTCPPorts = [
|
||||||
|
22 # SSH
|
||||||
|
80 # HTTP/1
|
||||||
|
443 # HTTP/2
|
||||||
|
];
|
||||||
|
allowedUDPPorts = [
|
||||||
|
443 # HTTP/3
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.etc."ssh/banner".text = ''
|
||||||
|
__
|
||||||
|
/\ \__
|
||||||
|
_____ _ __ __ __ ____ __ ___ ___ ___ ___ __ ___\ \ ,_\
|
||||||
|
/\ '__`\/\`'__\/\ \/\ \ /',__\ /'__`\ _______ /'___\ / __`\ /' _ `\ /' _ `\ /'__`\ /'___\ \ \/
|
||||||
|
\ \ \L\ \ \ \/ \ \ \_\ \/\__, `\/\ \L\.\_/\______\/\ \__//\ \L\ \/\ \/\ \/\ \/\ \/\ __//\ \__/\ \ \_
|
||||||
|
\ \ ,__/\ \_\ \ \____/\/\____/\ \__/.\_\/______/\ \____\ \____/\ \_\ \_\ \_\ \_\ \____\ \____\\ \__\
|
||||||
|
\ \ \/ \/_/ \/___/ \/___/ \/__/\/_/ \/____/\/___/ \/_/\/_/\/_/\/_/\/____/\/____/ \/__/
|
||||||
|
\ \_\
|
||||||
|
\/_/
|
||||||
|
'';
|
||||||
|
services.openssh.settings.Banner = "/etc/ssh/banner";
|
||||||
|
|
||||||
|
system.stateVersion = "26.05";
|
||||||
|
}
|
||||||
67
hosts/prusa-connect/prusa-connect.nix
Normal file
67
hosts/prusa-connect/prusa-connect.nix
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
{ config, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
fqdn = "prusa-connect.club.berlin.ccc.de";
|
||||||
|
ipv6 = "2001:678:560:23:be24:11ff:fe0a:7eff";
|
||||||
|
ipv4 = "172.23.42.30";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
../../services/nginx.nix
|
||||||
|
../../services/podman.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
networking.interfaces.ens3.ipv6.addresses = [
|
||||||
|
{
|
||||||
|
address = ipv6;
|
||||||
|
prefixLength = 64;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
virtualisation.oci-containers.containers.prusa-connect = {
|
||||||
|
labels."io.containers.autoupdate" = "registry";
|
||||||
|
image = "ghcr.io/prusa3d/prusa-connect:latest";
|
||||||
|
environment = {};
|
||||||
|
ports = [ "127.0.0.1:8080:8080" ];
|
||||||
|
#extraOptions = [ "--network=host" ];
|
||||||
|
pull = "newer";
|
||||||
|
volumes = [
|
||||||
|
"/etc/prusa-connect/config.yaml:/config/config.yaml:ro"
|
||||||
|
"/etc/prusa-connect/config.d:/config/config.d"
|
||||||
|
"/var/lib/prusa-connect/storage:/storage"
|
||||||
|
"/var/lib/prusa-connect/data:/data"
|
||||||
|
"/var/lib/prusa-connect/files:/files"
|
||||||
|
"/var/lib/prusa-connect/tmp:/tmp"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
nginx.virtualHosts."${fqdn}" = {
|
||||||
|
quic = true;
|
||||||
|
kTLS = true;
|
||||||
|
forceSSL = true;
|
||||||
|
useACMEHost = fqdn;
|
||||||
|
listenAddresses = [
|
||||||
|
"[${ipv6}]"
|
||||||
|
ipv4
|
||||||
|
];
|
||||||
|
location."/" = {
|
||||||
|
recommendedProxySettings = true;
|
||||||
|
proxyWebsockets = true;
|
||||||
|
proxyPass = "http://127.0.0.1:8080";
|
||||||
|
extraConfig = ''
|
||||||
|
add_header Alt-Svc 'h3=":443"; ma=86400';
|
||||||
|
client_max_body_size 128M;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Forwarded "$proxy_forwarded_for_element;$proxy_forwarded_by_element;host=$host;proto=$scheme";
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
extraConfig = ''
|
||||||
|
error_log syslog:server=unix:/dev/log,tag=${builtins.replaceStrings [ "." ] [ "_" ] fqdn} warn;
|
||||||
|
access_log syslog:server=unix:/dev/log vhost_combined;
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
security.acme.certs."${fqdn}".reloadServices = [ "nginx" ];
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue