Skip to content

Commit

Permalink
feat: automatically configure Nix to use cache (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
nifoc authored Sep 14, 2023
1 parent 88dbb4b commit 8c01d0b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ inputs:
token:
description: "Attic authorization token"
required: false
skip-use:
description: "Set to true to skip using attic cache as a substituter"
required: false

runs:
using: "node16"
Expand Down
8 changes: 8 additions & 0 deletions src/stages/configure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,18 @@ export const configure = async () => {
const endpoint = core.getInput("endpoint");
const cache = core.getInput("cache");
const token = core.getInput("token");
const skipUse = core.getInput("skip-use");

core.info("Logging in to attic cache");
await exec("attic", ["login", "--set-default", cache, endpoint, token]);

if (skipUse === "true") {
core.info('Not adding attic cache to substituters as skip-use is set to true');
} else {
core.info("Adding attic cache to substituters");
await exec.exec('attic', ['use', cache]);
}

core.info("Collecting store paths before build");
await saveStorePaths();
} catch (e) {
Expand Down

0 comments on commit 8c01d0b

Please sign in to comment.