Skip to content

Commit a809f29

Browse files
committed
fix: tolerate missing agenix secrets in image build
1 parent 3134611 commit a809f29

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

nix/modules/clawdinator.nix

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,30 @@ in
498498
'';
499499
};
500500

501+
system.activationScripts.agenixChown = lib.mkIf cfg.bootstrap.enable (lib.mkForce {
502+
text =
503+
let
504+
secrets = lib.attrValues config.age.secrets;
505+
chownLines = lib.concatMapStringsSep "\n"
506+
(secret:
507+
let
508+
path = secret.path;
509+
owner = if secret.owner == null then "root" else secret.owner;
510+
group = if secret.group == null then "root" else secret.group;
511+
in
512+
lib.optionalString (path != null) ''
513+
if [ -e "${path}" ]; then
514+
chown ${owner}:${group} "${path}"
515+
fi
516+
'')
517+
secrets;
518+
in
519+
''
520+
set -euo pipefail
521+
${chownLines}
522+
'';
523+
});
524+
501525
systemd.tmpfiles.rules = [
502526
"d ${cfg.stateDir} 0750 ${cfg.user} ${cfg.group} - -"
503527
"d ${workspaceDir} 0750 ${cfg.user} ${cfg.group} - -"

scripts/import-image.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ for _ in {1..120}; do
8888
--region "${region}" \
8989
--resources "${image_id}" \
9090
--tags "Key=Name,Value=${ami_name}" "Key=clawdinator,Value=true"
91+
echo "AMI_ID=${image_id}" >&2
9192
echo "${image_id}"
9293
exit 0
9394
;;

0 commit comments

Comments
 (0)