forked from github-mirror/docker-nixpkgs
nix: redefine in terms of nix-container-images
This commit is contained in:
@@ -1,56 +1,27 @@
|
|||||||
{ dockerTools
|
{ path, lib, nix }:
|
||||||
, bash
|
|
||||||
, cacert
|
|
||||||
, coreutils
|
|
||||||
, curl
|
|
||||||
, gitMinimal
|
|
||||||
, gnutar
|
|
||||||
, gzip
|
|
||||||
, iana-etc
|
|
||||||
, nix
|
|
||||||
, xz
|
|
||||||
}:
|
|
||||||
let
|
let
|
||||||
image = dockerTools.buildImageWithNixDb {
|
channel =
|
||||||
inherit (nix) name;
|
builtins.replaceStrings
|
||||||
|
["\n"]
|
||||||
|
[""]
|
||||||
|
"nixos-${builtins.readFile "${path}/.version"}";
|
||||||
|
in
|
||||||
|
lib.makeImage {
|
||||||
|
image = {
|
||||||
|
name = "nix";
|
||||||
|
tag = "latest";
|
||||||
|
|
||||||
contents = [
|
run = ''
|
||||||
./root
|
chmod u+w root
|
||||||
coreutils
|
echo 'https://nixos.org/channels/${channel} nixpkgs' > root/.nix-channels
|
||||||
# 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 = {
|
interactive = true;
|
||||||
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"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
environment.systemPackages = [ nix ];
|
||||||
|
nix = {
|
||||||
|
enable = true;
|
||||||
|
useSandbox = false;
|
||||||
|
package = nix;
|
||||||
};
|
};
|
||||||
in
|
}
|
||||||
image // { meta = nix.meta // image.meta; }
|
|
||||||
|
|||||||
Reference in New Issue
Block a user