Add age key creation skip; Move paths to vars;
This commit is contained in:
+6
-5
@@ -1,10 +1,11 @@
|
|||||||
encryption = "age"
|
encryption = "age"
|
||||||
|
|
||||||
[age]
|
[age]
|
||||||
{{- if eq .chezmoi.osRelease.id "nixos" }}
|
{{ if eq .chezmoi.osRelease.id "nixos" }}
|
||||||
identity = "/etc/age/key.txt"
|
identity = "{{ .vars.nixosAgeKeyPath }}"
|
||||||
{{- else }}
|
{{ else }}
|
||||||
identity = "~/.config/chezmoi/key.txt"
|
identity = "{{ .vars.defaultAgeKeyPath }}"
|
||||||
{{- end }}
|
{{ end }}
|
||||||
recipient = "age1tl5hp6v0t38fl8gxuqds40z503mwz885ev22au4jdy5r24aak3zsza23sx"
|
recipient = "age1tl5hp6v0t38fl8gxuqds40z503mwz885ev22au4jdy5r24aak3zsza23sx"
|
||||||
|
|
||||||
[bitwarden]
|
[bitwarden]
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
defaultAgeKeyPath: "~/.config/age/key.txt"
|
||||||
|
nixosAgeKeyPath: "/etc/age/key.txt"
|
||||||
|
skipCreatingAgeKey: true
|
||||||
@@ -7,8 +7,13 @@ set -euo pipefail
|
|||||||
|
|
||||||
echo "Setting up age key..."
|
echo "Setting up age key..."
|
||||||
|
|
||||||
KEY_DIR="$HOME/.config/chezmoi"
|
KEY_FILE="{{ .vars.defaultAgeKeyPath }}"
|
||||||
KEY_FILE="$KEY_DIR/key.txt"
|
KEY_DIR="$(dirname "$KEY_FILE")"
|
||||||
|
|
||||||
|
{{ if .vars.skipCreatingAgeKey }}
|
||||||
|
echo "Expecting age key to be at $KEY_FILE"
|
||||||
|
exit 0
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
mkdir -p "$KEY_DIR"
|
mkdir -p "$KEY_DIR"
|
||||||
chmod 700 "$KEY_DIR"
|
chmod 700 "$KEY_DIR"
|
||||||
|
|||||||
Reference in New Issue
Block a user