Rename the tool in all sources (#13)

This commit is contained in:
Luc Perkins 2023-06-24 15:24:52 -07:00 committed by GitHub
parent 3f06fcc241
commit fa869ccfd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 67 additions and 75 deletions

View file

@ -10,7 +10,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action-cache@main
- uses: DeterminateSystems/flake-checker-action@v4
- uses: DeterminateSystems/nix-installer-action@v4
- name: Build package
run: "nix build .# -L"
@ -19,8 +21,8 @@ jobs:
uses: actions/upload-artifact@v3.1.2
with:
# Artifact name
name: nix-actions-cache-X64-macOS
path: result/bin/nix-actions-cache
name: magic-nix-cache-X64-macOS
path: result/bin/magic-nix-cache
retention-days: 1
build-artifacts-X64-Linux:
@ -28,7 +30,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action-cache@main
- uses: DeterminateSystems/flake-checker-action@v4
- uses: DeterminateSystems/nix-installer-action@v4
- name: Build package
run: "nix build .# -L"
@ -37,6 +41,6 @@ jobs:
uses: actions/upload-artifact@v3.1.2
with:
# Artifact name
name: nix-actions-cache-X64-Linux
path: result/bin/nix-actions-cache
name: magic-nix-cache-X64-Linux
path: result/bin/magic-nix-cache
retention-days: 1

View file

@ -1,16 +0,0 @@
name: Run checks
on:
pull_request:
push:
branches: [main]
jobs:
checks:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Check health of flake.lock
uses: DeterminateSystems/flake-checker-action@v4
with:
fail-mode: true

View file

@ -11,7 +11,13 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action-cache@main
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4
- name: Check health of flake.lock
uses: DeterminateSystems/flake-checker-action@v4
with:
fail-mode: true
- name: Check Rust formatting
run: nix develop --command cargo fmt --check

View file

@ -6,7 +6,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action-cache@main
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v2
- name: Dump credentials

View file

@ -33,17 +33,17 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: nix-actions-cache-X64-macOS
name: magic-nix-cache-X64-macOS
path: cache-binary-X64-macOS
- name: Persist the cache binary
run: cp ./cache-binary-X64-macOS/nix-actions-cache ./artifacts/nix-actions-cache-X64-macOS
run: cp ./cache-binary-X64-macOS/magic-nix-cache ./artifacts/magic-nix-cache-X64-macOS
- uses: actions/download-artifact@v3
with:
name: nix-actions-cache-X64-Linux
name: magic-nix-cache-X64-Linux
path: cache-binary-X64-Linux
- name: Persist the cache binary
run: cp ./cache-binary-X64-Linux/nix-actions-cache ./artifacts/nix-actions-cache-X64-Linux
run: cp ./cache-binary-X64-Linux/magic-nix-cache ./artifacts/magic-nix-cache-X64-Linux
- name: Publish Release (Branch)
env:

View file

@ -19,7 +19,7 @@ jobs:
# Only intra-repo PRs are allowed to have PR artifacts uploaded
# We only want to trigger once the upload once in the case the upload label is added, not when any label is added
if: |
github.event.pull_request.head.repo.full_name == 'DeterminateSystems/nix-actions-cache'
github.event.pull_request.head.repo.full_name == 'DeterminateSystems/magic-nix-cache'
&& (
(github.event.action == 'labeled' && github.event.label.name == 'upload to s3')
|| (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'upload to s3'))
@ -37,17 +37,17 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: nix-actions-cache-X64-macOS
name: magic-nix-cache-X64-macOS
path: cache-binary-X64-macOS
- name: Persist the cache binary
run: cp ./cache-binary-X64-macOS/nix-actions-cache ./artifacts/nix-actions-cache-X64-macOS
run: cp ./cache-binary-X64-macOS/magic-nix-cache ./artifacts/magic-nix-cache-X64-macOS
- uses: actions/download-artifact@v3
with:
name: nix-actions-cache-X64-Linux
name: magic-nix-cache-X64-Linux
path: cache-binary-X64-Linux
- name: Persist the cache binary
run: cp ./cache-binary-X64-Linux/nix-actions-cache ./artifacts/nix-actions-cache-X64-Linux
run: cp ./cache-binary-X64-Linux/magic-nix-cache ./artifacts/magic-nix-cache-X64-Linux
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2

View file

@ -26,17 +26,17 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: nix-actions-cache-X64-macOS
name: magic-nix-cache-X64-macOS
path: cache-binary-X64-macOS
- name: Persist the cache binary
run: cp ./cache-binary-X64-macOS/nix-actions-cache ./artifacts/nix-actions-cache-X64-macOS
run: cp ./cache-binary-X64-macOS/magic-nix-cache ./artifacts/magic-nix-cache-X64-macOS
- uses: actions/download-artifact@v3
with:
name: nix-actions-cache-X64-Linux
name: magic-nix-cache-X64-Linux
path: cache-binary-X64-Linux
- name: Persist the cache binary
run: cp ./cache-binary-X64-Linux/nix-actions-cache ./artifacts/nix-actions-cache-X64-Linux
run: cp ./cache-binary-X64-Linux/magic-nix-cache ./artifacts/magic-nix-cache-X64-Linux
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2

View file

@ -66,18 +66,18 @@ fi
cat <<-EOF >> $GITHUB_STEP_SUMMARY
This commit's nix-actions-cache binaries can be fetched from:
This commit's magic-nix-cache binaries can be fetched from:
Intel macOS:
\`\`\`
curl --output nix-actions-cache --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix-actions-cache/rev/$GIT_ISH/X64-macOS
curl --output magic-nix-cache --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/magic-nix-cache/rev/$GIT_ISH/X64-macOS
\`\`\`
x86_64 Linux:
\`\`\`
curl --output nix-actions-cache --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix-actions-cache/rev/$GIT_ISH/X64-Linux
curl --output magic-nix-cache --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/magic-nix-cache/rev/$GIT_ISH/X64-Linux
\`\`\`
Or generally from this ${TYPE}:
@ -85,12 +85,12 @@ Or generally from this ${TYPE}:
Intel macOS:
\`\`\`
curl --output nix-actions-cache --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix-actions-cache/${TYPE}/${TYPE_ID}/X64-macOS
curl --output magic-nix-cache --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/magic-nix-cache/${TYPE}/${TYPE_ID}/X64-macOS
\`\`\`
x86_64 Linux:
\`\`\`
curl --output nix-actions-cache --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix-actions-cache/${TYPE}/${TYPE_ID}/X64-Linux
curl --output magic-nix-cache --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/magic-nix-cache/${TYPE}/${TYPE_ID}/X64-Linux
\`\`\`
EOF

40
Cargo.lock generated
View file

@ -645,6 +645,26 @@ dependencies = [
"linked-hash-map",
]
[[package]]
name = "magic-nix-cache"
version = "0.1.0"
dependencies = [
"axum",
"axum-macros",
"clap",
"daemonize",
"gha-cache",
"serde",
"serde_json",
"thiserror",
"tokio",
"tokio-stream",
"tokio-util",
"tower-http",
"tracing",
"tracing-subscriber",
]
[[package]]
name = "match_cfg"
version = "0.1.0"
@ -696,26 +716,6 @@ dependencies = [
"windows-sys 0.45.0",
]
[[package]]
name = "nix-actions-cache"
version = "0.1.0"
dependencies = [
"axum",
"axum-macros",
"clap",
"daemonize",
"gha-cache",
"serde",
"serde_json",
"thiserror",
"tokio",
"tokio-stream",
"tokio-util",
"tower-http",
"tracing",
"tracing-subscriber",
]
[[package]]
name = "nu-ansi-term"
version = "0.46.0"

View file

@ -1,8 +1,7 @@
[workspace]
members = [
"gha-cache",
"nix-actions-cache",
"magic-nix-cache",
]
[profile.release]

View file

@ -1,6 +1,6 @@
# nix-actions-cache
# The Magic Nix Cache
`nix-actions-cache` is a minimal Nix Binary Cache server backed by [the GitHub Actions Cache](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows).
`magic-nix-cache` is a minimal Nix Binary Cache server backed by [the GitHub Actions Cache](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows).
It can be compiled into a ~3.5MB static binary for distribution, allowing it to start prefetching NARs used in a previous run even _before_ Nix is installed (not implemented yet).
## Development

View file

@ -78,7 +78,7 @@ let
inherit (crossPlatform) pkgs;
craneLib = (crane.mkLib pkgs).overrideToolchain rustNightly;
crateName = craneLib.crateNameFromCargoToml {
cargoToml = ./nix-actions-cache/Cargo.toml;
cargoToml = ./magic-nix-cache/Cargo.toml;
};
src = nix-gitignore.gitignoreSource [ ] ./.;
@ -112,5 +112,5 @@ in
{
inherit crossPlatforms cargoTargets cargoCrossEnvs rustNightly;
nix-actions-cache = buildFor system;
magic-nix-cache = buildFor system;
}

View file

@ -41,13 +41,13 @@
in
{
packages = forEachSupportedSystem ({ pkgs, cranePkgs, ... }: rec {
inherit (cranePkgs) nix-actions-cache;
default = nix-actions-cache;
inherit (cranePkgs) magic-nix-cache;
default = magic-nix-cache;
});
devShells = forEachSupportedSystem ({ pkgs, cranePkgs, lib }: {
default = pkgs.mkShell ({
inputsFrom = [ cranePkgs.nix-actions-cache ];
inputsFrom = [ cranePkgs.magic-nix-cache ];
packages = with pkgs; [
bashInteractive
cranePkgs.rustNightly

View file

@ -1,10 +1,8 @@
[package]
name = "nix-actions-cache"
name = "magic-nix-cache"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
gha-cache = { path = "../gha-cache" }

View file

@ -174,7 +174,7 @@ fn init_logging() {
let filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| {
#[cfg(debug_assertions)]
return EnvFilter::new("info")
.add_directive("nix_actions_cache=debug".parse().unwrap())
.add_directive("magic_nix_cache=debug".parse().unwrap())
.add_directive("gha_cache=debug".parse().unwrap());
#[cfg(not(debug_assertions))]