Host slides.ivabus.dev using Nix

Signed-off-by: Ivan Bushchik <ivabus@ivabus.dev>
This commit is contained in:
Ivan Bushchik 2023-12-17 17:25:24 +03:00
parent 409c6c276b
commit 0375a858ec
No known key found for this signature in database
GPG key ID: 2F16FBF3262E090C
4 changed files with 47 additions and 7 deletions

View file

@ -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;

View file

@ -0,0 +1,20 @@
{ pkgs ? import <nixpkgs> { }, ... }:
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
'';
}

View file

@ -15,5 +15,6 @@
./server/nginx.nix
./server/ivabus-dev.nix
./server/slides-ivabus-dev.nix
];
}

View file

@ -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;
'';
};
};
};
}