# Using Nix with Dockerfiles

DevFeed: [Using Nix with Dockerfiles](<https://devfeed.tech/articles/using-nix-with-dockerfiles-51446.md>)

Original publisher: [Read original article](<https://mitchellh.com/writing/nix-with-dockerfiles>)

Published: 2023-04-23T00:00:00Z

Content type: tutorial

Language: en

Sources: [Mitchell Hashimoto](<https://devfeed.tech/sources/mitchell-hashimoto.md>)

Topics: [Nix](<https://devfeed.tech/topics/nix.md>), [Dockerfile](<https://devfeed.tech/topics/dockerfile.md>), [Package Management](<https://devfeed.tech/topics/package-management.md>), [Continuous integration](<https://devfeed.tech/topics/continuous-integration.md>), [cross-platform](<https://devfeed.tech/topics/cross-platform.md>)

Tags: [build](<https://devfeed.tech/tags/build.md>), [ci](<https://devfeed.tech/tags/ci.md>), [cross-platform](<https://devfeed.tech/tags/cross-platform.md>), [development-environment](<https://devfeed.tech/tags/development-environment.md>), [docker](<https://devfeed.tech/tags/docker.md>), [docker-compose](<https://devfeed.tech/tags/docker-compose.md>), [dockerfiles](<https://devfeed.tech/tags/dockerfiles.md>), [nix](<https://devfeed.tech/tags/nix.md>), [package-management](<https://devfeed.tech/tags/package-management.md>), [software](<https://devfeed.tech/tags/software.md>)

## AI overview

This tutorial explains how pairing Nix with Dockerfiles can provide a consistent software environment across local development, CI, and production. It contrasts this approach with separately maintained environment definitions and introduces a basic example.

## Source excerpt

Using Nix with Dockerfiles Nix is a powerful cross-platform package management tool. The benefits of Nix are far reaching, but one big benefit is that once you adopt Nix, you can get a consistent environment across development (on both Linux and Mac), CI, and production. I've been using Nix for many years and recently started building Docker images using a Dockerfile paired with Nix. This post will explain the benefits of this approach along with a basic example to show how it looks and feels.