Update systemd services.

This commit is contained in:
Raphaël Numbus
2026-02-01 17:26:24 +01:00
parent 23aef89e2b
commit 1ef5a922ec
14 changed files with 241 additions and 77 deletions
+74 -2
View File
@@ -23,8 +23,6 @@
chown -R numbus-admin:users /mnt/data/
chown -R 100032:users /mnt/data/nextcloud/
chown -R numbus-admin:users /home/numbus-admin/.numbus-server/
chown -R numbus-admin:users /mnt/config/frigate/config.yaml
chmod 644 /mnt/config/frigate/config.yaml
touch /home/numbus-admin/.numbus-server/chowned.true
'';
@@ -52,4 +50,78 @@ PODMAN_NETWORKS
touch /home/numbus-admin/.numbus-server/networked.true
'';
};
systemd.services.numbus-quirks = {
description = "Numbus-Server services : Apply quirks";
wantedBy = [ "multi-user.target" ];
after = [
"network.target"
"local-fs.target"
"numbus-activation-chowned.service"
"numbus-activation-networked.service"
"pi-hole.service"
"home-assistant.service"
];
path = [ pkgs.curl pkgs.coreutils pkgs.systemd ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
script = ''
#!/usr/bin/env bash
if [[ -e /home/numbus-admin/.numbus-server/quirked.true ]]; then
exit 0
fi
DOMAIN_NAME="$(cat /run/secrets/domain_name)"
if [[ ! -e /etc/nixos/podman/pi-hole.nix ]]; then
until curl -s "https://pi-hole.$DOMAIN_NAME/admin/login" | grep -q "Pi-hole"; do
echo "Waiting for Pi-hole to be ready..."
sleep 15
done
systemctl restart pi-hole.service
echo "Pi-Hole quirk applied and service ready !"
fi
if [[ ! -e /etc/nixos/podman/home-assistant.nix ]]; then
until [[ -e /mnt/config/home-assistant/configuration.yaml ]]; do
echo "Waiting for Home Assistant to be ready..."
sleep 15
done
sleep 180
systemctl stop frigate.service
cat << 'EOF' >> /mnt/config/home-assistant/configuration.yaml
http:
use_x_forwarded_for: true
trusted_proxies: 172.16.20.253
zha:
EOF
systemctl start home-assistant.service
echo "Home Assistant quirk applied and service ready !"
fi
if [[ ! -e /etc/nixos/podman/frigate.nix ]]; then
until [[ -e /mnt/config/frigate/config.yaml ]]; do
echo "Waiting for Frigate to be ready..."
sleep 15
done
sleep 180
systemctl stop frigate.service
cat << 'EOF' >> /mnt/config/frigate/config.yaml
tls:
enabled: false
EOF
systemctl start frigate.service
echo "Frigate quirk applied and service ready !"
fi
mkdir -p /home/numbus-admin/.numbus-server/
touch /home/numbus-admin/.numbus-server/quirked.true
'';
};
}