Files
ci-images/img/builder.nix
T

89 lines
1.5 KiB
Nix
Raw Normal View History

2025-11-25 22:42:47 -06:00
{
2025-12-29 19:47:30 -06:00
buildah,
2026-05-10 01:51:35 -05:00
curl,
fakeNss,
2025-11-25 22:42:47 -06:00
git,
2026-05-07 10:40:27 -05:00
lib,
2026-01-22 23:52:55 -06:00
lib',
2025-11-25 22:42:47 -06:00
nix,
nix-output-monitor,
2026-01-23 00:13:46 -06:00
nodejs_24,
2025-11-25 22:42:47 -06:00
podman,
2026-01-22 23:52:55 -06:00
writeTextFile,
2025-11-25 22:42:47 -06:00
name,
...
}:
let
policy = (
2026-01-22 23:52:55 -06:00
writeTextFile {
2025-11-25 22:42:47 -06:00
name = "policy.json";
text = ''
{
"default": [{"type": "insecureAcceptAnything"}]
}
'';
destination = "/etc/containers/policy.json";
}
);
2026-01-23 18:01:35 -06:00
nix-conf = writeTextFile {
name = "nix.conf";
text = ''
extra-experimental-features = nix-command flakes
'';
destination = "/etc/nix/nix.conf";
};
2026-05-10 01:31:11 -05:00
bashrc = writeTextFile {
name = "bashrc";
text = ''
2026-05-10 01:38:58 -05:00
echo "Loading bashrc"
2026-05-10 01:31:11 -05:00
export PATH=${lib.makeBinPath contents}
'';
destination = "/etc/bashrc";
};
2026-05-10 01:38:58 -05:00
profile = writeTextFile {
name = "profile";
text = ''
echo "Loading profile"
export PATH=${lib.makeBinPath contents}
'';
destination = "/etc/profile";
};
2026-01-23 17:54:24 -06:00
contents = lib'.basePackages ++ [
2026-01-23 17:48:04 -06:00
buildah
2026-05-10 01:51:35 -05:00
curl
(fakeNss.override {
extraPasswdLines = [
"nixbld:x:1001:1001:Build user:/home/nixbld:/noshell"
];
extraGroupLines = [
"nixbld:!:1001:nixbld"
];
})
2026-01-23 17:48:04 -06:00
git
nix
2026-01-23 18:01:35 -06:00
nix-conf
2026-01-23 17:48:04 -06:00
nix-output-monitor
nodejs_24
podman
policy
2026-01-22 23:52:55 -06:00
];
2026-05-07 10:40:27 -05:00
in
lib'.mkImage {
name = name "builder";
2026-05-10 01:31:11 -05:00
config.Env = [
"TEMP=/tmp"
"PATH=${lib.makeBinPath contents}"
];
# Set this explicitly so that we avoid infinite recursion
2026-05-10 01:38:58 -05:00
contents = contents ++ [
bashrc
profile
];
2026-01-30 00:07:07 -06:00
extraCommands = ''
mkdir -p tmp
mkdir -p var/tmp
'';
2026-01-23 17:48:04 -06:00
includeNixDB = true;
2026-01-22 23:52:55 -06:00
}