Skip to content

Custom Docker images with the Nix package manager (built with Nix!)

License

Notifications You must be signed in to change notification settings

monacoremo/nix-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Custom Docker images with the Nix package manager

CircleCI

Forked from LnL7/nix-docker

This repository is used to build custom Docker images that contain the Nix package manager. Whereas the official docker images for Nix are currently based on Alpine, the images from this repository are built from scratch and look a lot more like NixOS.

Building images

To build the images and tag them in your Docker instance, run nix-shell --run nix-docker-build.

nix-shell --run nix-docker-all will take care of building the images, pushing them to DockerHub and cleaning up the tags in Docker.

Versions

All images are pinned to a specific version of nixpks-unstable, as identified by the Git commit hash and, for convenenience, the date when that version was pinned. All versions that have been pinned are tracked in the versions directory. To add a new version based on the current HEAD of nixpkgs-unstable, run the ./update.sh script (optionally in nix-shell, which provides the dependencies on curl and jq).

To build specific versions of the images, provide your version file as an argument to nix-shell. For example: nix-shell --arg version versions/2020-01-14-f9c81b5c.nix. A version file should contain a Nix expression that returns a set with the attributes date, rev and tarballHash.

While you probably will not depend on the version of nixpkgs that is pinned in the container and you are pining your own version in your projects, having the same version in pinned both will make spinning up the container with your project much quicker.

Image variants

Several kinds of images are built in this repository:

  • The base image contains Nix, bash and coreutils, which are installed in a system profile that is linked to /run/current-system/sw. The only global paths are /bin/sh and /usr/bin/env.
  • userenv images are intended for interactive use.
  • circleci images are intended as an efficient base for CircleCI jobs that depend on Nix packages.

Using the images

The images built with this repository are available on Docker Hub.

To use the images you can, for example, run nix-shell in them with your project. You can also install additional packages to the container's enviroment, for example with the following Dockerfile:

FROM monacoremo/nix:2020-01-31-62bbc2ab

RUN nix-env -iA \
 nixpkgs.curl \
 nixpkgs.jq

About

Custom Docker images with the Nix package manager (built with Nix!)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published