configured uptime-kuma

This commit is contained in:
Rouven Seifert 2023-07-15 11:54:30 +02:00
parent 6577b08dab
commit 48e94316c0
Signed by: rouven.seifert
GPG key ID: B95E8FE6B11C4D09
5 changed files with 98 additions and 74 deletions

View file

@ -171,11 +171,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1689134369, "lastModified": 1689362769,
"narHash": "sha256-0G9dutIvhS/WUr3Awcnqw71g8EVVvvkOhVDnDDbY4Fw=", "narHash": "sha256-5V7Z7T9019pGsFnYH6va5h6Wveq8FKmXa/xLfj0DhNI=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "e42fb59768f0305085abde0dd27ab5e0cc15420c", "rev": "c1cdce3d89741d402d8fd2c93e3d2643ff85b053",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -287,11 +287,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1689060619, "lastModified": 1689320556,
"narHash": "sha256-vODUkZLWFVCvo1KPK3dC2CbXjxa9antEn5ozwlcTr48=", "narHash": "sha256-vODUkZLWFVCvo1KPK3dC2CbXjxa9antEn5ozwlcTr48=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "44bc025007e5fcc10dbc3d9f96dcbf06fc0e8c1c", "rev": "d4ea64f2063820120c05f6ba93ee02e6d4671d6b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -301,11 +301,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1689098530, "lastModified": 1689282004,
"narHash": "sha256-fxc/9f20wRyo/5ydkmZkX/Sh/ULa7RcT8h+cUv8p/44=", "narHash": "sha256-VNhuyb10c9SV+3hZOlxwJwzEGytZ31gN9w4nPCnNvdI=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "f2406198ea0e4e37d4380d0e20336c575b8f8ef9", "rev": "e74e68449c385db82de3170288a28cd0f608544f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -347,11 +347,11 @@
}, },
"nixpkgs-stable_2": { "nixpkgs-stable_2": {
"locked": { "locked": {
"lastModified": 1688868408, "lastModified": 1689398528,
"narHash": "sha256-RR9N5XTAxSBhK8MCvLq9uxfdkd7etC//seVXldy0k48=", "narHash": "sha256-qVn/doWn20axR+KvmAAGexv0A5RVzcBbd5HfNMAMeVI=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "510d721ce097150ae3b80f84b04b13b039186571", "rev": "3dc2bc15956db2ff2316af45eefd45803fc1372b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -460,11 +460,11 @@
"nixpkgs-stable": "nixpkgs-stable_2" "nixpkgs-stable": "nixpkgs-stable_2"
}, },
"locked": { "locked": {
"lastModified": 1689149796, "lastModified": 1689405598,
"narHash": "sha256-3FCUdayBHcxk6BZOxEIfa5UxbXNQzTc/VlN7ociI2Dw=", "narHash": "sha256-80fuO3FiXgJmUDQgB7sc2lq8Qe/oSkqDNwx9N/fCtBs=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "88b964df6981e4844c07be8c192aa6bdca768a10", "rev": "cfe47aff8660fd760b1db89613a3205c2c4ba7b6",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -10,6 +10,7 @@
./modules/backup ./modules/backup
./modules/hydra ./modules/hydra
./modules/nextcloud ./modules/nextcloud
./modules/uptime-kuma
./modules/vaultwarden ./modules/vaultwarden
./modules/nginx ./modules/nginx
]; ];

View file

@ -0,0 +1,18 @@
{ ... }:
let
domain = "monitoring.rfive.de";
in
{
services.uptime-kuma = {
enable = true;
};
services.nginx.virtualHosts."${domain}" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:3001";
proxyWebsockets = true;
};
};
}

View file

@ -22,6 +22,11 @@
pkiBundle = "/etc/secureboot"; pkiBundle = "/etc/secureboot";
configurationLimit = 10; configurationLimit = 10;
}; };
extraModulePackages = [
config.boot.kernelPackages.v4l2loopback.out
];
loader.systemd-boot.editor = false; loader.systemd-boot.editor = false;
loader.efi.canTouchEfiVariables = true; loader.efi.canTouchEfiVariables = true;
kernelPackages = pkgs.linuxPackages_latest; kernelPackages = pkgs.linuxPackages_latest;

View file

@ -1,57 +1,57 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
# Virtualisation with gpu passthrough # Virtualisation with gpu passthrough
# Following https://astrid.tech/2022/09/22/0/nixos-gpu-vfio/ # Following https://astrid.tech/2022/09/22/0/nixos-gpu-vfio/
let # let
gpuHook = pkgs.writeShellScript "gpuhook.sh" '' # gpuHook = pkgs.writeShellScript "gpuhook.sh" ''
export PATH=$PATH:${lib.makeBinPath [pkgs.pciutils pkgs.kmod pkgs.psmisc pkgs.systemd pkgs.coreutils]} # export PATH=$PATH:${lib.makeBinPath [pkgs.pciutils pkgs.kmod pkgs.psmisc pkgs.systemd pkgs.coreutils]}
gpu_domains=( # gpu_domains=(
win11 # win11
) # )
function gpu_begin { # function gpu_begin {
set -x # set -x
device=$(lspci -nnD | grep "VGA compatible controller" | grep Intel) # device=$(lspci -nnD | grep "VGA compatible controller" | grep Intel)
# Stop display manager # # Stop display manager
systemctl stop greetd.service # systemctl stop greetd.service
# Unbind vtconsole # # Unbind vtconsole
for i in /sys/class/vtconsole/*/bind; do # for i in /sys/class/vtconsole/*/bind; do
echo 0 > "$i" # echo 0 > "$i"
done # done
# Kill pulseaudio # # Kill pulseaudio
killall pipewire # killall pipewire
killall pipewire-pulse # killall pipewire-pulse
# Unbind GPU # # Unbind GPU
echo "$device" | cut -d' ' -f1 > /sys/module/i915/drivers/pci:i915/unbind # echo "$device" | cut -d' ' -f1 > /sys/module/i915/drivers/pci:i915/unbind
# Unload modules # # Unload modules
rmmod snd_hda_intel # rmmod snd_hda_intel
rmmod i915 # rmmod i915
# Load vfio # # Load vfio
modprobe vfio-pci ids="$(echo "$device" | grep -o 8086:....)" # modprobe vfio-pci ids="$(echo "$device" | grep -o 8086:....)"
} # }
function gpu_end { # function gpu_end {
set -x # set -x
# Unload vfio # # Unload vfio
rmmod vfio_pci # rmmod vfio_pci
# Load modules # # Load modules
modprobe snd_hda_intel # modprobe snd_hda_intel
modprobe i915 # modprobe i915
# Rebind vtconsole # # Rebind vtconsole
for i in /sys/class/vtconsole/*/bind; do # for i in /sys/class/vtconsole/*/bind; do
echo 1 > "$i" # echo 1 > "$i"
done # done
# Start display manager # # Start display manager
systemctl start greetd.service # systemctl start greetd.service
} # }
# Run only for gpu_domains # # Run only for gpu_domains
for d in "''${gpu_domains[@]}"; do # for d in "''${gpu_domains[@]}"; do
[ "$d" = "$1" ] && gpu_domain=true # [ "$d" = "$1" ] && gpu_domain=true
done # done
if [ "$gpu_domain" = true ]; then # if [ "$gpu_domain" = true ]; then
[ "$2" = prepare ] && [ "$3" = begin ] && gpu_begin # [ "$2" = prepare ] && [ "$3" = begin ] && gpu_begin
[ "$2" = release ] && [ "$3" = end ] && gpu_end # [ "$2" = release ] && [ "$3" = end ] && gpu_end
fi # fi
true # true
''; # '';
in # in
{ {
boot.kernelParams = [ "intel_iommu=on" ]; boot.kernelParams = [ "intel_iommu=on" ];
@ -74,16 +74,16 @@ in
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
virt-viewer virt-viewer
]; ];
systemd.services.libvirtd.preStart = # systemd.services.libvirtd.preStart =
'' # ''
mkdir -p /var/lib/libvirt/hooks # mkdir -p /var/lib/libvirt/hooks
chmod 755 /var/lib/libvirt/hooks # chmod 755 /var/lib/libvirt/hooks
# Copy hook files # # Copy hook files
cp -f ${gpuHook} /var/lib/libvirt/hooks/qemu # cp -f ${gpuHook} /var/lib/libvirt/hooks/qemu
# Make them executable # # Make them executable
chmod +x /var/lib/libvirt/hooks/qemu # chmod +x /var/lib/libvirt/hooks/qemu
''; # '';
} }