|
2 | 2 | inputs,
|
3 | 3 | cell,
|
4 | 4 | }: let
|
5 |
| - inherit (inputs.cicero.packages) cicero-entrypoint cicero webhook-trigger cicero-evaluator-nix; |
6 |
| - inherit (inputs.nixpkgs) lib cacert symlinkJoin closureInfo runCommandNoCC; |
7 |
| - inherit (inputs.n2c.packages.nix2container) buildImage buildLayer; |
| 5 | + inherit (inputs.cicero.packages) webhook-trigger; |
| 6 | + inherit (inputs.nixpkgs) symlinkJoin; |
| 7 | + inherit (inputs.n2c.packages.nix2container) buildImage; |
8 | 8 | in {
|
9 | 9 | # jq < result '.layers | map({size: .size, paths: .paths | map(.path)}) | sort_by(.size) | .[11].paths[]' -r | xargs du -sch
|
10 |
| - cicero = let |
11 |
| - # This must include all dependencies used in the image to allow nix builds |
12 |
| - # in the container (Nix won't know about paths otherwise and fail on trying |
13 |
| - # to write read-only data). |
14 |
| - closure = closureInfo { |
15 |
| - rootPaths = { |
16 |
| - inherit (cell.entrypoints) cicero; |
17 |
| - inherit cacert; |
18 |
| - }; |
19 |
| - }; |
20 |
| - |
21 |
| - global = runCommandNoCC "global" {} '' |
22 |
| - mkdir -p $out $out/etc |
23 |
| - cp ${closure}/registration $out |
24 |
| -
|
25 |
| - echo 'root:x:0:' > $out/etc/group |
26 |
| - echo 'nixbld:x:30000:nixbld1' > $out/etc/group |
27 |
| -
|
28 |
| - echo 'root:!:0:0::/local:/bin/bash' > $out/etc/passwd |
29 |
| - echo 'nixbld1:!:30001:30000:Nix build user 1:/var/empty:/bin/nologin' >> $out/etc/passwd |
30 |
| - ''; |
31 |
| - |
32 |
| - nixConf = runCommandNoCC "nix.conf" {} '' |
33 |
| - mkdir -p $out/etc/nix |
34 |
| - cat > $out/etc/nix/nix.conf <<'EOF' |
35 |
| - # If /dev/kvm does not actually exist in the container |
36 |
| - # we would rather build without KVM than fail. |
37 |
| - extra-system-features = kvm |
38 |
| -
|
39 |
| - experimental-features = nix-command flakes |
40 |
| - EOF |
41 |
| - ''; |
42 |
| - |
43 |
| - tmp = runCommandNoCC "tmp" {} '' |
44 |
| - mkdir -p $out/tmp |
45 |
| - ''; |
46 |
| - in |
47 |
| - buildImage { |
| 10 | + cicero = buildImage ( |
| 11 | + cell.library.addN2cNixArgs { |
| 12 | + inherit (cell.entrypoints) cicero; |
| 13 | + } { |
48 | 14 | name = "registry.ci.iog.io/cicero";
|
49 | 15 | tag = "main"; # keep in sync with branch name of flake input
|
50 | 16 | config.Cmd = ["${cell.entrypoints.cicero}/bin/entrypoint"];
|
51 |
| - config.Env = lib.mapAttrsToList (n: v: "${n}=${v}") { |
52 |
| - SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; |
53 |
| - }; |
54 | 17 | maxLayers = 60;
|
55 | 18 | contents = [
|
56 | 19 | (symlinkJoin {
|
57 | 20 | name = "root";
|
58 | 21 | paths = with inputs.nixpkgs; [
|
59 | 22 | # for transformers
|
60 | 23 | jq
|
61 |
| - # `bash` would also be ok for transformers |
62 |
| - # but we may as well get the interactive version |
63 |
| - # for manual debugging |
64 |
| - bashInteractive |
65 |
| - |
66 |
| - coreutils |
67 |
| - strace |
| 24 | + bash |
68 | 25 | ];
|
69 | 26 | })
|
70 |
| - global |
71 |
| - nixConf |
72 |
| - tmp |
73 |
| - ]; |
74 |
| - perms = [ |
75 |
| - { |
76 |
| - path = tmp; |
77 |
| - regex = ".*"; |
78 |
| - mode = "0777"; |
79 |
| - } |
80 | 27 | ];
|
81 |
| - }; |
| 28 | + } |
| 29 | + ); |
82 | 30 |
|
83 | 31 | webhook-trigger = buildImage {
|
84 | 32 | name = "registry.ci.iog.io/webhook-trigger";
|
|
0 commit comments