1
0

Compare commits

..

3 Commits

5 changed files with 38 additions and 0 deletions

View File

@ -16,6 +16,7 @@
colmena
agenix
clerie-sops
clerie-sops-edit
sops
# Debugging

View File

@ -132,6 +132,7 @@
clerie-update-nixfiles
clerie-sops
clerie-sops-config
clerie-sops-edit
chromium-incognito
iot-data
nix-remove-result-links

View File

@ -0,0 +1,10 @@
{ pkgs, ... }:
pkgs.writeShellApplication {
name = "clerie-sops-edit";
text = builtins.readFile ./clerie-sops-edit.sh;
runtimeInputs = with pkgs; [
clerie-sops
jq
];
}

View File

@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Edit a single attribute of a sops json file
# Helps working with multiline strings in json
set -euo pipefail
SECRETS_FILE="$1"
KEY="$2"
if [[ -n $EDITOR ]]; then
EDITOR=vim
fi
TMP_FILE="$(mktemp)"
clerie-sops --decrypt --extract "[\"${KEY}\"]" "${SECRETS_FILE}" > "${TMP_FILE}"
vim "${TMP_FILE}"
JSON_QUOTED_SECRET="$(jq -Rs '.' "${TMP_FILE}")"
rm "${TMP_FILE}"
clerie-sops --set "[\"${KEY}\"] ${JSON_QUOTED_SECRET}" "${SECRETS_FILE}"

View File

@ -4,6 +4,7 @@ final: prev: {
clerie-merge-nixfiles-update = final.callPackage ./clerie-update-nixfiles/clerie-merge-nixfiles-update.nix {};
clerie-sops = final.callPackage ./clerie-sops/clerie-sops.nix {};
clerie-sops-config = final.callPackage ./clerie-sops/clerie-sops-config.nix {};
clerie-sops-edit = final.callPackage ./clerie-sops/clerie-sops-edit.nix {};
clerie-update-nixfiles = final.callPackage ./clerie-update-nixfiles/clerie-update-nixfiles.nix {};
chromium-incognito = final.callPackage ./chromium-incognito {};
iot-data = final.python3.pkgs.callPackage ./iot-data {};