From 9dd9d4a5b0fcdce28cb94b698ebf76ada4afc073 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 12 Jun 2024 10:39:06 -0500 Subject: [PATCH 1/5] Remove unused packages from ivr --- home/hosts/ivr/default.nix | 5 ----- 1 file changed, 5 deletions(-) diff --git a/home/hosts/ivr/default.nix b/home/hosts/ivr/default.nix index 5936604..9f38b22 100644 --- a/home/hosts/ivr/default.nix +++ b/home/hosts/ivr/default.nix @@ -5,7 +5,6 @@ let djangorestframework django-rapyd-modernauth environs - #itg-django-utils mysqlclient pyyaml ruamel-yaml @@ -22,14 +21,10 @@ in { aacs ansible bitwarden-cli - bruno direnv - gcc home-manager insomnia - libmysqlclient pipenv-ivr - pkg-config ]; file.".pip/pip.conf".text = (lib.strings.concatStringsSep "\n" [ "[global]" From d022f164708fc90e7b31d2ac6235526f79bb8143 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 12 Jun 2024 10:45:43 -0500 Subject: [PATCH 2/5] Updates to environment variables Re-order them to be alphabetical Add LIBMYSQL_ENABLE_CLEARTEXT_PLUGIN --- home/xonsh.nix | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/home/xonsh.nix b/home/xonsh.nix index 411ef8e..9b35dd0 100644 --- a/home/xonsh.nix +++ b/home/xonsh.nix @@ -5,18 +5,10 @@ enable = true; sessionVariables = { - TIMEFORMAT = "%3Uu %3Ss %3lR %P%%"; CLICOLOR = 1; - LSCOLORS = "ExGxBxDxCxEgEdxbxgxcxd"; EDITOR = "${pkgs.vim}/bin/vim"; - # Tells vox where to find virtualenvs - VIRTUALENV_HOME = "${config.home.homeDirectory}/venv/"; # vte_new_tab_cwd causes new Terminal tabs to open in the # same CWD as the current tab - PROMPT = "{vte_new_tab_cwd}{env_name}{BOLD_GREEN}{user}@{hostname}{BOLD_BLUE} {short_cwd}{branch_color}{curr_branch: {}}{RESET} {BOLD_BLUE}{prompt_end}{RESET} "; - SWORD_PATH = "${config.home.homeDirectory}/.sword/"; - OS_CLOUD = "default"; - MAVEN_OPTS = " -Dmaven.wagon.http.ssl.insecure=true"; LESS_TERMCAP_mb = "\\033[01;31m"; # begin blinking LESS_TERMCAP_md = "\\033[01;31m"; # begin bold LESS_TERMCAP_me = "\\033[0m"; # end mode @@ -24,6 +16,15 @@ LESS_TERMCAP_se = "\\033[0m"; # end standout-mode LESS_TERMCAP_us = "\\033[00;36m"; # begin underline LESS_TERMCAP_ue = "\\033[0m"; # end underline + LIBMYSQL_ENABLE_CLEARTEXT_PLUGIN = "1"; + LSCOLORS = "ExGxBxDxCxEgEdxbxgxcxd"; + MAVEN_OPTS = " -Dmaven.wagon.http.ssl.insecure=true"; + OS_CLOUD = "default"; + PROMPT = "{vte_new_tab_cwd}{env_name}{BOLD_GREEN}{user}@{hostname}{BOLD_BLUE} {short_cwd}{branch_color}{curr_branch: {}}{RESET} {BOLD_BLUE}{prompt_end}{RESET} "; + SWORD_PATH = "${config.home.homeDirectory}/.sword/"; + TIMEFORMAT = "%3Uu %3Ss %3lR %P%%"; + # Tells vox where to find virtualenvs + VIRTUALENV_HOME = "${config.home.homeDirectory}/venv/"; COMPASS_SKIP_ORIGIN_CHECK = "True"; From f6daf935534cf39c4db7b8c1e5b71d7d5f48a699 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 12 Jun 2024 13:47:02 -0500 Subject: [PATCH 3/5] Add way to unlock BitWarden on the CLI Added a helper function to BitWarden to unlock the CLI Updated cfetch to fetch that information --- home/xonsh.nix | 1 - home/xonsh_footer.xsh | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/home/xonsh.nix b/home/xonsh.nix index 9b35dd0..10cb5c6 100644 --- a/home/xonsh.nix +++ b/home/xonsh.nix @@ -42,7 +42,6 @@ cci = "compass workspace run src/python3/uc/tools:circleci-checks"; ccover = "compass workspace cover --extra-cmd-args=\"--test_output=errors\""; cexec = "compass workspace exec"; - cfetch = "compass workspace exec bazel run src/go/compass.com/tools/circleci_results_cache/fetch/cmd/fetch:fetch"; 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"; diff --git a/home/xonsh_footer.xsh b/home/xonsh_footer.xsh index 8554b2d..1b6c8a2 100644 --- a/home/xonsh_footer.xsh +++ b/home/xonsh_footer.xsh @@ -1,5 +1,22 @@ # vim: set ft=python : +def bw_unlock(): + if "BW_SESSION" in ${...}: + return $BW_SESSION + result = !(bw unlock) + while not result: + result = !(bw unlock) + l = [k for k in result.lines if 'BW_SESSION="' in k][0] + left, right = l.split("=") + token = right[1:-1] + $BW_SESSION = token + return token + +def _cfetch(args): + bw_unlock() + $CIRCLECI_CLI_TOKEN=$(bw get password CircleCI) + compass workspace exec bazel run src/go/compass.com/tools/circleci_results_cache/fetch/cmd/fetch:fetch + def _rebuild(args): system = uname() if system.sysname == 'Darwin': @@ -48,6 +65,7 @@ def _bake(args): git clone src:greg/copier-templates.git ~/.copier-templates copier copy @(str(templates / args[0])) . +aliases['cfetch'] = _cfetch aliases['bake'] = _bake aliases['rebuild'] = _rebuild aliases['yaml2json'] = _yaml2json From 4fb00208f4b2b747ea5fe980317093ef2c0835b7 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 12 Jun 2024 14:26:17 -0500 Subject: [PATCH 4/5] Update darwin flake --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 965d277..5ef373b 100644 --- a/flake.lock +++ b/flake.lock @@ -52,11 +52,11 @@ ] }, "locked": { - "lastModified": 1715653378, - "narHash": "sha256-6kbg/PI3+SBP17f4T0js3CBsMLVtlD0JqJhDKgzk1mQ=", + "lastModified": 1717976995, + "narHash": "sha256-u3HBinyIyUvL1+N816bODpJmSQdgn0Mbb8BprFw7kqo=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "de8b0d60d6fd34f35abffc46adc94ebaa6996ce2", + "rev": "315aa649ba307704db0b16c92f097a08a65ec955", "type": "github" }, "original": { From 8cbae36433b9079adfd6ff5d4cf833a0306f0349 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 12 Jun 2024 14:26:32 -0500 Subject: [PATCH 5/5] Silence and document function --- home/xonsh_footer.xsh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/home/xonsh_footer.xsh b/home/xonsh_footer.xsh index 1b6c8a2..019831e 100644 --- a/home/xonsh_footer.xsh +++ b/home/xonsh_footer.xsh @@ -1,13 +1,16 @@ # vim: set ft=python : def bw_unlock(): + """Unlocks the BitWarden CLI and adds the resulting session code to the + current environment variables. Also returns the code for them.""" if "BW_SESSION" in ${...}: return $BW_SESSION - result = !(bw unlock) - while not result: - result = !(bw unlock) - l = [k for k in result.lines if 'BW_SESSION="' in k][0] - left, right = l.split("=") + result = $(bw unlock) + while "BW_SESSION" not in result: + result = $(bw unlock) + lines = result.split("\n") + l = [k for k in lines if 'BW_SESSION="' in k][0] + left, right = l.split("=", 1) token = right[1:-1] $BW_SESSION = token return token