NixOS-like services for Nix flakes
Go to file
John Hampton 4d363b6d22 test(postgres): set socketDir with empty listen_addresses
Test a postgres service with socketDir set and empty listen_addresses.
2024-04-14 08:57:42 +05:30
.github/workflows ci: Upgrade to new nixci 2024-03-25 10:25:19 -04:00
dev feat(dev): add just changelog (#162) 2024-04-01 03:40:37 +05:30
doc fix(postgres): empty socketDir by default (#160) 2024-03-26 18:44:11 +05:30
example chore(postgres): default value for listen_addresses is already localhost 2024-03-27 12:43:35 +05:30
nix test(postgres): set socketDir with empty listen_addresses 2024-04-14 08:57:42 +05:30
test fix(test): grafana on darwin is no longer broken in upstream (#161) 2024-04-04 11:14:35 +05:30
.envrc chore(.envrc): Reload direnv when any relevant files change 2024-03-07 14:04:05 -05:00
.gitignore docs(example): add share-services example (#137) 2024-03-11 14:05:30 -04:00
CHANGELOG.md feat(dev): add just changelog (#162) 2024-04-01 03:40:37 +05:30
flake.nix fix(template): Was broken in previous PR merge 2024-03-11 14:24:25 -04:00
justfile feat(dev): add just changelog (#162) 2024-04-01 03:40:37 +05:30
LICENSE Initial commit 2023-06-19 17:44:27 -04:00
README.md docs: (readme) link to datadir doc from cfp; (index) add guide (#150) 2024-03-13 16:05:01 +05:30

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). Enabling users to have NixOS-like service on MacOS and Linux.

Demo

Motivation

With services-flake, we aim 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/guide/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 on which much of our services implementation is based on.


  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. ↩︎