Skip to content

Commit cfd95b5

Browse files
committed
fix: pass BLOUD_APPS_DIR to app service prestart hooks for SSO config
App prestart hooks run bloud-agent in a systemd context that doesn't inherit the host-agent service environment. Without BLOUD_APPS_DIR set, bloud-agent falls back to the relative default '../../apps' which doesn't exist, causing writeSSOEnvVars to fail silently. This left miniflux (and any other native-oidc app) missing OAUTH2_PROVIDER, OAUTH2_CLIENT_ID, and other SSO env vars, so it fell back to local login. - nixos/bloud.nix: add bloud.appsDir option (default: resolved ../apps path) - nixos/lib/bloud-app.nix: set BLOUD_APPS_DIR on each app's systemd service - cli/pve.go: fix cmdRebuildPVE init script permissions (sudo rm for root-owned leftovers, chmod -R u+w after copying read-only nix store)
1 parent bf51668 commit cfd95b5

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

cli/pve.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1352,8 +1352,9 @@ fi
13521352
PKG=$(echo "$AGENT_BIN" | sed 's|/bin/host-agent||')
13531353
SRC="$PKG/share/bloud"
13541354
echo "==> Source: $SRC"
1355-
rm -rf ` + pveSyncDir + `
1355+
sudo rm -rf ` + pveSyncDir + `
13561356
cp -r "$SRC" ` + pveSyncDir + `
1357+
chmod -R u+w ` + pveSyncDir + `
13571358
mkdir -p ` + pveSyncDir + `/build
13581359
cp "$AGENT_BIN" ` + pveSyncDir + `/build/host-agent
13591360
chmod +x ` + pveSyncDir + `/build/host-agent

nixos/bloud.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ in
5353
description = "Path to the host-agent binary for app configuration hooks";
5454
};
5555

56+
appsDir = lib.mkOption {
57+
type = lib.types.str;
58+
default = toString ../apps;
59+
description = "Absolute path to the apps directory (passed to prestart hooks as BLOUD_APPS_DIR)";
60+
};
61+
5662
dataDir = lib.mkOption {
5763
type = lib.types.str;
5864
default = "bloud";

nixos/lib/bloud-app.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,10 @@ in
231231
} // lib.optionalAttrs (port != null && network != "host") {
232232
ports = [ "${toString appCfg.port}:${toString containerPort}" ];
233233
} // lib.optionalAttrs (userns != null) { inherit userns; }
234-
// lib.optionalAttrs (envFile != null) { inherit envFile; });
234+
// lib.optionalAttrs (envFile != null) { inherit envFile; }) // {
235+
# Pass BLOUD_APPS_DIR so prestart hooks can load catalog metadata (e.g. for SSO config)
236+
environment = { BLOUD_APPS_DIR = config.bloud.appsDir; };
237+
};
235238
} // dbInitService // resolvedExtraServices;
236239
}
237240
resolvedExtraConfig

0 commit comments

Comments
 (0)