{"id":27958424,"url":"https://github.com/determinatesystems/hydra-github-jobsets-generator","last_synced_at":"2025-05-07T18:23:44.553Z","repository":{"id":37022333,"uuid":"416808452","full_name":"DeterminateSystems/hydra-github-jobsets-generator","owner":"DeterminateSystems","description":"Generate declarative jobsets for a project's GitHub repository.","archived":false,"fork":false,"pushed_at":"2025-03-16T00:35:18.000Z","size":85,"stargazers_count":13,"open_issues_count":8,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-16T01:24:39.495Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/DeterminateSystems.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":"2021-10-13T15:57:22.000Z","updated_at":"2025-02-06T03:25:51.000Z","dependencies_parsed_at":"2023-10-15T22:24:26.977Z","dependency_job_id":"a2fd8fc2-43a0-46e7-a46e-cb5f19df04a4","html_url":"https://github.com/DeterminateSystems/hydra-github-jobsets-generator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeterminateSystems%2Fhydra-github-jobsets-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeterminateSystems%2Fhydra-github-jobsets-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeterminateSystems%2Fhydra-github-jobsets-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeterminateSystems%2Fhydra-github-jobsets-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DeterminateSystems","download_url":"https://codeload.github.com/DeterminateSystems/hydra-github-jobsets-generator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252932330,"owners_count":21827276,"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":"2025-05-07T18:23:43.757Z","updated_at":"2025-05-07T18:23:44.540Z","avatar_url":"https://github.com/DeterminateSystems.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Generate declarative jobsets for Hydra for a GitHub Project\n\nThis tool uses Hydra's [_declarative jobsets_](https://github.com/NixOS/hydra/blob/master/doc/manual/src/plugins/declarative-projects.md) to automatically create Hydra jobsets for your GitHub project.\n\nConfiguring declarative jobsets use several points of indirection, and this repository's goal is to simplify and streamline the setup process.\n\n## How Declarative Jobsets Work\n\nThe goal of Declarative Jobsets is to have a Hydra Project whose Jobsets are entirely defined outside of Hydra's interface.\nThis means Declarative Jobsets is configured at the _Project_ level.\n\nBriefly:\n\n* The Project's configuration points to a JSON document configuring the Hydra jobset `.jobsets`.\n* The `.jobsets` jobset has a single Hydra job called `jobsets`.\n* The `jobsets` job should produce a JSON document at `$out` with a map of jobset names and jobset configurations. \n\nSome implementation details:\n\n* Before the `.jobsets` jobset is evaluated, the Project's configuration is updated. This means updates to the data pointed to by the Project is reflected.\n* The `jobsets` job does not and should not include the configuration for the `.jobsets` job.\n\n\n## How to use this tool\n\nThis example is assuming you will build PRs for a project at github.com/YOURORGNAME/YOURREPONAME.\n\n### Configuring your repository: .jobsets\n\nIn your project's repository, create a file at `.hydra/project.json`. This contains the configuration for your Hydra's `.jobsets` jobset. It should look like this:\n\n```json\n{\n    \"enabled\": 1,\n    \"hidden\": false,\n    \"description\": \"GitHub Pull Request Jobset Generator\",\n    \"nixexprinput\": \"generator\",\n    \"nixexprpath\": \"jobset/generate.nix\",\n    \"checkinterval\": 300,\n    \"schedulingshares\": 100,\n    \"enableemail\": false,\n    \"emailoverride\": \"\",\n    \"keepnr\": 3,\n    \"inputs\": {\n        \"generator_config\": {\n            \"type\": \"git\",\n            \"value\": \"https://github.com/YOURORGNAME/YOURREPONAME.git main\",\n            \"emailresponsible\": false\n        },\n        \"generator\": {\n            \"type\": \"git\",\n            \"value\": \"https://github.com/DeterminateSystems/hydra-github-jobsets-generator.git main\",\n            \"emailresponsible\": false\n        },\n        \"nixpkgs\": {\n            \"type\": \"git\",\n            \"value\": \"https://github.com/NixOS/nixpkgs.git nixos-unstable-small\",\n            \"emailresponsible\": false\n        },\n        \"pull_requests\": {\n            \"type\": \"githubpulls\",\n            \"value\": \"YOURORGNAME YOURREPONAME\",\n            \"emailresponsible\": false\n        }\n    }\n}\n```\n\nTake care to replace both `YOURORGNAME` and `YOURREPONAME` with your GitHub organization and repo's names.\n\n### Configuring your repository\n\nThen, create a file at `.hydra/config.json`, and include all of the other Hydra inputs you want to use.\n\nFor example, if your project depends on Nixpkgs, write the following to `.hydra/config.json`:\n\n```json\n{\n    \"inputs\": {\n        \"nixpkgs\": {\n            \"type\": \"git\",\n            \"value\": \"git://github.com/NixOS/nixpkgs.git nixos-unstable-small\",\n            \"emailresponsible\": false\n        }\n    }\n}\n```\n\nIf your project has no other inputs, write `{}` to the file.\n\n### Configuring your Hydra\n\nCreate a project on your Hydra which uses a declarative input of type `git` with the file pointing to `.hydra/project.json`.\n\nIf you use the [Terraform Hydra provider](https://registry.terraform.io/providers/DeterminateSystems/hydra/latest), it would look like this:\n\n```terraform\nresource \"hydra_project\" \"pr-example\" {\n  name         = \"pr-example\"\n  display_name = \"PR Example\"\n  description  = \"An example of building a GitHub repository's PRs.\"\n  owner        = \"alice\"\n  enabled      = true\n  visible      = true\n\n  declarative {\n      file = \".hydra/project.json\"\n      type = \"git\"\n      value = \"https://github.com/YOURORGNAME/YOURREPONAME.git main\"\n  }\n}\n```\n\n### Recap\n\nWhen the `.jobsets` jobset evaluates and builds you should now see a jobset for every open PR. This jobset will re-evaluate every 300 seconds (5 minutes).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeterminatesystems%2Fhydra-github-jobsets-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeterminatesystems%2Fhydra-github-jobsets-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeterminatesystems%2Fhydra-github-jobsets-generator/lists"}