2023-08-12 07:36:17 +01:00
|
|
|
{
|
|
|
|
description = "docker base images";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs = { self, nixpkgs, flake-utils }:
|
2023-08-12 08:21:33 +01:00
|
|
|
flake-utils.lib.eachDefaultSystem
|
|
|
|
(system:
|
|
|
|
let
|
|
|
|
pkgs = import nixpkgs { inherit system; };
|
|
|
|
pkgsStatic = pkgs.pkgsStatic;
|
|
|
|
lib = pkgs.lib;
|
|
|
|
|
|
|
|
in
|
|
|
|
{
|
|
|
|
packages = {
|
|
|
|
hello = pkgs.dockerTools.buildImage {
|
|
|
|
name = "hello-docker";
|
|
|
|
config = {
|
|
|
|
Cmd = [ "${pkgs.hello}/bin/hello" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
flakes-action = pkgs.dockerTools.buildImageWithNixDb {
|
|
|
|
name = "flakes-action";
|
|
|
|
contents = with pkgs; [
|
|
|
|
./root
|
|
|
|
bash
|
|
|
|
coreutils
|
|
|
|
curl
|
|
|
|
gawk
|
2023-08-12 09:31:36 +01:00
|
|
|
gitFull
|
2023-08-12 08:21:33 +01:00
|
|
|
git-lfs
|
|
|
|
gnused
|
|
|
|
nodejs
|
|
|
|
wget
|
|
|
|
sudo
|
|
|
|
nixFlakes
|
|
|
|
cacert
|
|
|
|
gnutar
|
|
|
|
gzip
|
|
|
|
openssh
|
|
|
|
xz
|
|
|
|
(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" ];
|
2023-08-12 07:36:17 +01:00
|
|
|
Env = [
|
|
|
|
"LANG=en_GB.UTF-8"
|
2023-08-12 08:21:33 +01:00
|
|
|
"ENV=/etc/profile.d/nix.sh"
|
|
|
|
"BASH_ENV=/etc/profile.d/nix.sh"
|
|
|
|
"NIX_BUILD_SHELL=/bin/bash"
|
|
|
|
"NIX_PATH=nixpkgs=${./fake_nixpkgs}"
|
|
|
|
"PAGER=cat"
|
|
|
|
"PATH=/usr/bin:/bin"
|
|
|
|
"SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
|
|
|
|
"USER=root"
|
2023-08-12 07:36:17 +01:00
|
|
|
];
|
2023-08-12 08:21:33 +01:00
|
|
|
};
|
2023-08-12 07:36:17 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-08-12 08:21:33 +01:00
|
|
|
devShells = {
|
|
|
|
default = (pkgs.mkShell {
|
|
|
|
buildInputs = (with pkgs;
|
|
|
|
[
|
|
|
|
git-lfs
|
|
|
|
]);
|
2023-08-12 07:36:17 +01:00
|
|
|
|
2023-08-12 08:21:33 +01:00
|
|
|
});
|
|
|
|
};
|
|
|
|
});
|
2023-08-12 07:36:17 +01:00
|
|
|
}
|
|
|
|
|