<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/running-local-development-services-cq5rfnpcm" -->

---
title: Running local development services | daily.dev
description: A Nix tutorial shows how to run local development services inside a lightweight NixOS VM managed by systemd instead of a separate process manager. It uses a...
canonical: https://daily.dev/posts/running-local-development-services-cq5rfnpcm
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Running local development services | daily.dev
og:description: A Nix tutorial shows how to run local development services inside a lightweight NixOS VM managed by systemd instead of a separate process manager. It uses a...
og:url: https://daily.dev/posts/running-local-development-services-cq5rfnpcm
og:image: https://api.daily.dev/og/posts/Cq5rFnpcM.png
og:image:alt: Running local development services
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Running local development services

**[Planet Haskell](https://daily.dev/sources/phaskell)** · 10 min read · 0 upvotes · 0 comments

## Summary

A Nix tutorial shows how to run local development services inside a lightweight NixOS VM managed by systemd instead of a separate process manager. It uses a helper function with nixosSystem to build a QEMU VM from standard NixOS modules, so Nixpkgs service modules like PostgreSQL and FerretDB can run locally in the same form used for production. A production.nix file holds the base service config, while local.nix layers dev-only overrides like forwarded ports and trusted auth. The devShell exposes a 'vm' command and connection env vars, and the VM could also be launched in CI for integration tests. Logs can be browsed with the lazyjournal TUI.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://tweag.io/blog/2026-10-29-running-local-dev-services-with-nix>

## Questions this post answers

### How can I run real NixOS service modules like PostgreSQL locally instead of using devenv or devbox?

Build a lightweight NixOS VM with QEMU using nixosSystem and reuse the exact Nixpkgs service modules you'd deploy in production, orchestrated by systemd. A helper function wraps lib.nixosSystem to produce a VM package, and a devShell script launches it with 'nix run .', giving you production-identical PostgreSQL and FerretDB services with forwarded ports for local access.

_daily.dev surfaces practical Nix and NixOS workflows for developers weighing devenv against real systemd setups._

### How do I keep production and local development NixOS configurations in sync without duplicating service definitions?

Split configuration into two modules: production.nix defines the baseline services such as PostgreSQL and FerretDB exactly as deployed, while local.nix layers development-only overrides like relaxed authentication and forwarded ports. Because the NixOS module system merges declarations automatically, local.nix overlays cleanly onto production.nix without touching the base service definition.

_developers maintaining parity between prod and local setups can track patterns like this on daily.dev._

### How can I view systemd service logs in a terminal UI when working inside a local development VM?

Install lazyjournal, a terminal UI tool for browsing systemd journal logs, by adding pkgs.lazyjournal to environment.systemPackages in the local NixOS configuration. After starting the VM, running 'lazyjournal' in the console gives a dashboard-style view of service logs without leaving the terminal.

_daily.dev helps developers discover terminal tooling like this for debugging local service stacks._

## Similar posts on daily.dev

- [Quick VMs with NixOS](https://daily.dev/posts/quick-vms-with-nixos-zsfesgiw8) · Jacek Galowicz · 0 upvotes · 0 comments
- [NixOS first impressions: writing system-level tests](https://daily.dev/posts/nixos-first-impressions-writing-system-level-tests-o6sjlaois) · Advanced Web Machinery · 3 upvotes · 0 comments
- [NixOS is making me less afraid](https://daily.dev/posts/nixos-is-making-me-less-afraid-yitvudqxq) · Hacker News · 0 upvotes · 0 comments
- [Building \(systems\) software with Nix](https://daily.dev/posts/building-systems-software-with-nix-jbw3o8thj) · Lobsters · 1 upvotes · 0 comments

---

Tags: [#linux](https://daily.dev/tags/linux), [#postgresql](https://daily.dev/tags/postgresql), [#nixos](https://daily.dev/tags/nixos)

[View this post on daily.dev](https://daily.dev/posts/running-local-development-services-cq5rfnpcm)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Running local development services","url":"https://daily.dev/posts/running-local-development-services-cq5rfnpcm","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/running-local-development-services-cq5rfnpcm"},"datePublished":"2026-10-29T14:39:54.949Z","dateModified":"2026-10-29T14:40:36.694Z","description":"A Nix tutorial shows how to run local development services inside a lightweight NixOS VM managed by systemd instead of a separate process manager. It uses a...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/2cd75240e9c00fa395f38ee33134f946?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/2cd75240e9c00fa395f38ee33134f946?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Planet Haskell","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Planet Haskell","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/cd3e48fb3b974d10993a5b5b8dcb8a08","url":"https://daily.dev/sources/phaskell"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/running-local-development-services-cq5rfnpcm","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"linux,postgresql,nixos","timeRequired":"PT10M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Planet Haskell","item":"https://daily.dev/sources/phaskell"},{"@type":"ListItem","position":3,"name":"Running local development services"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/running-local-development-services-cq5rfnpcm#faq","mainEntity":[{"@type":"Question","name":"How can I run real NixOS service modules like PostgreSQL locally instead of using devenv or devbox?","acceptedAnswer":{"@type":"Answer","text":"Build a lightweight NixOS VM with QEMU using nixosSystem and reuse the exact Nixpkgs service modules you'd deploy in production, orchestrated by systemd. A helper function wraps lib.nixosSystem to produce a VM package, and a devShell script launches it with 'nix run .', giving you production-identical PostgreSQL and FerretDB services with forwarded ports for local access. daily.dev surfaces practical Nix and NixOS workflows for developers weighing devenv against real systemd setups."}},{"@type":"Question","name":"How do I keep production and local development NixOS configurations in sync without duplicating service definitions?","acceptedAnswer":{"@type":"Answer","text":"Split configuration into two modules: production.nix defines the baseline services such as PostgreSQL and FerretDB exactly as deployed, while local.nix layers development-only overrides like relaxed authentication and forwarded ports. Because the NixOS module system merges declarations automatically, local.nix overlays cleanly onto production.nix without touching the base service definition. developers maintaining parity between prod and local setups can track patterns like this on daily.dev."}},{"@type":"Question","name":"How can I view systemd service logs in a terminal UI when working inside a local development VM?","acceptedAnswer":{"@type":"Answer","text":"Install lazyjournal, a terminal UI tool for browsing systemd journal logs, by adding pkgs.lazyjournal to environment.systemPackages in the local NixOS configuration. After starting the VM, running 'lazyjournal' in the console gives a dashboard-style view of service logs without leaving the terminal. daily.dev helps developers discover terminal tooling like this for debugging local service stacks."}}]}
```

