gh repos and fix mac build

This commit is contained in:
Noah Masur 2022-07-01 08:45:07 -04:00
parent 8a22c80b2d
commit 35a57d2905
6 changed files with 59 additions and 13 deletions

View File

@ -19,7 +19,7 @@ darwin.lib.darwinSystem {
../../modules/applications/discord.nix ../../modules/applications/discord.nix
../../modules/programming/nix.nix ../../modules/programming/nix.nix
../../modules/programming/terraform.nix ../../modules/programming/terraform.nix
../../modules/programming/python.nix # ../../modules/programming/python.nix
../../modules/programming/lua.nix ../../modules/programming/lua.nix
../../modules/programming/kubernetes.nix ../../modules/programming/kubernetes.nix
]; ];

View File

@ -1,4 +1,4 @@
{ ... }: { { config, ... }: {
imports = [ imports = [
./alacritty.nix ./alacritty.nix
@ -12,4 +12,7 @@
./utilities.nix ./utilities.nix
]; ];
home-manager.users.${config.user}.home.stateVersion = "22.11";
home-manager.users.root.home.stateVersion = "22.11";
} }

View File

@ -3,7 +3,7 @@
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
home.packages = with pkgs; [ home.packages = with pkgs; [
visidata # CSV inspector # visidata # CSV inspector
dos2unix # Convert Windows text files dos2unix # Convert Windows text files
inetutils # Includes telnet inetutils # Includes telnet
youtube-dl # Convert web videos youtube-dl # Convert web videos

View File

@ -1,9 +1,15 @@
{ config, pkgs, ... }: { { config, pkgs, ... }: {
home-manager.users.${config.user}.home.packages = with pkgs; [ home-manager.users.${config.user} = {
python310 # Standard Python interpreter
home.packages = with pkgs; [
# python310 # Standard Python interpreter
nodePackages.pyright # Python language server nodePackages.pyright # Python language server
black # Python formatter black # Python formatter
]; ];
programs.fish.shellAbbrs = { py = "python"; };
};
} }

View File

@ -117,11 +117,6 @@
dr = "docker run --rm -it"; dr = "docker run --rm -it";
db = "docker build . -t"; db = "docker build . -t";
# Python
py = "python";
po = "poetry";
pr = "poetry run python";
# Rust # Rust
ca = "cargo"; ca = "cargo";

View File

@ -32,6 +32,48 @@
}; };
}; };
home.packages = [
(pkgs.writeShellScriptBin "gh-repos" ''
#!/bin/sh
case $1 in
t2) organization="take-two" ;;
d2c) organization="take-two-t2gp" ;;
t2gp) organization="take-two-t2gp" ;;
pd) organization="private-division" ;;
dots) organization="playdots" ;;
*) organization="nmasur" ;;
esac
selected=$(gh repo list "$organization" \
--limit 50 \
--no-archived \
--json=name,description,isPrivate,updatedAt,primaryLanguage \
| jq -r '.[] | .name + "," + if .description == "" then "-" else .description |= gsub(","; " ") | .description end + "," + .updatedAt + "," + .primaryLanguage.name' \
| (echo "REPO,DESCRIPTION,UPDATED,LANGUAGE"; cat -) \
| column -s , -t \
| fzf \
--header-lines=1 \
--layout=reverse \
--bind "ctrl-o:execute:gh repo view -w ''${organization}/{1}" \
--bind "shift-up:preview-half-page-up" \
--bind "shift-down:preview-half-page-down" \
--preview "GH_FORCE_TTY=49% gh repo view ''${organization}/{1} | glow -" \
--preview-window up
)
[ -n "''${selected}" ] && {
directory="$HOME/dev/work"
if [ $organization = "nmasur" ]; then directory="$HOME/dev/personal"; fi
repo=$(echo "''${selected}" | awk '{print $1}')
repo_full="''${organization}/''${repo}"
if [ ! -d "''${directory}/''${repo}" ]; then
gh repo clone "$repo_full" "''${directory}/''${repo}"
fi
echo "''${directory}/''${repo}"
}
'')
];
}; };
} }