Builder is working, kinda
Build images / Build (bitwarden) (push) Failing after 1s
Build images / Build (builder) (push) Failing after 1s
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 (vm-test) (push) Failing after 1s

This commit is contained in:
Greg Hellings
2026-01-22 23:52:55 -06:00
parent 9f4f97ad55
commit 9a231f8c25
4 changed files with 99 additions and 93 deletions
+1 -2
View File
@@ -20,6 +20,5 @@ jobs:
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v5
- run: | - run: |
nix build ".#${{ matrix.image }}" nix run ".#${{ matrix.image }}.importToPodman"
podman import result "src.thehellings.com/greg/${{ matrix.image }}"
podman images podman images
+8 -4
View File
@@ -28,24 +28,28 @@
... ...
}: }:
let let
lib' = import ./lib { inherit (pkgs) lib; }; lib' = import ./lib.nix {
inherit (inputs.nix2container.packages.${system}) nix2container;
inherit (pkgs) lib;
};
in in
{ {
_module.args = { _module.args = {
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
config.allowUnfree = true; config.allowUnfree = true;
};
lib = lib'; lib = lib';
}; };
};
packages = packages =
let let
inherit (pkgs) callPackage; inherit (pkgs) callPackage;
name = n: "registry.thehellings.com/greg/ci-images/${n}"; name = n: "src.thehellings.com/greg/${n}";
in in
{ {
base = lib'.baseImage pkgs;
bitwarden = callPackage ./img/bitwarden.nix { inherit name; }; bitwarden = callPackage ./img/bitwarden.nix { inherit name; };
builder = callPackage ./img/builder.nix { inherit name; }; builder = callPackage ./img/builder.nix { inherit name lib'; };
immich = callPackage ./img/immich.nix { inherit name; }; immich = callPackage ./img/immich.nix { inherit name; };
sword-container-builder = callPackage ./img/sword-container-builder.nix { inherit name; }; sword-container-builder = callPackage ./img/sword-container-builder.nix { inherit name; };
vm-test = callPackage ./img/vm-test.nix { inherit name; }; vm-test = callPackage ./img/vm-test.nix { inherit name; };
+22 -39
View File
@@ -1,21 +1,19 @@
{ {
bashInteractive,
buildah, buildah,
dockerTools,
git, git,
lib, lib',
nix, nix,
nix-output-monitor, nix-output-monitor,
pkgs, pkgs,
podman, podman,
writeShellApplication, writeTextFile,
name, name,
... ...
}: }:
let let
policy = ( policy = (
pkgs.writeTextFile { writeTextFile {
name = "policy.json"; name = "policy.json";
text = '' text = ''
{ {
@@ -25,49 +23,34 @@ let
destination = "/etc/containers/policy.json"; destination = "/etc/containers/policy.json";
} }
); );
activate = writeShellApplication { nix-conf = writeTextFile {
name = "activate"; name = "nix.conf";
runtimeInputs = [ bashInteractive ];
text = '' text = ''
mkdir -p /etc/containers experimental-features = nix-command flakes
cp ${policy}/etc/containers/policy.json /etc/containers/policy.json;
bash "$@"
''; '';
destination = "/etc/nix/nix.conf";
}; };
in in
(import "${nix.src.outPath}/docker.nix" { lib'.mkImage pkgs {
inherit pkgs;
name = name "builder"; name = name "builder";
tag = "latest"; copyToRoot = pkgs.buildEnv {
name = "policy";
bundleNixpkgs = false; paths = [
Cmd = [ policy
(lib.getExe activate) nix-conf
]; ];
extraPkgs = [ };
initializeNixDatabase = true;
layers = [
{
deps = [
buildah buildah
dockerTools.caCertificates git
nix
nix-output-monitor nix-output-monitor
podman podman
policy policy
]; ];
flake-registry = (pkgs.formats.json { }).generate "flake-registry.json" ({ }
version = 2;
flakes.nixpkgs = {
exact = true;
from = {
id = "nixpkgs";
type = "indirect";
};
to = "${pkgs.path}";
};
});
gitMinimal = git; # We want the full version in this
maxLayers = 111;
nixConf = {
experimental-features = [
"nix-command"
"flakes"
]; ];
}; }
})
+44 -24
View File
@@ -1,45 +1,65 @@
{ lib, nix2container, pkgs, ... }: { nix2container, lib, ... }:
lib.extend ( rec {
final: prev: { baseImage =
img = { pkgs:
baseImage = final.img.mkImage { mkImage {
name = "base"; inherit pkgs;
layers = [ name = "src.thehellings.com/greg/base";
(final.img.baseLayer pkgs)
];
}; };
baseLayer = pkgs: with pkgs; { baseLayer =
pkgs: with pkgs; {
deps = [ deps = [
(pkgs.buildEnv {
name = "base-env";
paths = [
bashInteractive bashInteractive
coreutils coreutils-full
dockerTools.binSh dockerTools.binSh
dockerTools.caCertificates dockerTools.caCertificates
dockerTools.shadowSetup
dockerTools.usrBinEnv dockerTools.usrBinEnv
findutils findutils
gnugrep gnugrep
gnused gnused
]; ];
})
];
}; };
foldLayers = let foldLayers =
merge = parents: current: let let
layer = nix2container.buildlayer( current // { merge =
parents: current:
let
layer = nix2container.buildLayer (
current
// {
layers = parents; layers = parents;
}); }
);
in in
parents ++ [ layer ]; parents ++ [ layer ];
in in
layers: final.foldl merge [] layers; layers: lib.foldl merge [ ] layers;
mkImage = { mkImage =
name, pkgs: config:
layers ? [], let
}: nix2container.buildImage { base = baseLayer pkgs;
inherit name; path = pkgs.lib.makeBinPath (base.deps ++ lib.flatten (builtins.map (e: e.deps) config.layers));
layers = final.img.foldLayers layers; in
}; nix2container.buildImage (
(lib.mergeAttrs {
tag = "latest";
config = {
Env = [ "PATH=${path}" ];
Cmd = [ "${pkgs.bashInteractive}/bin/bash" ];
}; };
} config)
// {
layers = foldLayers ([ base ] ++ config.layers);
}
);
} }
)