{"id":14968081,"url":"https://github.com/rikhuijzer/cache-install","last_synced_at":"2025-10-26T00:31:00.168Z","repository":{"id":43319545,"uuid":"293826398","full_name":"rikhuijzer/cache-install","owner":"rikhuijzer","description":"Use the GitHub Actions cache for Nix packages","archived":false,"fork":false,"pushed_at":"2024-02-07T07:15:27.000Z","size":2791,"stargazers_count":43,"open_issues_count":2,"forks_count":19,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T12:51:22.250Z","etag":null,"topics":["actions","cache","dependencies","nix","packages"],"latest_commit_sha":null,"homepage":"","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rikhuijzer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-09-08T13:56:52.000Z","updated_at":"2025-01-07T14:29:39.000Z","dependencies_parsed_at":"2023-11-27T10:33:06.026Z","dependency_job_id":"0c3a157d-0c2d-4eb0-9d4c-4234a64ab9f0","html_url":"https://github.com/rikhuijzer/cache-install","commit_stats":{"total_commits":27,"total_committers":5,"mean_commits":5.4,"dds":"0.40740740740740744","last_synced_commit":"9b208db4a519741b9a40f7525937e836892b68bd"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rikhuijzer%2Fcache-install","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rikhuijzer%2Fcache-install/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rikhuijzer%2Fcache-install/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rikhuijzer%2Fcache-install/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rikhuijzer","download_url":"https://codeload.github.com/rikhuijzer/cache-install/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238229940,"owners_count":19437723,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","cache","dependencies","nix","packages"],"created_at":"2024-09-24T13:39:13.202Z","updated_at":"2025-10-26T00:30:54.881Z","avatar_url":"https://github.com/rikhuijzer.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cache install Nix packages\n\nThis actions allows caching of installations done via the [Nix package manager](https://nixos.org) to improve workflow execution time. \n\n[![][tests-img]][tests-url]\n\nInstalling packages via the Nix package manager is generally quite quick.\nHowever, sometimes the packages take a long time to compile or to download from their original sources.\nFor example, this occurs with R packages and LaTeX which are downloaded from respectively `CRAN` and `math.utah.edu`.\nThis GitHub Action speeds up the installation by simply caching the Nix store and the symlinks to the packages in the store in the [GitHub Actions cache](https://github.com/actions/cache).\nSo, the installed packages are restored from the cache by copying back `/nix/store`, the symlinks to `/nix/store/*` and some paths for the PATH environment variable.\n\n## Inputs\n\n- `key` - An explicit key for restoring and saving the cache.\n- `restore-keys` - An ordered list of keys to use for restoring the cache if no cache hit occurred for key.\n- `nix_version` - Nix version, defaults to `nixos-unstable`.\n- `nix_file` - Nix file, defaults to `default.nix`.\n- `nix_install_url` - Install URL for the Nix package manager; obtain newest via https://nixos.org/nix/install.\n\n## Outputs\n\n- `cache-hit` - A boolean value to indicate an exact match was found for the primary key.\n\n## Example workflow\n\n```yml\nname: latex\n\non: push\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n\n    steps:\n    - uses: actions/checkout@v4\n\n    - name: Cache install Nix packages\n      uses: rikhuijzer/cache-install@v1\n      with:\n        key: nix-${{ hashFiles('mypackages.nix') }}\n        nix_file: 'mypackages.nix'\n\n    - name: Calculate some things\n      run: julia -e 'using MyPackage; MyPackage.calculate()'\n\n    - name: Build LaTeX\n      run: latexmk -f -pdf example.tex\n\n    - name: Build website\n      run: hugo --gc --minify\n```\n\nwhere the file `mypackages.nix` contains\n\n```nix\nlet\n  # Pinning explicitly to 20.03.\n  rev = \"5272327b81ed355bbed5659b8d303cf2979b6953\";\n  nixpkgs = fetchTarball \"https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz\";\n  pkgs = import nixpkgs {};\n  myTex = with pkgs; texlive.combine {\n    inherit (texlive) scheme-medium pdfcrop;\n  };\nin with pkgs; [\n  hugo\n  julia\n  myTex\n]\n```\n\n[tests-img]: https://github.com/rikhuijzer/cache-install/workflows/test/badge.svg\n[tests-url]: https://github.com/rikhuijzer/cache-install/actions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frikhuijzer%2Fcache-install","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frikhuijzer%2Fcache-install","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frikhuijzer%2Fcache-install/lists"}