Skip to content

Instantly share code, notes, and snippets.

@rickynils
Created November 12, 2015 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rickynils/7ac8c2acd7d0af0edd64 to your computer and use it in GitHub Desktop.
Save rickynils/7ac8c2acd7d0af0edd64 to your computer and use it in GitHub Desktop.
nix-deployable ACI images
{ stdenv, gzip, rkt, goPackages, pythonPackages }:
stdenv.mkDerivation rec {
name = "rkt-test";
buildInputs = [ gzip rkt goPackages.acbuild ];
phases = [ "buildPhase" "installPhase" "fixupPhase" ];
buildPhase = ''
acbuild begin
acbuild label add arch amd64
acbuild label add os linux
acbuild mount add nix-store /nix/store
acbuild set-exec "${pythonPackages.ipython}/bin/ipython"
acbuild set-name "${name}"
acbuild write image.aci
acbuild end
'';
installPhase = ''
# Unzip the ACI image so nix can pick up the store dependencies
gzip -dc image.aci > $out
'';
}
$ nix-store -qR result
/nix/store/5l472kj6h5zvccpzp0zcdpc1w2njfd58-linux-headers-3.12.32
/nix/store/hd6km3hscbgl2yw8nx7lr5z9s8h89p04-glibc-2.21
/nix/store/31w31mc8immhpnmxvcl4l0fvc3i5iwh0-zlib-1.2.8
/nix/store/q04znh7k9pcagcxqmlxz0qqsdfki0scw-python-recursive-pth-loader-1.0
/nix/store/8z667vv1agvpd3iknmk94j0ix6bv413i-attr-2.4.47
/nix/store/sk0b1r840b686zc2m8mzyw8yyq1aymqh-acl-2.2.52
/nix/store/8xfxnm4a7jvyh0i1sd967z6rws8lh21a-coreutils-8.24
/nix/store/w0ml3zjnqawcw2dlamn9q3pilplmgryi-openssl-1.0.1p
/nix/store/xag5ayq906w9zhlxs8wayv4kvpiyqphq-bash-4.3-p42
/nix/store/zjrzznvaa10kli1bfak52857s8wi34zg-bzip2-1.0.6
/nix/store/v9pq6f0s1r5fdybqc7pbv7mkb33lx9yy-python-2.7.10
/nix/store/x3gfdavv38ghprna3z47grarwblgwb7f-python2.7-setuptools-18.2
/nix/store/ki2100gmy0pfh0b13a26gbky54bwcsav-python2.7-decorator-3.4.2
/nix/store/s7sznbis7i2a44lrijis1c18xppvds7y-python2.7-ipython_genutils-0.1.0
/nix/store/334sqp2a7qph899z7zwa75dfg3dd6wc6-python2.7-traitlets-4.0.0
/nix/store/3fwq3lg8pqjkr32gwkhrnbdfac3hb02b-python2.7-pexpect-3.3
/nix/store/4i01mpa2s194m44xrz41wmf4yr49jysq-ncurses-5.9
/nix/store/al6rk7d6awlihk5rp53bzxhsz8sc6al7-python2.7-path.py-7.6
/nix/store/a1rj4qzxlkbdnnzfnbsqm856mj6435s0-python2.7-pickleshare-0.5
/nix/store/bdv10gid5sn2m8vihjggngcwyh8dwaxn-python2.7-requests-1.2.3
/nix/store/9ais7ngz6njw3x2b8yj34cxgv1pwfvbj-readline-6.3p08
/nix/store/g3j63387k3w5ryjhgvx2gf3ak0255akx-python-readline-2.7.10
/nix/store/z35b0yjmrhhl0cfxrkymf4387i3pjkjm-sqlite-3.8.11.1
/nix/store/mmlxwns3p2xa9c0h39k9zkfa4gcn1mwq-python-sqlite3-2.7.10
/nix/store/mrj3wnick0sibf6ah1yfijqr7rpp3zwd-python2.7-simplegeneric-0.8.1
/nix/store/mb04lzb6jck4ndzga6268xci8ldlyma8-python2.7-ipython-4.0.0
/nix/store/5fcbby9vag5wxbzy9amaa5y0k76w33w1-rkt-test
$ sudo rkt run --insecure-skip-verify --interactive --volume nix-store,kind=host,source=/nix/store result
rkt: using image from local store for image name coreos.com/rkt/stage1-coreos:0.10.0
rkt: using image from file /home/rickard/workspace/nix-rkt/result
run: group "rkt" not found, will use default gid when rendering images
/nix/store/mb04lzb6jck4ndzga6268xci8ldlyma8-python2.7-ipython-4.0.0/lib/python2.7/site-packages/IPython/paths.py:69: UserWarning: IPython parent '/root' is not a writable location, using a temp directory.
" using a temp directory.".format(parent))
Python 2.7.10 (default, Jan 01 1970, 00:00:01)
Type "copyright", "credits" or "license" for more information.
IPython 4.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment