{"id":14967883,"url":"https://github.com/nixos/hydra","last_synced_at":"2025-05-14T09:11:51.855Z","repository":{"id":799953,"uuid":"2669041","full_name":"NixOS/hydra","owner":"NixOS","description":"Hydra, the Nix-based continuous build system","archived":false,"fork":false,"pushed_at":"2024-10-24T15:03:24.000Z","size":16352,"stargazers_count":1189,"open_issues_count":399,"forks_count":302,"subscribers_count":47,"default_branch":"master","last_synced_at":"2024-10-29T14:37:53.365Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://nixos.org/hydra","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NixOS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","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},"funding":{"open_collective":"nixos"}},"created_at":"2011-10-29T02:06:57.000Z","updated_at":"2024-10-28T16:46:48.000Z","dependencies_parsed_at":"2023-07-05T20:02:01.141Z","dependency_job_id":"2add9d39-8cf0-4498-a8f1-e29000731fbd","html_url":"https://github.com/NixOS/hydra","commit_stats":{"total_commits":3714,"total_committers":137,"mean_commits":27.10948905109489,"dds":0.7350565428109854,"last_synced_commit":"f974891c76e295240017dd7f04d50ecb4b70284e"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NixOS%2Fhydra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NixOS%2Fhydra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NixOS%2Fhydra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NixOS%2Fhydra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NixOS","download_url":"https://codeload.github.com/NixOS/hydra/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248338407,"owners_count":21087208,"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-09-24T13:38:49.163Z","updated_at":"2025-04-11T03:38:35.122Z","avatar_url":"https://github.com/NixOS.png","language":"Perl","funding_links":["https://opencollective.com/nixos"],"categories":[],"sub_categories":[],"readme":"# Hydra\n\n[![CI](https://github.com/NixOS/hydra/workflows/Test/badge.svg)](https://github.com/NixOS/hydra/actions)\n\nHydra is a [Continuous Integration](https://en.wikipedia.org/wiki/Continuous_integration) service for [Nix](https://nixos.org/nix) based projects.\n\n## Installation And Setup\n\n**Note**: The instructions provided below are intended to enable new users to get a simple, local installation up and running. They are by no means sufficient for running a production server, let alone a public instance.\n\n### Enabling The Service\nRunning Hydra is currently only supported on NixOS. The [hydra module](https://github.com/NixOS/nixpkgs/blob/release-20.03/nixos/modules/services/continuous-integration/hydra/default.nix) allows for an easy setup. The following configuration can be used for a simple setup that performs all builds on _localhost_ (Please refer to the [Options page](https://nixos.org/nixos/options.html#services.hydra) for all available options):\n\n```nix\n{\n  services.hydra = {\n    enable = true;\n    hydraURL = \"http://localhost:3000\";\n    notificationSender = \"hydra@localhost\";\n    buildMachinesFiles = [];\n    useSubstitutes = true;\n  };\n}\n```\n### Creating An Admin User\nOnce the Hydra service has been configured as above and activate you should already be able to access the UI interface at the specified URL. However some actions require an admin user which has to be created first:\n\n```\n$ su - hydra\n$ hydra-create-user \u003cUSER\u003e --full-name '\u003cNAME\u003e' \\\n    --email-address '\u003cEMAIL\u003e' --password-prompt --role admin\n```\n\nAfterwards you should be able to log by clicking on \"_Sign In_\" on the top right of the web interface using the credentials specified by `hydra-create-user`. Once you are logged in you can click \"_Admin -\u003e Create Project_\" to configure your first project.\n\n### Creating A Simple Project And Jobset\nIn order to evaluate and build anything you need to create _projects_ that contain _jobsets_. Hydra supports imperative and declarative projects and many different configurations. The steps below will guide you through the required steps to creating a minimal imperative project configuration.\n\n#### Creating A Project\nLog in as administrator, click \"_Admin_\" and select \"_Create project_\". Fill the form as follows:\n\n- **Identifier**: `hello-project`\n- **Display name**: `hello`\n- **Description**: `hello project`\n\nClick \"_Create project_\".\n\n#### Creating A Jobset\nAfter creating a project you are forwarded to the project page. Click \"_Actions_\" and choose \"_Create jobset_\". Change **Type** to Legacy for the example below. Fill the form with the following values:\n\n- **Identifier**: `hello-project`\n- **Nix expression**: `examples/hello.nix` in `hydra`\n- **Check interval**: 60\n- **Scheduling shares**: 1\n\nWe have to add two inputs for this jobset. One for _nixpkgs_ and one for _hydra_ (which we are referencing in the Nix expression above):\n\n- **Input name**: `nixpkgs`\n- **Type**: `Git checkout`\n- **Value**: `https://github.com/NixOS/nixpkgs nixos-24.05`\n\n- **Input name**: `hydra`\n- **Type**: `Git checkout`\n- **Value**: `https://github.com/nixos/hydra`\n\nMake sure **State** at the top of the page is set to \"_Enabled_\" and click on \"_Create jobset_\". This concludes the creation of a jobset that evaluates [./examples/hello.nix](./examples/hello.nix) once a minute. Clicking \"_Evaluations_\" should list the first evaluation of the newly created jobset after a brief delay.\n\n## Building And Developing\n\n### Building Hydra\n\nYou can build Hydra via `nix-build` using the provided [default.nix](./default.nix):\n\n```\n$ nix build\n```\n\n### Development Environment\n\nYou can use the provided shell.nix to get a working development environment:\n```\n$ nix develop\n$ mesonConfigurePhase\n$ ninja\n```\n\n### Executing Hydra During Development\n\nWhen working on new features or bug fixes you need to be able to run Hydra from your working copy. This\ncan be done using [foreman](https://github.com/ddollar/foreman):\n\n```\n$ nix develop\n$ # hack hack\n$ ninja -C build\n$ foreman start\n```\n\nHave a look at the [Procfile](./Procfile) if you want to see how the processes are being started. In order to avoid\nconflicts with services that might be running on your host, hydra and postgress are started on custom ports:\n\n- hydra-server: 63333 with the username \"alice\" and the password \"foobar\"\n- postgresql: 64444\n\nNote that this is only ever meant as an ad-hoc way of executing Hydra during development. Please make use of the\nNixOS module for actually running Hydra in production.\n\n### Checking your patches\n\nAfter making your changes, verify the test suite passes and perlcritic is still happy.\n\nStart by following the steps in [Development Environment](#development-environment).\n\nThen, you can run the tests and the perlcritic linter together with:\n\n```console\n$ nix develop\n$ ninja -C build test\n```\n\nYou can run a single test with:\n\n```\n$ nix develop\n$ cd build\n$ meson test --test-args=../t/Hydra/Event.t testsuite\n```\n\nAnd you can run just perlcritic with:\n\n```\n$ nix develop\n$ cd build\n$ meson test perlcritic\n```\n\n### JSON API\n\nYou can also interface with Hydra through a JSON API. The API is defined in [hydra-api.yaml](./hydra-api.yaml) and you can test and explore via the [swagger editor](https://editor.swagger.io/?url=https://raw.githubusercontent.com/NixOS/hydra/master/hydra-api.yaml)\n\n## Additional Resources\n\n- [Hydra User's Guide](https://nixos.org/hydra/manual/)\n- [Hydra on the NixOS Wiki](https://wiki.nixos.org/wiki/Hydra)\n- [hydra-cli](https://github.com/nlewo/hydra-cli)\n- [Peter Simons - Hydra: Setting up your own build farm (NixOS)](https://www.youtube.com/watch?v=RXV0Y5Bn-QQ)\n\n## License\nHydra is licensed under [GPL-3.0](./COPYING)\n\nIcons provided free by [EmojiOne](http://emojione.com).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnixos%2Fhydra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnixos%2Fhydra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnixos%2Fhydra/lists"}