feat(nix): Import nixpkgs from a configured Nix channel

Instead of using whatever the current system default is, import a Nix
channel when building an image.

This will use Nix' internal caching behaviour for tarballs fetched
without a SHA-hash.

For now the downloaded channel is pinned to nixos-19.03.
This commit is contained in:
Vincent Ambo 2019-07-24 17:53:08 +00:00
parent 948f308025
commit 6dd0ac3189
2 changed files with 17 additions and 6 deletions

View file

@ -34,10 +34,16 @@
# plenty of room for extension. I believe the actual maximum is
# 128.
maxLayers ? 24,
# Nix package set to use
pkgs ? (import <nixpkgs> {})
# Nix channel to use
channel ? "nixos-19.03"
}:
# Import the specified channel directly from Github.
let
channelUrl = "https://github.com/NixOS/nixpkgs-channels/archive/${channel}.tar.gz";
pkgs = import (builtins.fetchTarball channelUrl) {};
in
# Since this is essentially a re-wrapping of some of the functionality that is
# implemented in the dockerTools, we need all of its components in our top-level
# namespace.