From 157772fdca3a2d23ad15f796c45e35aa61944c9e Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 10 May 2023 16:49:06 -0500 Subject: [PATCH] Clean up xonshrc file --- home/xonsh_footer.xsh | 11 ++++------- home/xonsh_header.xsh | 15 +++++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/home/xonsh_footer.xsh b/home/xonsh_footer.xsh index daed89b..8554b2d 100644 --- a/home/xonsh_footer.xsh +++ b/home/xonsh_footer.xsh @@ -1,10 +1,7 @@ # vim: set ft=python : -#$PKG_CONFIG_PATH = '/usr/local/lib/pkgconfig' -#$JAVA_HOME = '/etc/alternatives/java_sdk' def _rebuild(args): - import os - system = os.uname() + system = uname() if system.sysname == 'Darwin': darwin-rebuild --flake ~/.config/darwin switch else: @@ -22,7 +19,7 @@ def _py3env(args): vox new @(args[0]) def _rundock(args): - if os.path.exists('/usr/bin/podman'): + if Path('/usr/bin/podman').exists(): e = 'podman' else: e = 'docker' @@ -34,11 +31,11 @@ def _pip_extras(args): # Container stuff def _newdock(args): - if os.path.exists('/usr/bin/podman'): + if Path('/usr/bin/podman').exists(): e = 'podman' else: e = 'docker' - @(e) run -P --privileged=true -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v @(os.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]) def _unknown_host(args): diff --git a/home/xonsh_header.xsh b/home/xonsh_header.xsh index 6c89105..062eeee 100644 --- a/home/xonsh_header.xsh +++ b/home/xonsh_header.xsh @@ -1,17 +1,20 @@ # vim: set ft=python: -if '__NIX_DARWIN_SET_ENVIRONMENT_DONE' not in ${...} or not $__NIX_DARWIN_SET_ENVIRONMENT_DONE: - source-bash /etc/bashrc +from os import getcwd, uname +from pathlib import Path + + +#if uname().sysname == 'Darwin' and ('__NIX_DARWIN_SET_ENVIRONMENT_DONE' not in ${...} or not $__NIX_DARWIN_SET_ENVIRONMENT_DONE): +# source-bash /etc/bashrc # set -e == $RAISE_SUBPROC_ERROR = True # set -x == trace on; $XONSH_TRACE_SUBPROC = True # $? == _.rtn -import os - xontrib load direnv # Insert to the front, because when we spawn xonsh in tmux we have raw python3 # paths added before these. That ends up screwing with finding the python3 version # with all of our dependencies that we want -$PATH.insert(0, "${config.home.homeDirectory}/.nix-profile/bin") -$PATH.insert(0, "${config.home.homeDirectory}/src/bin") +$PATH.insert(0, Path("~/.nix-profile/bin").expanduser()) +$PATH.insert(0, Path("~/src/bin").expanduser()) +$PATH.insert(0, Path("~/.local/bin").expanduser())