forked from github-mirror/docker-nixpkgs
nix: redefine in terms of nix-container-images
This commit is contained in:
@@ -1,56 +1,27 @@
|
||||
{ dockerTools
|
||||
, bash
|
||||
, cacert
|
||||
, coreutils
|
||||
, curl
|
||||
, gitMinimal
|
||||
, gnutar
|
||||
, gzip
|
||||
, iana-etc
|
||||
, nix
|
||||
, xz
|
||||
}:
|
||||
{ path, lib, nix }:
|
||||
let
|
||||
image = dockerTools.buildImageWithNixDb {
|
||||
inherit (nix) name;
|
||||
|
||||
contents = [
|
||||
./root
|
||||
coreutils
|
||||
# add /bin/sh
|
||||
bash
|
||||
nix
|
||||
|
||||
# runtime dependencies of nix
|
||||
cacert
|
||||
gitMinimal
|
||||
gnutar
|
||||
gzip
|
||||
xz
|
||||
|
||||
# for haskell binaries
|
||||
iana-etc
|
||||
];
|
||||
|
||||
extraCommands = ''
|
||||
# for /usr/bin/env
|
||||
mkdir usr
|
||||
ln -s ../bin usr/bin
|
||||
|
||||
# make sure /tmp exists
|
||||
mkdir -m 0777 tmp
|
||||
'';
|
||||
|
||||
config = {
|
||||
Cmd = [ "/bin/bash" ];
|
||||
Env = [
|
||||
"ENV=/etc/profile.d/nix.sh"
|
||||
"NIX_PATH=nixpkgs=channel:nixpkgs-unstable"
|
||||
"PAGER=cat"
|
||||
"PATH=/usr/bin:/bin"
|
||||
"SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt"
|
||||
];
|
||||
};
|
||||
};
|
||||
channel =
|
||||
builtins.replaceStrings
|
||||
["\n"]
|
||||
[""]
|
||||
"nixos-${builtins.readFile "${path}/.version"}";
|
||||
in
|
||||
image // { meta = nix.meta // image.meta; }
|
||||
lib.makeImage {
|
||||
image = {
|
||||
name = "nix";
|
||||
tag = "latest";
|
||||
|
||||
run = ''
|
||||
chmod u+w root
|
||||
echo 'https://nixos.org/channels/${channel} nixpkgs' > root/.nix-channels
|
||||
'';
|
||||
|
||||
interactive = true;
|
||||
};
|
||||
environment.systemPackages = [ nix ];
|
||||
nix = {
|
||||
enable = true;
|
||||
useSandbox = false;
|
||||
package = nix;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user