Reorder and clean up aliases

This commit is contained in:
Greg Hellings
2024-08-04 20:25:35 -05:00
parent c7156051f7
commit 1203db6a25
2 changed files with 15 additions and 30 deletions
+1 -16
View File
@@ -26,8 +26,6 @@
# Tells vox where to find virtualenvs # Tells vox where to find virtualenvs
VIRTUALENV_HOME = "${config.home.homeDirectory}/venv/"; VIRTUALENV_HOME = "${config.home.homeDirectory}/venv/";
COMPASS_SKIP_ORIGIN_CHECK = "True";
GOPATH = "${config.home.homeDirectory}/src/go"; GOPATH = "${config.home.homeDirectory}/src/go";
GOBIN = "${config.home.homeDirectory}/src/bin"; GOBIN = "${config.home.homeDirectory}/src/bin";
}; };
@@ -35,20 +33,6 @@
aliases = { aliases = {
ac = "vox activate"; ac = "vox activate";
cavg = "compass workspace exec bazel run src/go/compass.com/tools/circleci_results_cache/avg_duration/cmd/avg_duration:avg_duration";
cbazel = "compass workspace exec bazel";
cblack = "compass workspace run src/python3/uc/tools:run_black --";
cbuild = "compass workspace build";
cci = "compass workspace run src/python3/uc/tools:circleci-checks";
ccover = "compass workspace cover --extra-cmd-args=\"--test_output=errors\"";
cexec = "compass workspace exec";
cgh = "$GH_CONFIG_DIR=\"${config.home.homeDirectory}/.config/gh/compass\" gh";
cpip = "compass workspace run src/python3/uc/tools:run_pip_compile";
crun = "compass workspace run";
ctest = "compass workspace test --extra-cmd-args=\"--test_output=errors\"";
cylint = "compass workspace run src/python3/uc/tools:run_yaml_lint";
gazelle = "compass workspace exec bazel run :gazelle";
cleanup = "sudo nix-collect-garbage --delete-older-than 30d && nix store optimise"; cleanup = "sudo nix-collect-garbage --delete-older-than 30d && nix store optimise";
d = "vox deactivate"; d = "vox deactivate";
dirflake = "nix flake new -t github:nix-community/nix-direnv"; dirflake = "nix flake new -t github:nix-community/nix-direnv";
@@ -58,6 +42,7 @@
ll = "ls -l --color"; ll = "ls -l --color";
molcol = "molecule -c ../../tests/molecule.yml"; molcol = "molecule -c ../../tests/molecule.yml";
nixup = "nix flake lock --update-input"; nixup = "nix flake lock --update-input";
nixtest = "nixpkgs-review rev HEAD";
pa = "cd ~/src/packaging"; pa = "cd ~/src/packaging";
tf = "terraform"; tf = "terraform";
tsup = "sudo tailscale up"; tsup = "sudo tailscale up";
+14 -14
View File
@@ -31,22 +31,27 @@ def vpn(con, bwname):
def _unlock(args): def _unlock(args):
bw_unlock() bw_unlock()
aliases['unlock'] = _unlock
def _ivr(args): def _ivr(args):
vpn("350Main", "IVR Technology") vpn("350Main", "IVR Technology")
aliases['ivr'] = _ivr
def _glrestart(args): def _glrestart(args):
sudo nixos-container run gitlab -- systemctl restart gitlab sudo nixos-container run gitlab -- systemctl restart gitlab
sudo nixos-container run gitlab -- systemctl restart nginx sudo nixos-container run gitlab -- systemctl restart nginx
aliases['glrestart'] = _glrestart
def _cfetch(args): def _cfetch(args):
bw_unlock() bw_unlock()
$CIRCLECI_CLI_TOKEN=$(bw get password CircleCI) $CIRCLECI_CLI_TOKEN=$(bw get password CircleCI)
compass workspace exec bazel run src/go/compass.com/tools/circleci_results_cache/fetch/cmd/fetch:fetch compass workspace exec bazel run src/go/compass.com/tools/circleci_results_cache/fetch/cmd/fetch:fetch
aliases['cfetch'] = _cfetch
def _aws_creds(args): def _aws_creds(args):
$AWS_ACCESS_KEY_ID=$(bw get username "AWS Access Key") $AWS_ACCESS_KEY_ID=$(bw get username "AWS Access Key")
$AWS_SECRET_ACCESS_KEY=$(bw get password "AWS Access Key") $AWS_SECRET_ACCESS_KEY=$(bw get password "AWS Access Key")
aliases['aws_creds'] = _aws_creds
def _rebuild(args): def _rebuild(args):
system = uname() system = uname()
@@ -54,17 +59,21 @@ def _rebuild(args):
darwin-rebuild --flake ~/.config/darwin switch darwin-rebuild --flake ~/.config/darwin switch
else: else:
sudo nixos-rebuild switch sudo nixos-rebuild switch
aliases['rebuild'] = _rebuild
def _yaml2json(args, stdin=None, stdout=None): def _yaml2json(args, stdin=None, stdout=None):
import sys, yaml, json import sys, yaml, json
from yaml import CLoader from yaml import CLoader
json.dump(yaml.load(stdin, Loader=CLoader), stdout, indent=4) json.dump(yaml.load(stdin, Loader=CLoader), stdout, indent=4)
aliases['yaml2json'] = _yaml2json
def _py2env(args): def _py2env(args):
vox new @(args[0]) -p /usr/bin/python2 vox new @(args[0]) -p /usr/bin/python2
aliases['py2env'] = _py2env
def _py3env(args): def _py3env(args):
vox new @(args[0]) vox new @(args[0])
aliases['py3env'] = _py3env
def _rundock(args): def _rundock(args):
if Path('/usr/bin/podman').exists(): if Path('/usr/bin/podman').exists():
@@ -72,10 +81,12 @@ def _rundock(args):
else: else:
e = 'docker' e = 'docker'
@(e) exec -ti @(args[0]) /bin/bash @(e) exec -ti @(args[0]) /bin/bash
aliases['rundock'] = _rundock
def _pip_extras(args): def _pip_extras(args):
import importlib_metadata import importlib_metadata
print(importlib_metadata.metadata(args[0]).get_all('Provides-Extra')) print(importlib_metadata.metadata(args[0]).get_all('Provides-Extra'))
aliases['pip_extras'] = _pip_extras
# Container stuff # Container stuff
def _newdock(args): def _newdock(args):
@@ -85,9 +96,11 @@ def _newdock(args):
e = 'docker' e = 'docker'
@(e) run -P --privileged=true -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v @(getcwd()):/dmnt -v /etc/pki:/etc/pki:ro -d --name @(args[1]) @(args[0]) /sbin/init @(e) run -P --privileged=true -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v @(getcwd()):/dmnt -v /etc/pki:/etc/pki:ro -d --name @(args[1]) @(args[0]) /sbin/init
rundock @(args[1]) rundock @(args[1])
aliases['newdock'] = _newdock
def _unknown_host(args): def _unknown_host(args):
sed -i -e @(args[0])d ~/.ssh/known_hosts sed -i -e @(args[0])d ~/.ssh/known_hosts
aliases['unknown_host'] = _unknown_host
def _bake(args): def _bake(args):
from pathlib import Path from pathlib import Path
@@ -95,21 +108,8 @@ def _bake(args):
if not templates.exists(): if not templates.exists():
git clone src:greg/copier-templates.git ~/.copier-templates git clone src:greg/copier-templates.git ~/.copier-templates
copier copy @(str(templates / args[0])) . copier copy @(str(templates / args[0])) .
aliases['aws_creds'] = _aws_creds
aliases['glrestart'] = _glrestart
aliases['bake'] = _bake aliases['bake'] = _bake
aliases['unlock'] = _unlock
aliases['cfetch'] = _cfetch
aliases['ivr'] = _ivr
aliases['newdock'] = _newdock
aliases['pip_extras'] = _pip_extras
aliases['py2env'] = _py2env
aliases['py3env'] = _py3env
aliases['rebuild'] = _rebuild
aliases['rundock'] = _rundock
aliases['unknown_host'] = _unknown_host
aliases['yaml2json'] = _yaml2json
### ###
# #
# Other random nice-to-have things # Other random nice-to-have things