{ config, pkgs, lib, ... }: let secrets = import ./secrets.nix; image = "chocobozzz/peertube:production-bullseye"; s3cmd = pkgs.writeShellScript "s3cmd" '' ${pkgs.s3cmd}/bin/s3cmd \ --access_key='${secrets.backup.accessKey}' \ --secret_key='${secrets.backup.secretKey}' \ --host='${secrets.backup.host}' \ --host-bucket='${secrets.backup.hostBucket}' \ $@ ''; bucket = secrets.backup.bucket; domainName = "v.lor.sh"; hostName = builtins.replaceStrings [ "." ] [ "-" ] "${domainName}"; in { imports = [ ./hardware-configuration.nix ]; boot.loader = { efi.canTouchEfiVariables = true; grub = { enable = true; efiSupport = true; device = "nodev"; mirroredBoots = [{ devices = [ "nodev" ]; path = "/boot-fallback"; }]; }; }; networking = { hostName = hostName; hostId = (builtins.substring 0 8 (builtins.readFile "/etc/machine-id")); useDHCP = false; interfaces.eno1 = { ipv4 = secrets.ipv4; ipv6 = secrets.ipv6; }; nameservers = [ "1.1.1.1" ]; firewall = { enable = true; allowedTCPPorts = [ 80 443 1935 ]; }; }; users.extraUsers.root.openssh.authorizedKeys.keys = secrets.pubkeys; services.openssh.enable = true; environment.systemPackages = with pkgs; [ vim htop git tmux ]; services.caddy = { enable = true; virtualHosts."${domainName}".extraConfig = '' encode gzip root * /dev/null reverse_proxy localhost:9000 header { Strict-Transport-Security "max-age=31536000;" } ''; }; system.activationScripts.peertube = '' mkdir -p /var/lib/peertube/{storage,config} cat > /var/lib/peertube/config/local.yml <