Files
ci-images/lib.nix
T
Greg Hellings 56717a844d
Build images / Build (immich) (push) Failing after 1s
Build images / Build (sword-container-builder) (push) Failing after 1s
buildbot/nix-eval Build done.
buildbot/nix-build Build done.
buildbot/nix-effects Build done.
Build images / Build (bitwarden) (push) Failing after 12s
Build images / Build (builder) (push) Failing after 39s
Build images / Build (vm-test) (push) Failing after 1s
More things in FHS
2026-01-22 23:56:59 -06:00

67 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
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);
}
);
}