mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: use nix profile command to list profiles
This commit is contained in:
1 file changed
+5
-4
@@ -31,10 +31,11 @@ const HYDROPATH = [];
|
|||||||
|
|
||||||
if (process.env.NIX_PROFILES) {
|
if (process.env.NIX_PROFILES) {
|
||||||
try {
|
try {
|
||||||
const result = JSON.parse(child.execSync('nix-env -q --json --out-path --meta').toString()) as Record<string, any>;
|
const result = JSON.parse(child.execSync('nix profile list --json').toString()) as any;
|
||||||
for (const derivation of Object.values(result)) {
|
for (const [name, derivation] of Object.entries(result.elements) as any) {
|
||||||
if (derivation.name.startsWith('hydro-plugin-') && derivation.outputs?.out) {
|
if (!derivation.active) continue;
|
||||||
HYDROPATH.push(derivation.outputs.out);
|
if (name.startsWith('hydro-plugin-') && derivation.storePaths) {
|
||||||
|
HYDROPATH.push(...derivation.storePaths);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Reference in new issue
Block a user