diff --git a/assets/info_restic.sh b/assets/info_restic.sh new file mode 100644 index 0000000..b042e57 --- /dev/null +++ b/assets/info_restic.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +TMPDIR=~/.etc_info +mkdir -p $TMPDIR + +# todo use rsync and make and copy them to a place where +# it is stored for longer +function get_infos(){ + local server=$1 + cd $TMPDIR + scp "${server}:/etc/info/*.json" . +} + +function only_service(){ + local service=$1 + cd $TMPDIR + cat * | jq '.[] | select(has("'${service}'"))' +} + +# main + +get_infos "workhorse.private" +get_infos "porani.private" +get_infos "workout.private" +get_infos "pepe.private" +get_infos "sterni.private" + +only_service "restic" \ + | jq '.restic' | jq --slurp . | jq 'group_by(.from)' \ + | jq --raw-output ' +.[] | +.[0].from as $hostname | +.[0].folders as $folders | +[.[].to.server] | +" +# \($hostname) +## folders +\( $folders | reduce .[] as $item ( ""; . + "*" + $item + "\n" ) ) +## to +\(. | reduce .[] as $item ( ""; . + "* " + $item + "\n") ) +"' | pandoc - -s -t man | man -l - + + diff --git a/system/desktop/packages.nix b/system/desktop/packages.nix index 0186279..f427bd9 100644 --- a/system/desktop/packages.nix +++ b/system/desktop/packages.nix @@ -32,6 +32,7 @@ let ${pkgs.pandoc}/bin/pandoc \ --from ${inputFormat} \ --to ${outputFormat} \ + --standalone \ "$@" '';