diff --git a/machines/rubusidaeus/default.nix b/machines/rubusidaeus/default.nix index 4915451..3a20272 100644 --- a/machines/rubusidaeus/default.nix +++ b/machines/rubusidaeus/default.nix @@ -27,7 +27,10 @@ in { virtualisation.enable = false; yggdrasil-peer.enable = true; - server = { ivabus-dev.enable = true; }; + server = { + ivabus-dev.enable = true; + slides-ivabus-dev.enable = true; + }; }; my.users = { @@ -83,12 +86,6 @@ in { forceSSL = true; http3 = true; }; - virtualHosts."slides.ivabus.dev" = { - locations."/".proxyPass = "http://${secrets.maas-address}:80"; - enableACME = true; - forceSSL = true; - http3 = true; - }; virtualHosts."git.ivabus.dev" = { locations."/".proxyPass = "http://${secrets.maas-address}:3000"; enableACME = true; diff --git a/pkgs/slides-ivabus-dev.nix b/pkgs/slides-ivabus-dev.nix new file mode 100644 index 0000000..2a4cd99 --- /dev/null +++ b/pkgs/slides-ivabus-dev.nix @@ -0,0 +1,20 @@ +{ pkgs ? import { }, ... }: +let + version = "107f8e0d7e02449bc47bbc6fb03f7d1ce2fae60b"; + repo = builtins.fetchGit { + url = "https://github.com/ivabus/slides.ivabus.dev"; + rev = version; + }; +in pkgs.stdenv.mkDerivation { + inherit version; + name = "slides-ivabus-dev"; + src = repo; + + buildInputs = [ ]; + nativeBuildInputs = with pkgs; [ rsync ]; + + installPhase = '' + mkdir -p $out + rsync -a . $out/ --exclude README.md --exclude LICENSE + ''; +} diff --git a/roles/default.nix b/roles/default.nix index 7d4c506..e1d12b2 100644 --- a/roles/default.nix +++ b/roles/default.nix @@ -15,5 +15,6 @@ ./server/nginx.nix ./server/ivabus-dev.nix + ./server/slides-ivabus-dev.nix ]; } diff --git a/roles/server/slides-ivabus-dev.nix b/roles/server/slides-ivabus-dev.nix new file mode 100644 index 0000000..77dbb68 --- /dev/null +++ b/roles/server/slides-ivabus-dev.nix @@ -0,0 +1,22 @@ +{ config, lib, pkgs, ... }: +let cfg = config.my.roles.server.slides-ivabus-dev; +in { + options.my.roles.server.slides-ivabus-dev.enable = + lib.mkEnableOption "Serve slides.ivabus.dev"; + config = lib.mkIf (cfg.enable) { + my.roles.server.nginx.enable = true; + services.nginx = { + virtualHosts."slides.ivabus.dev" = { + forceSSL = true; + enableACME = true; + http3 = true; + + root = pkgs.callPackage ../../pkgs/slides-ivabus-dev.nix { }; + + extraConfig = '' + error_page 404 /404.html; + ''; + }; + }; + }; +}