{"id":13611064,"url":"https://github.com/srid/devour-flake","last_synced_at":"2025-06-15T08:05:37.966Z","repository":{"id":154410275,"uuid":"632089046","full_name":"srid/devour-flake","owner":"srid","description":"Devour all outputs in a Nix flake.","archived":false,"fork":false,"pushed_at":"2025-02-04T03:24:22.000Z","size":154,"stargazers_count":72,"open_issues_count":5,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-20T13:08:47.549Z","etag":null,"topics":["nix","nix-flakes"],"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/srid.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,"publiccode":null,"codemeta":null}},"created_at":"2023-04-24T17:27:28.000Z","updated_at":"2025-05-13T20:25:04.000Z","dependencies_parsed_at":"2023-11-11T18:24:34.203Z","dependency_job_id":"0bb7a765-99d0-4b8c-8b41-d86d1d69df07","html_url":"https://github.com/srid/devour-flake","commit_stats":{"total_commits":45,"total_committers":3,"mean_commits":15.0,"dds":0.06666666666666665,"last_synced_commit":"017e3a0eb62e2a3d63fb20c5028af71f39a81181"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/srid/devour-flake","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srid%2Fdevour-flake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srid%2Fdevour-flake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srid%2Fdevour-flake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srid%2Fdevour-flake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/srid","download_url":"https://codeload.github.com/srid/devour-flake/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srid%2Fdevour-flake/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259942766,"owners_count":22935326,"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":["nix","nix-flakes"],"created_at":"2024-08-01T19:01:51.402Z","updated_at":"2025-06-15T08:05:37.935Z","avatar_url":"https://github.com/srid.png","language":"Nix","funding_links":[],"categories":["Nix"],"sub_categories":[],"readme":"# devour-flake\n\nDevour all outputs in a flake.\n\n\u003cimg src=\"./logo.webp\" width=200 /\u003e\n\n## Why?\n\nRunning `nix build .#a .#b ... .#z` on a flake with that many outputs can be rather slow if the evaluation of those packages are non-trivial, as is often the case when using [IFD](https://nixos.wiki/wiki/Import_From_Derivation). Nix evaluates separately for *each* of the argument (as if not using the [eval cache](https://www.tweag.io/blog/2020-06-25-eval-cache/)).\n\nTo workaround this, we create a \"consumer\" flake that will depend on all outputs in the given input flake, and then run `nix build` *on the* consumer flake, which will then evaluate the input flake's packages only once.\n\ndevour-flake currently detects the following flake 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\n\n## Usage\n\nTo build all of the [nammayatri](https://github.com/nammayatri/nammayatri) flake outputs for example:\n\n```bash\nnix build github:srid/devour-flake \\\n  -L --no-link --print-out-paths \\\n  --override-input flake github:nammayatri/nammayatri\n```\n\nPipe this to `| cachix push \u003cname\u003e` to [push all flake outputs to cachix](https://github.com/juspay/jenkins-nix-ci/commit/71003fbaaba8a17e02bc74c70504ebacc6a5818c)!\n\n### Nix app\n\n\nAdd this repo as a non-flake input:\n\n```nix\n{\n  inputs = {\n    devour-flake.url = \"github:srid/devour-flake\";\n    devour-flake.flake = false;\n  };\n}\n```\n\nThen, add an overlay entry to your nixpkgs:\n\n```nix\n{\n  devour-flake = self.callPackage inputs.devour-flake { };\n}\n```\n\nUse `pkgs.devour-flake` to get a convenient executable that will devour the given flake and spit out the out paths. You can then use this in CI to build all outputs of a flake.\n\n#### `nix-build-all`\n\n\u003e **Note**\n\u003e\n\u003e **See also**: [nixci](https://github.com/srid/nixci), an improved version of `nix-build-all`.\n\nFor a CI-friendly command that builds all flake outputs, in addition to checking for `flake.lock` consistency, use:\n\n```nix\n{ pkgs, ... }:\n\npkgs.writeShellApplication {\n  name = \"nix-build-all\";\n  runtimeInputs = [\n    pkgs.nix\n    pkgs.devour-flake\n  ];\n  text = ''\n    # Make sure that flake.lock is sync\n    nix flake lock --no-update-lock-file\n\n    # Do a full nix build (all outputs)\n    # This uses https://github.com/srid/devour-flake\n    devour-flake . \"$@\"\n  '';\n}\n```\n\n\n## Who uses it\n\n- [Omnix](https://omnix.page/om/ci.html) (formerly [nixci](https://github.com/srid/nixci)): One command to run full Nix builds in CI or locally\n- [jenkins-nix-ci](https://github.com/juspay/jenkins-nix-ci): Build all flake outputs in Jenkins, and push them to cachix.\n- Other projects:\n  - [horizon-platform](https://gitlab.horizon-haskell.net/package-sets/horizon-platform/-/merge_requests/28/diffs)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrid%2Fdevour-flake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrid%2Fdevour-flake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrid%2Fdevour-flake/lists"}