From f097cbf57724b9bad693c5b9245437e81c52819a Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Tue, 10 Jan 2023 18:35:29 -0700 Subject: [PATCH] bins: initial bits for rpr --- bins/default.nix | 8 +++++++- bins/rpr.nix | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 bins/rpr.nix diff --git a/bins/default.nix b/bins/default.nix index d5a0d5e..912f81e 100644 --- a/bins/default.nix +++ b/bins/default.nix @@ -12,13 +12,19 @@ let inherit gosignify; inherit (pkgs) curl; }); + rpr = pkgs.writeScriptBin "rpr" (import ./rpr.nix { + inherit (pkgs) _1password; + inherit (pkgs) gh; + inherit (pkgs) tea; + }); in { environment.systemPackages = with pkgs; [ + checkRestart ix + #rpr sfetch xclip - checkRestart xinStatus ]; environment.etc = { diff --git a/bins/rpr.nix b/bins/rpr.nix new file mode 100644 index 0000000..222e8b0 --- /dev/null +++ b/bins/rpr.nix @@ -0,0 +1,23 @@ +{ tea, gh, _1password }: + +let + teaBin = "${tea}/bin/tea"; + ghBin = "${gh}/bin/gh"; + opBin = "${_1password}/bin/op"; + +in '' + #!/usr/bin/env sh + + set -eu + + proj="$(basename $PWD)" + + for login in $(${teaBin} logins list -o simple | awk '{print $1}'); do + tea logins default "$login" + tea repos create -name "$proj" || echo "error creating '$proj' on '$login'" + done + + # ${ghBin} + ${opBin} plugin run -- gh repo create --public "$proj" || echo "error creating '$proj' on 'github'" + +''