This repository has no description
913 B
38 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 set -x
18 DEPLOY_TMPDIR=$(mktemp -d)
19 chmod 700 "$DEPLOY_TMPDIR"
20 trap 'rm -rf "$DEPLOY_TMPDIR"' EXIT
21
22 export PASS_BULK_KEY_FILE="$DEPLOY_TMPDIR/bulk-key"
23
24 # Sync password store before deploy
25 pass git pull --rebase
26
27 # Extract bulk key for fast decryption during deploy
28 pass show bulk-operations/age-key > "$PASS_BULK_KEY_FILE" 2>/dev/null || true
29
30 # Deploy
31 clan machines update "$@"
32
33 # Push any secret changes after deploy
34 pass git push
35 '';
36 };
37 };
38}