Skip to content

Commit f75ac4b

Browse files
fix: support nix >= 2.19 (#18)
* fix: TypeError when pushing * fix: compatibility with Nix 2.18
1 parent 6689ac7 commit f75ac4b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/utils.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,12 @@ export const saveStorePaths = async () => {
66
await exec("sh", ["-c", "nix path-info --all --json > /tmp/store-paths"]);
77
};
88
export const getStorePaths = async () => {
9-
return (JSON.parse(await readFile("/tmp/store-paths", "utf8")) as { path: string }[]).map((path) => path.path);
9+
const rawStorePaths = JSON.parse(await readFile("/tmp/store-paths", "utf8")) as { path: string }[];
10+
11+
// compatibility with Nix 2.18
12+
if (Array.isArray(rawStorePaths)) {
13+
return rawStorePaths.map((path) => path.path);
14+
};
15+
16+
return Object.keys(rawStorePaths);
1017
};

0 commit comments

Comments
 (0)