Files
cyper-nix/nixos/roles/frontpage/frontpage-calvin.nix
2026-04-11 16:34:42 +02:00

48 lines
905 B
Nix

{
config,
pkgs,
lib,
...
}:
let
address = config.systemd.network.networks."10-ethernet".networkConfig.Address;
ip = builtins.elemAt (lib.splitString "/" address) 0;
port = 15006;
calvinConfig = pkgs.writeText "config.yml" ''
title: "Calvin's Dashboard"
subtitle: ""
header: true
footer: false
defaults:
colorTheme: dark
services:
- name: "Services"
items: []
'';
calvinRoot = pkgs.runCommand "homer-calvin" { } ''
cp -r ${pkgs.homer}/. $out
chmod -R u+w $out
cp ${calvinConfig} $out/config.yml
'';
in
{
services.nginx.virtualHosts."homer-calvin" = {
listen = [
{
inherit port;
addr = "0.0.0.0";
}
];
root = "${calvinRoot}";
locations."/" = {
index = "index.html";
tryFiles = "$uri $uri/ /index.html";
};
};
networking.firewall.allowedTCPPorts = [ port ];
}