Back to just dockerTools
buildbot/nix-eval Build done.
buildbot/nix-build Build done.
buildbot/nix-effects Build done.
Build images / Build (bitwarden) (push) Failing after 27s
Build images / Build (immich) (push) Failing after 2s
Build images / Build (sword-container-builder) (push) Failing after 2s
Build images / Build (builder) (push) Failing after 2s
Build images / Build (vm-test) (push) Failing after 2s

This commit is contained in:
Greg Hellings
2026-01-23 17:48:04 -06:00
parent d6a1f4fb86
commit 5e98d29183
4 changed files with 37 additions and 135 deletions
Generated
+5 -39
View File
@@ -18,35 +18,18 @@
"type": "github"
}
},
"nix2container": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1767430085,
"narHash": "sha256-SiXJ6xv4pS2MDUqfj0/mmG746cGeJrMQGmoFgHLS25Y=",
"owner": "nlewo",
"repo": "nix2container",
"rev": "66f4b8a47e92aa744ec43acbb5e9185078983909",
"type": "github"
},
"original": {
"owner": "nlewo",
"repo": "nix2container",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1767028467,
"narHash": "sha256-7G+2aXClSMaTY1ogpX14CAxjRsvyVzpE0GRwL71WO7g=",
"lastModified": 1763934636,
"narHash": "sha256-9glbI7f1uU+yzQCq5LwLgdZqx6svOhZWkd4JRY265fc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1cabc318c11299f07ca53e3cb719854682fe6eb3",
"rev": "ee09932cedcef15aaf476f9343d1dea2cb77e261",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
@@ -66,27 +49,10 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1763934636,
"narHash": "sha256-9glbI7f1uU+yzQCq5LwLgdZqx6svOhZWkd4JRY265fc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ee09932cedcef15aaf476f9343d1dea2cb77e261",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"nix2container": "nix2container",
"nixpkgs": "nixpkgs_2"
"nixpkgs": "nixpkgs"
}
}
},
+1 -3
View File
@@ -2,7 +2,6 @@
description = "Standard images that Greg wants to build";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nix2container.url = "github:nlewo/nix2container";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
@@ -29,8 +28,7 @@
}:
let
lib' = import ./lib.nix {
inherit (inputs.nix2container.packages.${system}) nix2container;
inherit (pkgs) lib;
inherit pkgs;
};
in
{
+10 -32
View File
@@ -24,39 +24,17 @@ let
destination = "/etc/containers/policy.json";
}
);
nix-conf = writeTextFile {
name = "nix.conf";
text = ''
experimental-features = nix-command flakes
'';
destination = "/etc/nix/nix.conf";
};
in
lib'.mkImage pkgs {
lib'.mkImage {
name = name "builder";
copyToRoot = pkgs.buildEnv {
name = "policy";
paths = [
policy
nix-conf
];
};
initializeNixDatabase = true;
layers = [
{
deps = [
buildah
git
nix
nix-output-monitor
podman
policy
];
}
{
deps = [
nodejs_24
];
}
contents = [
buildah
git
nix
nix-output-monitor
nodejs_24
podman
policy
];
includeNixDB = true;
}
+21 -61
View File
@@ -1,70 +1,30 @@
{ nix2container, lib, ... }:
{ pkgs, ... }:
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;
{
basePackages = with pkgs; rec {
copyToRoot = paths;
paths = [
bashInteractive
cacert
coreutils-full
dockerTools.binSh
dockerTools.caCertificates
dockerTools.shadowSetup
dockerTools.usrBinEnv
findutils
gnugrep
gnused
];
};
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 {
options:
pkgs.dockerTools.buildLayeredImage (
pkgs.lib.mergeAttrs {
tag = "latest";
config = {
Env = [
"PATH=${path}"
"USER=nobody"
];
Cmd = [ "${pkgs.bashInteractive}/bin/bash" ];
};
} config)
// {
layers = foldLayers ([ base ] ++ config.layers);
}
} options
);
}