Skip to content

DuskSystems/nix-cache-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

license: MIT/Apache-2.0 npm

codecov

nix-cache-action

A GitHub Action for caching Nix.

Usage

- name: Cache Nix
  uses: DuskSystems/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 Nix shell:

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 682 MiB
DeterminateSystems/magic-nix-cache 200 523 MiB
DuskSystems/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 that provide their own cache backends.

License

nix-cache-action is 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

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages