core: use nix profile command to list profiles

This commit is contained in:
undefined committed 2025-03-03 20:43:09 +08:00
1 parent b6eaada508
commit 221283e8e8
1 file changed
+5 -4
+5 -4
View File
@@ -31,10 +31,11 @@ const HYDROPATH = [];
if (process.env.NIX_PROFILES) {
try {
const result = JSON.parse(child.execSync('nix-env -q --json --out-path --meta').toString()) as Record<string, any>;
for (const derivation of Object.values(result)) {
if (derivation.name.startsWith('hydro-plugin-') && derivation.outputs?.out) {
HYDROPATH.push(derivation.outputs.out);
const result = JSON.parse(child.execSync('nix profile list --json').toString()) as any;
for (const [name, derivation] of Object.entries(result.elements) as any) {
if (!derivation.active) continue;
if (name.startsWith('hydro-plugin-') && derivation.storePaths) {
HYDROPATH.push(...derivation.storePaths);
}
}
} catch (e) {