NixOS-like services for Nix flakes
Go to file
github-actions[bot] 6ff052636c chore(test): Update flake.lock
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/6e14bbce7bea6c4efd7adfa88a40dac750d80100?narHash=sha256-pFSxgSZqZ3h%2B5Du0KvEL1ccDZBwu4zvOil1zzrPNb3c%3D' (2024-07-20)
  → 'github:nixos/nixpkgs/e36e9f57337d0ff0cf77aceb58af4c805472bfae?narHash=sha256-OpX0StkL8vpXyWOGUD6G%2BMA26wAXK6SpT94kLJXo6B4%3D' (2024-07-27)
• Updated input 'services-flake':
    'github:juspay/services-flake/9a5e1e65c13ab7be48fa67a273e9fd009f111d14?narHash=sha256-LFYE2Ez6Wfj4WYgZR7p%2BUMzqJveeGLqUTDD%2B/bTQvlI%3D' (2024-07-21)
  → 'github:juspay/services-flake/8a547f08687a71d9f01f87a10ec4c5618db6efc5?narHash=sha256-iKJZFOwtBt09z/AAN/tZn6k8etGt3PQ%2BdIQAHX8Vzds%3D' (2024-07-28)
2024-07-28 00:26:35 +00:00
.github/workflows chore(ci): Add step name 2024-07-02 16:24:41 -04:00
.vscode chore(vscode): Initial exts/settings 2024-05-21 15:02:29 +05:30
dev chore(dev): Re-enable treefmt-nix flake check 2024-06-21 17:48:10 -04:00
doc chore: add tika to services list 2024-07-15 22:27:23 +05:30
example chore(example): Update llm/flake.lock 2024-07-28 00:26:16 +00:00
nix feat(tika): add enableOcr option (#275) 2024-07-22 03:06:13 +05:30
test chore(test): Update flake.lock 2024-07-28 00:26:35 +00:00
.envrc chore(envrc): nix_direnv_watch_file is deprecated, use watch_file 2024-04-24 14:36:27 +05:30
.gitignore feat: add tempo service (#192) 2024-05-19 17:06:45 +05:30
CHANGELOG.md chore: update changelog 2024-06-09 00:31:17 +00:00
flake.nix chore: update comment 2024-07-09 16:49:59 -04:00
justfile chore: add example/llm; github workflow to update the example/llm/flake.lock 2024-06-13 11:16:03 +05:30
LICENSE Initial commit 2023-06-19 17:44:27 -04:00
README.md chore(readme): Change to trigger CI 2024-06-17 10:43:31 -04:00

project chat

services-flake

services-flake provides declarative, composable, and reproducible services for Nix development environment, as a process-compose-flake module (based on flake-parts). It enables users to have NixOS-like services on MacOS and Linux.

Demo

Motivation

services-flake is designed to solve the following problems:

  • Run external services like databases, Redis, etc. natively across platforms.
  • Enable users to configure multiple instances of these external services.
  • Provide project-specific service configuration and data isolation.

Consider a scenario where we are juggling two projects, located at ~/code/foo and ~/code/bar. The foo project integrates postgres and nginx, while bar encompasses postgres, pgAdmin, and kafka. It's crucial that the postgres data remains segregated across these projects. Additionally, the bar project is designed to facilitate multiple instances of postgres. Both projects are equipped with a flake app, streamlining the launch of their respective service stacks. Consequently, anyone using a Linux or macOS system can effortlessly clone either project and execute nix run .#services to activate the full suite of services without the need for manual configuration.

Getting Started

See https://community.flake.parts/services-flake/start

Services available

List of supported services is available at https://community.flake.parts/services-flake/services

Comparison with other tools

services-flake devenv services
macOS support ✔️ ✔️
Pure Flakes ✔️ ✖️1
Services as flake apps ✔️ ✖️2
Multiple instances of a service ✔️ ✖️3
Share services ✔️ ✖️4
No coupling ✔️ ✖️5

Want to compare with other tools? Let us know.

Service data directory

See https://community.flake.parts/services-flake/datadir

Discussions

To discuss the project, please join our Zulip.

Contributing & Development

See https://community.flake.parts/services-flake/contributing

Credits

Thanks to the devenv project, which originally inspired this project to provide the same for Nix flake users.


  1. Devenv's flakes integration requires you use run the nix shell in impure mode by passing --impure. ↩︎

  2. services-flake produces a flake app that you can run using the Nix command (nix run) outside of the devShell, whereas with devenv you must use devenv's CLI, devenv up, inside of devShell. See here. ↩︎

  3. services-flake allows you to configure multiple instances of the same service, whereas devenv does not. ↩︎

  4. services-flake is built on top of flake-parts, thus you may share your service and process modules for re-use across flakes (see example), whilst making them general enough for customization based on the module system. With devenv, as far as we can ascertain, you can only share whole devenv configuration as modules. See here. ↩︎

  5. service-flake exposes process-compose-flake modules for each service, which can be reused as long as your project is using flake-parts. With devenv, decoupling is not possible (nor prioritized in future) unless you buy into the whole devenv ecosystem. ↩︎