buildbot/nix-eval Build done.
buildbot/nix-build Build done.
buildbot/nix-effects Build done.
Build images / Build (bitwarden) (push) Failing after 40s
Build images / Build (builder) (push) Failing after 1m7s
Build images / Build (immich) (push) Failing after 34s
Build images / Build (sword-container-builder) (push) Failing after 34s
Build images / Build (vm-test) (push) Failing after 34s
68 lines
1.4 KiB
Nix
68 lines
1.4 KiB
Nix
{ nix2container, lib, ... }:
|
|
|
|
rec {
|
|
baseImage =
|
|
pkgs:
|
|
mkImage {
|
|
inherit pkgs;
|
|
name = "src.thehellings.com/greg/base";
|
|
};
|
|
|
|
baseLayer =
|
|
pkgs: with pkgs; rec {
|
|
copyToRoot = deps;
|
|
deps = [
|
|
(pkgs.buildEnv {
|
|
name = "base-env";
|
|
paths = [
|
|
bashInteractive
|
|
cacert
|
|
coreutils-full
|
|
dockerTools.binSh
|
|
dockerTools.caCertificates
|
|
dockerTools.shadowSetup
|
|
dockerTools.usrBinEnv
|
|
findutils
|
|
gnugrep
|
|
gnused
|
|
];
|
|
})
|
|
];
|
|
};
|
|
|
|
foldLayers =
|
|
let
|
|
merge =
|
|
parents: current:
|
|
let
|
|
layer = nix2container.buildLayer (
|
|
current
|
|
// {
|
|
layers = parents;
|
|
}
|
|
);
|
|
in
|
|
parents ++ [ layer ];
|
|
in
|
|
layers: lib.foldl merge [ ] layers;
|
|
|
|
mkImage =
|
|
pkgs: config:
|
|
let
|
|
base = baseLayer pkgs;
|
|
path = pkgs.lib.makeBinPath (base.deps ++ lib.flatten (builtins.map (e: e.deps) config.layers));
|
|
in
|
|
nix2container.buildImage (
|
|
(lib.mergeAttrs {
|
|
tag = "latest";
|
|
config = {
|
|
Env = [ "PATH=${path}" ];
|
|
Cmd = [ "${pkgs.bashInteractive}/bin/bash" ];
|
|
};
|
|
} config)
|
|
// {
|
|
layers = foldLayers ([ base ] ++ config.layers);
|
|
}
|
|
);
|
|
}
|