# Announcing services-flake

**URL:** https://discourse.nixos.org/t/announcing-services-flake/41338
**Category:** Announcements
**Created:** [March 12, 2024, 6:24pm UTC](https://discourse.nixos.org/t/announcing-services-flake/41338 "2024-03-12T18:24:30Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![shivaraj-bh](https://discourse.nixos.org/user_avatar/discourse.nixos.org/shivaraj-bh/32/9607_2.png) [@shivaraj-bh](https://discourse.nixos.org/u/shivaraj-bh)
#### Post date: [March 12, 2024, 6:24pm UTC](https://discourse.nixos.org/t/announcing-services-flake/41338/1 "2024-03-12T18:24:30Z")

</div>

I’d like to announce a new open-source project from [Juspay](https://juspay.in/) called [**services-flake**](https://github.com/juspay/services-flake). It allows defining and running services in your project flakes, and works on both Linux and macOS . We internally use it in various projects at Juspay.

## Features

- services-flakes is based on [flake-parts](https://flake.parts/), which brings the [NixOS module system](https://nixos.asia/en/nix-modules) to flakes and that heavily simplifies the DX while editing Nix.

- It works on both Linux and macOS and runs services natively (configured in Nix) without using emulation

- You can define multiple services of the same type

- We have a [native testing infrastructure](https://github.com/juspay/services-flake/issues/145) that you can use to test your services both locally and in CI (pure Nix builds)

We are pretty happy at how it has shaped up so far. There’s room for improvement, and we’re open to any feedback you’ve got.

## See Also

- How we replaced docker-compose with Nix for development in [Nammayatri](https://github.com/nammayatri/nammayatri): [Replacing docker-compose with Nix for development](https://discourse.nixos.org/t/replacing-docker-compose-with-nix-for-development/40912)

- We are also writing tutorials that lead up to talking about flake-parts: [https://nixos.asia/en/nix-tutorial](https://nixos.asia/en/nix-tutorial)

- [community.flake.parts](https://community.flake.parts/) is an initiative to unify the docs for various flake-modules created using flake-parts. The projects and their docs exists in the repo of their own, keeping it decentralised.

---

<div class="post-metadata">

### Author: ![Nebucatnetzer](https://discourse.nixos.org/user_avatar/discourse.nixos.org/nebucatnetzer/32/5770_2.png) [@Nebucatnetzer](https://discourse.nixos.org/u/Nebucatnetzer)
#### Post date: [March 12, 2024, 7:16pm UTC](https://discourse.nixos.org/t/announcing-services-flake/41338/2 "2024-03-12T19:16:49Z")

</div>

Looks interesting.  
Maybe it would make sense to unify this three projects a bit?  
We have now at minimum three projects doing the same thing.

---

<div class="post-metadata">

### Author: ![drupol](https://discourse.nixos.org/user_avatar/discourse.nixos.org/drupol/32/9471_2.png) [@drupol](https://discourse.nixos.org/u/drupol)
#### Post date: [March 12, 2024, 7:31pm UTC](https://discourse.nixos.org/t/announcing-services-flake/41338/3 "2024-03-12T19:31:17Z")

</div>

Cool! What’s the difference with Devenv?

---

<div class="post-metadata">

### Author: ![roberth](https://discourse.nixos.org/user_avatar/discourse.nixos.org/roberth/32/5488_2.png) [@roberth](https://discourse.nixos.org/u/roberth)
#### Post date: [March 12, 2024, 7:40pm UTC](https://discourse.nixos.org/t/announcing-services-flake/41338/4 "2024-03-12T19:40:32Z")

</div>

The README has a [comparison](https://github.com/juspay/services-flake?tab=readme-ov-file#comparison-with-other-tools), currently only against devenv.sh.  
I think another contender would be [`numtide/devshell`](https://github.com/numtide/devshell), which is more open to use as a component (unlike devenv), but doesn’t provide ready-to-use services.  
[Arion](https://docs.hercules-ci.com/arion) does something similar for docker-compose instead of process-compose, but also not a _library_ of services, and no flake-parts module yet.

---

<div class="post-metadata">

### Author: ![shivaraj-bh](https://discourse.nixos.org/user_avatar/discourse.nixos.org/shivaraj-bh/32/9607_2.png) [@shivaraj-bh](https://discourse.nixos.org/u/shivaraj-bh)
#### Post date: [March 13, 2024, 11:21am UTC](https://discourse.nixos.org/t/announcing-services-flake/41338/5 "2024-03-13T11:21:39Z")

</div>

> <https://github.com/juspay/services-flake/issues/151>
>
> https://discourse.nixos.org/t/announcing-services-flake/41338/4?u=shivaraj-bh

---

<div class="post-metadata">

### Author: ![shivaraj-bh](https://discourse.nixos.org/user_avatar/discourse.nixos.org/shivaraj-bh/32/9607_2.png) [@shivaraj-bh](https://discourse.nixos.org/u/shivaraj-bh)
#### Post date: [April 30, 2024, 7:26am UTC](https://discourse.nixos.org/t/announcing-services-flake/41338/6 "2024-04-30T07:26:17Z")

</div>

[services-flake 0.2.0](https://github.com/juspay/services-flake/releases/tag/0.2.0) is out!

---

<div class="post-metadata">

### Author: ![misuzu](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/m/ba9def/32.png) [@misuzu](https://discourse.nixos.org/u/misuzu)
#### Post date: [April 30, 2024, 7:47am UTC](https://discourse.nixos.org/t/announcing-services-flake/41338/7 "2024-04-30T07:47:20Z")

</div>

Looks awesome! Is use-case for this tool is to only run local development services or also to deploy to “production”?

---

<div class="post-metadata">

### Author: ![shivaraj-bh](https://discourse.nixos.org/user_avatar/discourse.nixos.org/shivaraj-bh/32/9607_2.png) [@shivaraj-bh](https://discourse.nixos.org/u/shivaraj-bh)
#### Post date: [May 9, 2024, 3:55pm UTC](https://discourse.nixos.org/t/announcing-services-flake/41338/8 "2024-05-09T15:55:11Z")

</div>

It is for local development and CI.

Especially because we can define the services once and reuse everywhere else, it opens up possibilities like being able to import these configurations into other set of process groups. These other sets could be doing anything, like one of them could be running load-test on your application, another could be running integration-tests, etc.

---

<div class="post-metadata">

### Author: ![shivaraj-bh](https://discourse.nixos.org/user_avatar/discourse.nixos.org/shivaraj-bh/32/9607_2.png) [@shivaraj-bh](https://discourse.nixos.org/u/shivaraj-bh)
#### Post date: [July 29, 2024, 6:42am UTC](https://discourse.nixos.org/t/announcing-services-flake/41338/9 "2024-07-29T06:42:42Z")

</div>

[services-flake 0.3.0](https://github.com/juspay/services-flake/releases/tag/0.3.0) is out!

---

<div class="post-metadata">

### Author: ![Karrq](https://discourse.nixos.org/user_avatar/discourse.nixos.org/karrq/32/27977_2.png) [@Karrq](https://discourse.nixos.org/u/Karrq)
#### Post date: [August 25, 2024, 7:29pm UTC](https://discourse.nixos.org/t/announcing-services-flake/41338/10 "2024-08-25T19:29:06Z")

</div>

I was trying to write my own service as a module, adhering to this format, to be used in the same flake, but I was having a hard time finding any documentation on how to do so…  
I can see that you guys basically translate the YAML configuration into an attribute sets, but would be grateful for more detailed docs.  
Also, I noticed the `lib.multiService` utility, but since I’m rather new to modules I’m struggling to find a way to make use of it for my own services… Again, would appreciate better docs on service _writing_ rather than _consuming_!

---

<div class="post-metadata">

### Author: ![shivaraj-bh](https://discourse.nixos.org/user_avatar/discourse.nixos.org/shivaraj-bh/32/9607_2.png) [@shivaraj-bh](https://discourse.nixos.org/u/shivaraj-bh)
#### Post date: [August 29, 2024, 10:12am UTC](https://discourse.nixos.org/t/announcing-services-flake/41338/11 "2024-08-29T10:12:14Z")

</div>

Does this help: [Custom service – services-flake](https://community.flake.parts/services-flake/custom-service) ?

---

<div class="post-metadata">

### Author: ![Karrq](https://discourse.nixos.org/user_avatar/discourse.nixos.org/karrq/32/27977_2.png) [@Karrq](https://discourse.nixos.org/u/Karrq)
#### Post date: [August 29, 2024, 10:53am UTC](https://discourse.nixos.org/t/announcing-services-flake/41338/12 "2024-08-29T10:53:56Z")

</div>

Awesome stuff, thanks!

I was originally trying to do my service using services-flake as template, but was getting issues (I think flake show was saying that the check set was not a derivation or something), so I searched some more and found the passetto service, and that did work but couldn’t get it to multiservice.  
The added explanation of the difference made it clear why that was the case!

So yeah, the document was basically exactly the process I went thru but explained the right way!

Now I’m trying to configure my service to have some state outside the store, but I think that’s outside the scope of this module 🙂

If I may have a feature request, it would probably be some sort of “migration” function to docker/docker-compose/helm, perhaps I’ll work on that if I really want that feature and expose it as a module, since I’d like to use process-compose locally but deploy containers since that’s supported the most.

Again, thank you so much for the doc!

---

<div class="post-metadata">

### Author: ![shivaraj-bh](https://discourse.nixos.org/user_avatar/discourse.nixos.org/shivaraj-bh/32/9607_2.png) [@shivaraj-bh](https://discourse.nixos.org/u/shivaraj-bh)
#### Post date: [August 29, 2024, 8:04pm UTC](https://discourse.nixos.org/t/announcing-services-flake/41338/13 "2024-08-29T20:04:51Z")

</div>

> If I may have a feature request, it would probably be some sort of “migration” function to docker/docker-compose/helm

This is an interesting idea. It probably is in line with something I want to implement/collaborate with someone on: “Portable service layer”. The idea originated after [Question: How to use `systemd.service` ? · Issue #239 · juspay/services-flake · GitHub](https://github.com/juspay/services-flake/issues/239), but turns out there was already a [draft for something similar in nixpkgs](https://github.com/NixOS/nixpkgs/pull/267111).

This is what I think the future for services would look like:

Option definitions will lie in `nixpkgs` along with config for `systemd` service, which it already does, but won’t be as tightly coupled after “Portable service layer” is implemented. `services-flake` can then re-use the options from `nixpkgs`, and output configs for multiple targets, like: `lanuchd`, `process-compose` or as you mentioned `docker`/`docker-compose`/`helm`. Thus, we will have uniformity in option definitions no matter what the underlying service management mechanism one uses.

---

<div class="post-metadata">

### Author: ![shivaraj-bh](https://discourse.nixos.org/user_avatar/discourse.nixos.org/shivaraj-bh/32/9607_2.png) [@shivaraj-bh](https://discourse.nixos.org/u/shivaraj-bh)
#### Post date: [December 10, 2024, 12:12pm UTC](https://discourse.nixos.org/t/announcing-services-flake/41338/14 "2024-12-10T12:12:28Z")

</div>

[services-flake 0.4.0](https://github.com/juspay/services-flake/releases/tag/0.4.0) is out!

---

<div class="post-metadata">

### Author: ![misuzu](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/m/ba9def/32.png) [@misuzu](https://discourse.nixos.org/u/misuzu)
#### Post date: [December 31, 2024, 10:22am UTC](https://discourse.nixos.org/t/announcing-services-flake/41338/15 "2024-12-31T10:22:28Z")

</div>

> [@shivaraj-bh](#):
>
> It is for local development and CI.

Not anymore 😄

> **[GitHub - misuzu/process-compose-deploy: PoC process-compose deployments for NixOS](https://github.com/misuzu/process-compose-deploy)**
>
> PoC process-compose deployments for NixOS

This utilises the new [`process-compose project update`](https://f1bonacc1.github.io/process-compose/configuration/#on-the-fly-configuration-edit) feature.

---

<div class="post-metadata">

### Author: ![shivaraj-bh](https://discourse.nixos.org/user_avatar/discourse.nixos.org/shivaraj-bh/32/9607_2.png) [@shivaraj-bh](https://discourse.nixos.org/u/shivaraj-bh)
#### Post date: [January 2, 2025, 6:21am UTC](https://discourse.nixos.org/t/announcing-services-flake/41338/16 "2025-01-02T06:21:56Z")

</div>

> [@misuzu](#):
>
> [GitHub - misuzu/process-compose-deploy: PoC process-compose deployments for NixOS](https://github.com/misuzu/process-compose-deploy)

Nice! would be nice to also output `darwinConfigurations` (with `launchd` configuration) that can be used with `nix-darwin`.

---

<div class="post-metadata">

### Author: ![shivaraj-bh](https://discourse.nixos.org/user_avatar/discourse.nixos.org/shivaraj-bh/32/9607_2.png) [@shivaraj-bh](https://discourse.nixos.org/u/shivaraj-bh)
#### Post date: [October 7, 2026, 10:42am UTC](https://discourse.nixos.org/t/announcing-services-flake/41338/17 "2026-10-07T10:42:53Z")

</div>

> **[Release 0.5.0 · juspay/services-flake](https://github.com/juspay/services-flake/releases/tag/0.5.0)**
>
> This release introduces sixteen new services, expands configuration for existing services, and
> includes a range of bug fixes. It also contains a breaking change to PostgreSQL initialization
> scripts...
