{"id":13688476,"url":"https://github.com/srid/nixci","last_synced_at":"2025-10-19T22:12:10.079Z","repository":{"id":179186505,"uuid":"663099865","full_name":"srid/nixci","owner":"srid","description":"Define and build CI for Nix projects anywhere; superceded by Omnix https://omnix.page/om/ci.html","archived":false,"fork":false,"pushed_at":"2024-08-09T17:30:34.000Z","size":228,"stargazers_count":110,"open_issues_count":6,"forks_count":5,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-02-04T04:38:25.872Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/srid.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"publiccode":null,"codemeta":null}},"created_at":"2023-07-06T14:50:03.000Z","updated_at":"2025-02-01T01:34:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"181c6e77-032b-47e7-a259-1643631a4df5","html_url":"https://github.com/srid/nixci","commit_stats":null,"previous_names":["srid/nixci"],"tags_count":5,"template":false,"template_full_name":"srid/rust-nix-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srid%2Fnixci","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srid%2Fnixci/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srid%2Fnixci/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srid%2Fnixci/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/srid","download_url":"https://codeload.github.com/srid/nixci/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238470190,"owners_count":19477790,"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":[],"created_at":"2024-08-02T15:01:14.678Z","updated_at":"2025-10-19T22:12:10.061Z","avatar_url":"https://github.com/srid.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# nixci\n\n[![Crates.io](https://img.shields.io/crates/v/nixci.svg)](https://crates.io/crates/nixci)\n[![Harmeless Code of Conduct](https://img.shields.io/badge/harmless-8A2BE2)](https://srid.ca/coc \"This project follows the 'Harmlessness Code of Conduct'\")\n\n\u003e[!WARNING]\n\u003enixci has been superceded by omnix; you should use [`om ci`](https://omnix.page/om/ci.html) instead.\n\n`nixci` builds all outputs in a flake, or optionally its [sub-flakes](https://github.com/hercules-ci/flake-parts/issues/119), which can in turn be used either in CI or locally. Using [devour-flake] it will automatically build the following outputs:\n\n| Type                   | Output Key                                      |\n| ---------------------- | ----------------------------------------------- |\n| Standard flake outputs | `packages`, `apps`, `checks`, `devShells`       |\n| NixOS                  | `nixosConfigurations.*`                         |\n| nix-darwin             | `darwinConfigurations.*`                        |\n| home-manager           | `legacyPackages.${system}.homeConfigurations.*` |\n\nThe [stdout] of `nixci` will be a list of store paths built.\n\n[stdout]: https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)\n\n## Install\n\n### From nixpkgs\n\n`nixpkgs` contains [version 0.5.0](https://github.com/NixOS/nixpkgs/pull/320437) of nixci that you can install using `nix profile install nixpkgs#nixci` or run using `nix run nixpkgs#nixci`.\n\n### From source\n\nTo install, run `nix profile install github:srid/nixci`. You can also use use `nix run github:srid/nixci` to run `nixci` directly off this repo without installing it.\n\n## Usage\n\n`nixci` accepts any valid [flake URL](https://nixos.asia/en/flake-url) or a Github PR URL.\n\n```sh\n# Run nixci on current directory flake\n$ nixci # Or `nixci build` or `nixci build .`\n\n# Run nixci on a local flake (default is $PWD)\n$ nixci build ~/code/myproject\n\n# Run nixci on a github repo\n$ nixci build github:hercules-ci/hercules-ci-agent\n\n# Run nixci on a github PR\n$ nixci build https://github.com/srid/emanote/pull/451\n\n# Run only the selected sub-flake\n$ git clone https://github.com/srid/haskell-flake \u0026\u0026 cd haskell-flake\n$ nixci build .#default.dev\n```\n\n### Using in Github Actions\n\n#### Standard Runners\n\nAdd the following to your workflow file,\n\n```yaml\n      - uses: actions/checkout@v4\n      - uses: DeterminateSystems/nix-installer-action@main\n        with:\n          extra-conf: |\n            trusted-public-keys = cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=\n            substituters = https://cache.garnix.io?priority=41 https://cache.nixos.org/\n      - uses: yaxitech/nix-install-pkgs-action@v3\n        with:\n          packages: \"github:srid/nixci\"\n      - run: nixci build\n```\n\n#### Self-hosted Runners with Job Matrix\n\n\u003e [!NOTE] \n\u003e This currently requires an explicit nixci configuration in your flake, viz.: `nixci.default.root.dir = \".\";`.\n\n```yaml\njobs:\n  configure:\n    runs-on: self-hosted\n    outputs:\n      matrix: ${{ steps.set-matrix.outputs.matrix }}\n    steps:\n     - uses: actions/checkout@v4\n     - id: set-matrix\n       run: echo \"matrix=$(nixci gh-matrix --systems=aarch64-linux,aarch64-darwin | jq -c .)\" \u003e\u003e $GITHUB_OUTPUT\n  nix:\n    runs-on: self-hosted\n    needs: configure\n    strategy:\n      matrix: ${{ fromJson(needs.configure.outputs.matrix) }}\n      fail-fast: false\n    steps:\n      - uses: actions/checkout@v4\n      - run: nixci build --systems \"github:nix-systems/${{ matrix.system }}\" \".#default.${{ matrix.subflake }}\"\n```\n\n\u003e [!TIP] \n\u003e If your builds fail due to GitHub's rate limiting, consider passing `--extra-access-tokens` (see [an example PR](https://github.com/srid/nixos-flake/pull/55)). If you get rate limits when accessing `github:nix-systems`, use [this workaround](https://github.com/srid/nixci/issues/83#issuecomment-2225903229).\n\n## Configuring\n\nBy default, `nixci` will build the top-level flake, but you can tell it to build sub-flakes by adding the following output to your top-level flake:\n\n```nix\n# myproject/flake.nix\n{\n  nixci.default = {\n    dir1 = {\n        dir = \"dir1\";\n    };\n    dir2 = {\n        dir = \"dir2\";\n        overrideInputs.myproject = ./.;\n    };\n  }\n}\n```\n\nYou can have more than one nixci configuration. For eg., `nixci .#foo` will run the configuration from `nixci.foo` flake output.\n\n### Examples\n\nSome real-world examples of how nixci is used with specific configurations:\n\n- [services-flake](https://github.com/juspay/services-flake/blob/197fc1c4d07d09f4e01dd935450608c35393b102/flake.nix#L10-L24)\n- [nixos-flake](https://github.com/srid/nixos-flake/blob/4af32875e7cc6df440c5f5cf93c67af41902768b/flake.nix#L29-L45)\n- [haskell-flake](https://github.com/srid/haskell-flake/blob/d128c7329bfc73c3eeef90f6d215d0ccd7baf78c/flake.nix#L15-L67)\n    - Here's [a blog post](https://twitter.com/sridca/status/1763528379188265314) that talks about how it is used in haskell-flake\n\n## What it does\n\n- Optionally, accept a flake config (`nixci.default`) to indicate sub-flakes to build, along with their input overrides\n- Preliminary checks\n    - Check that `flake.lock` is in sync\n    - Check that the Nix version is not tool old (using [nix-health](https://github.com/juspay/nix-health))\n- Use [devour-flake](https://github.com/srid/devour-flake) to build all flake outputs[^schema]\n- Print the built store paths to stdout\n\n[^schema]: Support for [flake-schemas](https://github.com/srid/devour-flake/pull/11) is planned\n\n[devour-flake]: https://github.com/srid/devour-flake\n\n## Discussion\n\nFor discussion of nixci, please post in our [Zulip](https://nixos.zulipchat.com/#narrow/stream/413950-nix).\n\n## See also\n\n- [github-nix-ci](https://github.com/juspay/github-nix-ci) - A simple NixOS \u0026 nix-darwin module for self-hosting GitHub runners (includes `nixci` by default)\n- [jenkins-nix-ci](https://github.com/juspay/jenkins-nix-ci) - Jenkins NixOS module that supports `nixci` as a Groovy function\n- [gitlab-nixci](https://gitlab.horizon-haskell.net/nix/gitlab-nixci) - A flake-parts module producing yaml for use with GitLab dynamic pipeline that uses `nixci`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrid%2Fnixci","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrid%2Fnixci","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrid%2Fnixci/lists"}