Skip to content

Latest commit

 

History

35 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

license: MIT/Apache-2.0 npm

codecov

nix-cache-action

A GitHub Action for caching Nix.

Usage

- name: Cache Nix
  uses: SwornSystems/nix-cache-action@${VERSION}
  with:
    key: nix-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/flake.lock', '**/*.nix') }}
    restore-keys: |
      nix-${{ runner.os }}-${{ runner.arch }}-

Why

Efficiency

As an example, a project with this setup:

pkgs.mkShell {
  nativeBuildInputs = with pkgs; [
    # System
    pkg-config
  ];

  buildInputs = with pkgs; [
    # Rust
    rust-bin.stable.latest.default
    cargo-nextest
    cargo-shear

    # System
    openssl

    # Spellchecking
    typos

    # Nix
    nixfmt
  ];
}

Results in the following cache save stats:

Action Entries Size
nix-community/cache-nix-action 1 666 MiB
DeterminateSystems/magic-nix-cache 185 592 MiB
SwornSystems/nix-cache-action 1 377 MiB

The tradeoff is this relies on substituters being consistently available and fast to fetch from at restore time.

Compatibility

Since this action uses @actions/cache, it should be compatible with alternative GitHub Actions runners with their own cache backends.

License

Licensed under the terms of both the MIT License and the Apache License (Version 2.0).

About

A GitHub Action for caching Nix.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages