mirror of
https://github.com/ryantm/agenix.git
synced 2024-09-11 06:05:38 +03:00
Use jq instead of sed
This commit is contained in:
parent
572baca9b0
commit
eb1386f3b2
@ -2,7 +2,7 @@
|
|||||||
lib,
|
lib,
|
||||||
stdenv,
|
stdenv,
|
||||||
rage,
|
rage,
|
||||||
gnused,
|
jq,
|
||||||
nix,
|
nix,
|
||||||
mktemp,
|
mktemp,
|
||||||
diffutils,
|
diffutils,
|
||||||
@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
|
|||||||
version = "0.14.0";
|
version = "0.14.0";
|
||||||
src = substituteAll {
|
src = substituteAll {
|
||||||
inherit ageBin version;
|
inherit ageBin version;
|
||||||
sedBin = "${gnused}/bin/sed";
|
jqBin = "${jq}/bin/jq";
|
||||||
nixInstantiate = "${nix}/bin/nix-instantiate";
|
nixInstantiate = "${nix}/bin/nix-instantiate";
|
||||||
mktempBin = "${mktemp}/bin/mktemp";
|
mktempBin = "${mktemp}/bin/mktemp";
|
||||||
diffBin = "${diffutils}/bin/diff";
|
diffBin = "${diffutils}/bin/diff";
|
||||||
|
@ -115,7 +115,7 @@ function cleanup {
|
|||||||
trap "cleanup" 0 2 3 15
|
trap "cleanup" 0 2 3 15
|
||||||
|
|
||||||
function keys {
|
function keys {
|
||||||
(@nixInstantiate@ --eval -E "(let rules = import $RULES; in builtins.concatStringsSep \"\n\" rules.\"$1\".publicKeys)" | @sedBin@ 's/"//g' | @sedBin@ 's/\\n/\n/g') | @sedBin@ '/^$/d' || exit 1
|
(@nixInstantiate@ --json --eval -E "(let rules = import $RULES; in builtins.concatStringsSep \"\n\" rules.\"$FILE\".publicKeys)" | @jqBin@ -r .[]) || exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
function decrypt {
|
function decrypt {
|
||||||
@ -185,7 +185,7 @@ function edit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function rekey {
|
function rekey {
|
||||||
FILES=$( (@nixInstantiate@ --eval -E "(let rules = import $RULES; in builtins.concatStringsSep \"\n\" (builtins.attrNames rules))" | @sedBin@ 's/"//g' | @sedBin@ 's/\\n/\n/g') || exit 1)
|
FILES=$( (@nixInstantiate@ --json --eval -E "(let rules = import $RULES; in builtins.concatStringsSep \"\n\" (builtins.attrNames rules))" | @jqBin@ -r .[]) || exit 1)
|
||||||
|
|
||||||
for FILE in $FILES
|
for FILE in $FILES
|
||||||
do
|
do
|
||||||
|
Loading…
Reference in New Issue
Block a user