This repository has no description
896 B
37 lines
1{ self, inputs, ... }:
2{
3 perSystem =
4 {
5 pkgs,
6 system,
7 ...
8 }:
9 {
10 packages.deploy = pkgs.writeShellApplication {
11 name = "deploy";
12 runtimeInputs = [
13 self.packages.${system}.pass
14 inputs.clan-core.packages.${system}.clan-cli
15 ];
16 text = ''
17 DEPLOY_TMPDIR=$(mktemp -d)
18 chmod 700 "$DEPLOY_TMPDIR"
19 trap 'rm -rf "$DEPLOY_TMPDIR"' EXIT
20
21 export PASS_BULK_KEY_FILE="$DEPLOY_TMPDIR/bulk-key"
22
23 # Sync password store before deploy
24 pass git pull --rebase
25
26 # Extract bulk key for fast decryption during deploy
27 pass show bulk-operations/age-key > "$PASS_BULK_KEY_FILE" 2>/dev/null || true
28
29 # Deploy
30 clan machines update "$@"
31
32 # Push any secret changes after deploy
33 pass git push
34 '';
35 };
36 };
37}