Skip to content

Instantly share code, notes, and snippets.

@aespinosa
Last active April 9, 2016 21:55
Show Gist options
  • Save aespinosa/6c979bebfda9d78b181a95e08524ef72 to your computer and use it in GitHub Desktop.
Save aespinosa/6c979bebfda9d78b181a95e08524ef72 to your computer and use it in GitHub Desktop.
building a nix docker image
with import <nixpkgs> {};
let
niximage = dockerTools.buildImage {
name = "nix";
tag = "1.11.2";
contents = [ nix cacert bash ];
};
nixpkgs = import /nix/store/xxxxx-nixpkgs.drv;
in
dockerTools.buildImage {
name = "nix";
tag = "1.11.2";
fromImage = niximage;
runAsRoot = ''
#!${stdenv.shell}
set -xe
${dockerTools.shadowSetup}
mkdir -p /home
useradd -m user
mkdir /tmp && chmod 777 /tmp
'';
config = {
User = "user";
Env = ["HOME=/home/user" "NIX_PATH=nixpkgs=/nixpkgs" "SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt"];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment