Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # To build and use it:
- # nix-build docker-nix.nix -A hydraServer && docker load < result && docker run -it nix bash
- # In the container:
- # nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
- # nix-channel --update # and this fails
- {pkgs ? import <nixpkgs> {}}:
- let
- nixInit = ''
- mkdir tmp
- mkdir root
- echo "root:x:0:0::/root:/bin/bash" >> etc/passwd
- echo "nixbld:x:30000:nixbld1,nixbld2,nixbld3,nixbld4,nixbld5,nixbld6,nixbld7,nixbld8,nixbld9,nixbld10,nixbld11,nixbld12,nixbld13,nixbld14,nixbld15,nixbld16,nixbld17,nixbld18,nixbld19,nixbld20,nixbld21,nixbld22,nixbld23,nixbld24,nixbld25,nixbld26,nixbld27,nixbld28,nixbld29,nixbld30" >> etc/group
- for i in $(seq 1 30); do echo "nixbld$i:x:$((30000 + $i)):30000:::" >> etc/passwd; done \
- '';
- in
- {
- hydraServer = pkgs.dockerTools.buildImage rec {
- name = "nix";
- contents = [
- pkgs.coreutils
- # debug
- pkgs.nix pkgs.bash-completion pkgs.ncurses pkgs.bashInteractive
- pkgs.netcat pkgs.curlFull
- # pkgs.emacs25-nox
- ];
- extraCommands = ''
- # There is a bug in the docker builder
- chmod a+w ../layer
- # Should be move to docker build expression. This is used resolv
- # dns names from hosts file.
- chmod 0750 etc
- echo 'hosts: files dns' > etc/nsswitch.conf
- mkdir -p etc/ssl/certs
- ln -s ${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt etc/ssl/certs/ca-certificates.crt
- '' + nixInit;
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement