Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- name: Check shell scripts
run: |
nix develop --command shellcheck ./.github/workflows/cache-test.sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/flakehub-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
with:
use-flakehub: true
- name: Build dev shell for ${{ matrix.systems.nix-system }} on ${{ matrix.systems.runner }}
Expand Down
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Use Magic Nix Cache, a totally free and zero-configuration binary cache for Nix
Add our [GitHub Action][action] after installing Nix, in your workflow, like this:

```yaml
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
```

See [Usage](#usage) for a detailed example.
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- uses: DeterminateSystems/flake-checker-action@main
- name: Run `nix build`
run: nix build .
Expand Down Expand Up @@ -80,7 +80,7 @@ When you configure an upstream cache for the Magic Nix Cache, any store paths fe
The default is `https://cache.nixos.org` but you can set a different upstream:

```yaml
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
with:
upstream-cache: https://my-binary-cache.com
```
Expand All @@ -91,28 +91,28 @@ The default is `https://cache.nixos.org` but you can set a different upstream:
cat action.yml| nix run nixpkgs#yq-go -- '[[ "Parameter", "Description", "Required", "Default" ], ["-", "-", "-", "-"]] + [.inputs | to_entries | sort_by(.key) | .[] | ["`" + .key + "`", .value.description, .value.required // "", .value.default // ""]] | map(join(" | ")) | .[] | "| " + . + " |"' -r
-->

| Parameter | Description | Required | Default |
| --------------------------- | --------------------------------------------------------------------------------------------------------------- | -------- | -------------------------------------------------------- |
| `diagnostic-endpoint` | Diagnostic endpoint url where diagnostics and performance data is sent. To disable set this to an empty string. | | https://install.determinate.systems/magic-nix-cache/perf |
| `diff-store` | Whether or not to diff the store before and after Magic Nix Cache runs. | | `false` |
| `flakehub-api-server` | The FlakeHub API server. | | https://api.flakehub.com |
| `flakehub-cache-server` | The FlakeHub binary cache server. | | https://cache.flakehub.com |
| `flakehub-flake-name` | The name of your flake on FlakeHub. The empty string will autodetect your FlakeHub flake. | | `""` |
| `listen` | The host and port to listen on. | | 127.0.0.1:37515 |
| `source-binary` | Run a version of the cache binary from somewhere already on disk. Conflicts with all other `source-*` options. | | |
| `source-branch` | The branch of `magic-nix-cache` to use. Conflicts with all other `source-*` options. | | main |
| `source-pr` | The PR of `magic-nix-cache` to use. Conflicts with all other `source-*` options. | | |
| `source-revision` | The revision of `nix-magic-nix-cache` to use. Conflicts with all other `source-*` options. | | |
| `source-tag` | The tag of `magic-nix-cache` to use. Conflicts with all other `source-*` options. | | |
| `source-url` | A URL pointing to a `magic-nix-cache` binary. Overrides all other `source-*` options. | | |
| `startup-notification-port` | The port magic-nix-cache uses for daemon startup notification. | | 41239 |
| `upstream-cache` | Your preferred upstream cache. Store paths in this store will not be cached in GitHub Actions' cache. | | https://cache.nixos.org |
| `use-flakehub` | Whether to upload build results to FlakeHub Cache (private beta). | | true |
| `use-gha-cache` | Whether to upload build results to the GitHub Actions cache. | | true |
| Parameter | Description | Required | Default |
| --------------------------- | --------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------- |
| `diagnostic-endpoint` | Diagnostic endpoint url where diagnostics and performance data is sent. To disable set this to an empty string. | | https://install.determinate.systems/flakehub-cache/perf |
| `diff-store` | Whether or not to diff the store before and after Magic Nix Cache runs. | | `false` |
| `flakehub-api-server` | The FlakeHub API server. | | https://api.flakehub.com |
| `flakehub-cache-server` | The FlakeHub binary cache server. | | https://cache.flakehub.com |
| `flakehub-flake-name` | The name of your flake on FlakeHub. The empty string will autodetect your FlakeHub flake. | | `""` |
| `listen` | The host and port to listen on. | | 127.0.0.1:37515 |
| `source-binary` | Run a version of the cache binary from somewhere already on disk. Conflicts with all other `source-*` options. | | |
| `source-branch` | The branch of `magic-nix-cache` to use. Conflicts with all other `source-*` options. | | main |
| `source-pr` | The PR of `magic-nix-cache` to use. Conflicts with all other `source-*` options. | | |
| `source-revision` | The revision of `nix-magic-nix-cache` to use. Conflicts with all other `source-*` options. | | |
| `source-tag` | The tag of `magic-nix-cache` to use. Conflicts with all other `source-*` options. | | |
| `source-url` | A URL pointing to a `magic-nix-cache` binary. Overrides all other `source-*` options. | | |
| `startup-notification-port` | The port magic-nix-cache uses for daemon startup notification. | | 41239 |
| `upstream-cache` | Your preferred upstream cache. Store paths in this store will not be cached in GitHub Actions' cache. | | https://cache.nixos.org |
| `use-flakehub` | Whether to upload build results to FlakeHub Cache (private beta). | | true |
| `use-gha-cache` | Whether to upload build results to the GitHub Actions cache. | | true |

[gha-cache]: https://docs.github.com/en/rest/actions/cache
[detsys]: https://determinate.systems/
[action]: https://github.com/DeterminateSystems/magic-nix-cache-action/
[action]: https://github.com/DeterminateSystems/flakehub-cache-action/
[installer]: https://github.com/DeterminateSystems/nix-installer/
[ghacache]: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows
[privacy]: https://determinate.systems/policies/privacy
Expand Down
10 changes: 5 additions & 5 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "magic-nix-cache-action",
"name": "flakehub-cache-action",
"version": "1.0.0",
"description": "",
"main": "./dist/index.js",
Expand All @@ -15,15 +15,15 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/DeterminateSystems/magic-nix-cache-action.git"
"url": "git+https://github.com/DeterminateSystems/flakehub-cache-action.git"
},
"keywords": [],
"author": "",
"license": "LGPL",
"bugs": {
"url": "https://github.com/DeterminateSystems/magic-nix-cache-action/issues"
"url": "https://github.com/DeterminateSystems/flakehub-cache-action/issues"
},
"homepage": "https://github.com/DeterminateSystems/magic-nix-cache-action#readme",
"homepage": "https://github.com/DeterminateSystems/flakehub-cache-action#readme",
"dependencies": {
"@actions/core": "^1.11.1",
"@actions/exec": "^1.1.1",
Expand Down
2 changes: 1 addition & 1 deletion src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export async function netrcPath(): Promise<string> {
// `nix-installer` was not used, the user may be registered with FlakeHub though.
const destinedNetrcPath = path.join(
process.env["RUNNER_TEMP"] ?? os.tmpdir(),
"magic-nix-cache-netrc",
"flakehub-cache-netrc",
);
try {
await flakeHubLogin(destinedNetrcPath);
Expand Down
12 changes: 6 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import * as path from "node:path";
import { setTimeout } from "node:timers/promises";

// The ENV_DAEMON_DIR is intended to determine if we "own" the daemon or not,
// in the case that a user has put the magic nix cache into their workflow
// twice.
// in the case that a user has put the flakehub cache into their workflow
// twice. Note: we continue to use MAGIC_NIX_CACHE_ since MNC and FHC are identical.
const ENV_DAEMON_DIR = "MAGIC_NIX_CACHE_DAEMONDIR";

const FACT_ENV_VARS_PRESENT = "required_env_vars_present";
Expand All @@ -31,7 +31,7 @@ const TEXT_TRUST_UNTRUSTED =
const TEXT_TRUST_UNKNOWN =
"The Nix daemon may not consider the user running this workflow to be trusted. Magic Nix Cache may not start correctly.";

class MagicNixCacheAction extends DetSysAction {
class FlakeHubCacheAction extends DetSysAction {
private hostAndPort: string;
private diffStore: boolean;
private httpClient: Got;
Expand All @@ -44,7 +44,7 @@ class MagicNixCacheAction extends DetSysAction {

constructor() {
super({
name: "magic-nix-cache",
name: "flakehub-cache",
fetchStyle: "gh-env-style",
idsProjectName: "magic-nix-cache-closure",
requireNix: "warn",
Expand Down Expand Up @@ -374,7 +374,7 @@ class MagicNixCacheAction extends DetSysAction {
}

this.addFact(FACT_SENT_SIGTERM, true);
actionsCore.info(`Sending Magic Nix Cache a SIGTERM`);
actionsCore.info(`Sending magic-nix-cache a SIGTERM`);
process.kill(pid, "SIGTERM");
} catch {
// Perfectly normal to get an exception here, because the process shut down.
Expand Down Expand Up @@ -407,7 +407,7 @@ class MagicNixCacheAction extends DetSysAction {
}

function main(): void {
new MagicNixCacheAction().execute();
new FlakeHubCacheAction().execute();
}

main();
Loading