88 lines
2.4 KiB
Nix
88 lines
2.4 KiB
Nix
{
|
|
description = "docker base images";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils }:
|
|
let
|
|
system = "x86_64-linux";
|
|
pkgs = import nixpkgs { inherit system; };
|
|
in
|
|
{
|
|
packages = {
|
|
hello = pkgs.dockerTools.buildImage {
|
|
name = "hello-docker";
|
|
config = {
|
|
Cmd = [ "${pkgs.hello}/bin/hello" ];
|
|
};
|
|
};
|
|
flakes-action = pkgs.dockerTools.buildImageWithNixDb {
|
|
name = "code.252.no/tommy/flakes-action";
|
|
tag = "latest";
|
|
copyToRoot = pkgs.buildEnv {
|
|
name = "image-root";
|
|
pathsToLink = ["/bin" "/etc"];
|
|
ignoreCollisions = true;
|
|
paths = with pkgs; [
|
|
coreutils-full
|
|
docker
|
|
bash
|
|
cacert
|
|
coreutils
|
|
curl
|
|
gawk
|
|
gitFull
|
|
git-lfs
|
|
gnused
|
|
gnutar
|
|
gzip
|
|
nixVersions.stable
|
|
nodejs
|
|
openssh
|
|
sudo
|
|
wget
|
|
xz
|
|
zstd
|
|
(pkgs.writeTextFile {
|
|
name = "nix.conf";
|
|
destination = "/etc/nix/nix.conf";
|
|
text = ''
|
|
accept-flake-config = true
|
|
experimental-features = nix-command flakes
|
|
'';
|
|
})
|
|
];
|
|
};
|
|
|
|
extraCommands = ''
|
|
# for /usr/bin/env
|
|
mkdir usr
|
|
ln -s ../bin usr/bin
|
|
|
|
# make sure /tmp exists
|
|
mkdir -m 1777 tmp
|
|
|
|
# need a HOME
|
|
mkdir -vp root
|
|
'';
|
|
config = {
|
|
Cmd = ["/bin/bash"];
|
|
Env = [
|
|
"NIX_PATH=nixpkgs=${nixpkgs}"
|
|
"LANG=en_GB.UTF-8"
|
|
"ENV=/etc/profile.d/nix.sh"
|
|
"BASH_ENV=/etc/profile.d/nix.sh"
|
|
"NIX_BUILD_SHELL=/bin/bash"
|
|
"PAGER=cat"
|
|
"PATH=/usr/bin:/bin"
|
|
"SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
|
|
"USER=root"
|
|
];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|