From 1f94c4903deb2b8a6e2ec8e0a71d9f1cd303550d Mon Sep 17 00:00:00 2001 From: "David T. Sadler" Date: Mon, 23 Feb 2026 22:45:50 +0000 Subject: Add se bash function to help with editing NixOS Sops secret files --- bash/.bash_aliases | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'bash') diff --git a/bash/.bash_aliases b/bash/.bash_aliases index 3693bf5..7ec2ad1 100644 --- a/bash/.bash_aliases +++ b/bash/.bash_aliases @@ -28,3 +28,23 @@ tm() { tmux fi } + +# Edit NixOS Sops secret files. +se() { + local SYSTEM=$1 + local REPO_ROOT="$HOME/.nixos" + local SECRET_PATH="$REPO_ROOT/systems/$SYSTEM/secrets/secrets.yaml" + + if [ -z "$SYSTEM" ]; then + echo "Usage: se (e.g., se suliman)" + return 1 + fi + + if [ ! -f "$SECRET_PATH" ]; then + echo "Error: Secret file not found at $SECRET_PATH" + echo "Creating new secret file for $SYSTEM..." + mkdir -p "$(dirname "$SECRET_PATH")" + fi + + nix shell nixpkgs#sops -c sops "$SECRET_PATH" +} -- cgit v1.2.3-13-gbd6f