nixos/netbox: switch to symlink to check for upgrades

This makes it so that the upgrade script also runs when the
configuration changed, or when plugins were added.

This is also a hack to force everyone to run the upgrade script again,
since static files might have been copied incorrectly (see parent commit)
This commit is contained in:
Minijackson 2024-11-06 16:14:56 +01:00
parent ff6d89ac69
commit fe58368de6
No known key found for this signature in database
GPG Key ID: FEA888C9F5D64F62

View File

@ -298,7 +298,7 @@ in {
# This mostly correspond to upstream NetBox's 'upgrade.sh' script.
versionFile="${cfg.dataDir}/version"
if [[ -e "$versionFile" && "$(cat "$versionFile")" == "${cfg.package.version}" ]]; then
if [[ -h "$versionFile" && "$(readlink -- "$versionFile")" == "${cfg.package}" ]]; then
exit 0
fi
@ -314,7 +314,7 @@ in {
(lib.versionOlder cfg.package.version "3.7.0")
"${pkg}/bin/netbox clearcache"}
echo "${cfg.package.version}" > "$versionFile"
ln -sfn "${cfg.package}" "$versionFile"
'';
serviceConfig = defaultServiceConfig // {