Skip to content

Commit aaab428

Browse files
committed
feat(action): ignore /nix/var except db.sqlite
1 parent cccdcb3 commit aaab428

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/utils/action.ts

+15-5
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,23 @@ export async function restoreCache({
8080
}) {
8181
let extraTarArgs: string[] = [];
8282

83-
if (!lookupOnly) {
84-
const nixPaths = readdirSync("/nix/store").map(
85-
x => `../../../../../nix/store/${x}`
86-
);
83+
if (inputs.nix && !lookupOnly) {
84+
const excludePaths = readdirSync("/nix/store")
85+
.map(x => `../../../../../nix/store/${x}`)
86+
.concat(
87+
readdirSync("/nix/var/nix")
88+
.filter(x => x != "db")
89+
.map(x => `../../../../../nix/var/nix/${x}`)
90+
)
91+
.concat(
92+
readdirSync("/nix/var/nix/db")
93+
.filter(x => x != "db.sqlite")
94+
.map(x => `../../../../../nix/var/nix/db/${x}`)
95+
);
96+
8797
const tmp = await cacheUtils.createTempDirectory();
8898
const excludeFromFile = `${tmp}/nix-store-paths`;
89-
writeFileSync(excludeFromFile, nixPaths.join("\n"));
99+
writeFileSync(excludeFromFile, excludePaths.join("\n"));
90100
extraTarArgs = ["--exclude-from", excludeFromFile];
91101

92102
info(`::group::Logs produced while restoring a cache.`);

0 commit comments

Comments
 (0)