forked from Mirror/attic-action
fix: support nix >= 2.19 (#18)
* fix: TypeError when pushing * fix: compatibility with Nix 2.18
This commit is contained in:
parent
6689ac7697
commit
f75ac4b827
1 changed files with 8 additions and 1 deletions
|
@ -6,5 +6,12 @@ export const saveStorePaths = async () => {
|
|||
await exec("sh", ["-c", "nix path-info --all --json > /tmp/store-paths"]);
|
||||
};
|
||||
export const getStorePaths = async () => {
|
||||
return (JSON.parse(await readFile("/tmp/store-paths", "utf8")) as { path: string }[]).map((path) => path.path);
|
||||
const rawStorePaths = JSON.parse(await readFile("/tmp/store-paths", "utf8")) as { path: string }[];
|
||||
|
||||
// compatibility with Nix 2.18
|
||||
if (Array.isArray(rawStorePaths)) {
|
||||
return rawStorePaths.map((path) => path.path);
|
||||
};
|
||||
|
||||
return Object.keys(rawStorePaths);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue