nix/home/dots/xonshrc
2023-05-31 15:53:37 +10:00

83 lines
2.7 KiB
Text

# nix fix
import sys
import os.path
if os.path.exists(f"{$HOME}/.nix-profile") and not __xonsh__.env.get("NIX_PATH"):
$NIX_REMOTE="daemon"
$NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/" + $USER
$NIX_PROFILES="/nix/var/nix/profiles/default " + $HOME + "/.nix-profile"
$NIX_SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt"
$NIX_PATH="nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs:/nix/var/nix/profiles/per-user/root/channels"
$PATH += [f"{$HOME}/.nix-profile/bin", "/nix/var/nix/profiles/default/bin"]
new_paths = [#NEWPATHS]
# new_paths = new_paths + list(map(lambda s: str(s.resolve()), p"~/.local/lib/".glob("python*/site-packages")))
for p in new_paths:
if p not in sys.path:
sys.path.append(p)
$PYTHONPATH.append(p)
# prompt
execx($(/run/current-system/sw/bin/starship init xonsh --print-full-init))
# zjump
execx($(zoxide init xonsh), 'exec', __xonsh__.ctx, filename='zoxide')
# envs
$AUTO_CONTINUE = True
$AUTO_CD = True
$DOTGLOB = True
$GLOB_SORTED = True
$INDENT = ' '
$AUTO_SUGGEST = True
$AUTO_SUGGEST_IN_COMPLETIONS = True
$VI_MODE = True
$XONSH_AUTOPAIR = True
$XONSH_COPY_ON_DELETE = True
$ALIAS_COMPLETIONS_OPTIONS_BY_DEFAULT = True
$CASE_SENSITIVE_COMPLETIONS = False
$COMPLETIONS_BRACKETS = True
$COMPLETION_IN_THREAD = True
# aliases
def la_alias(dir=""):
exa -lha --icons --group-directories-first --color=always @(dir) | do_culr
def l_alias(dir=""):
exa -lh --icons --group-directories-first --color=always @(dir) | do_culr
def p_alias(opts=""):
ps ww @(opts) | do_culr
def mnt_alias():
mount | column -t | do_culr
def fresh_alias():
clear
echo
~/.nix/header.sh
aliases["fresh"] = fresh_alias
aliases["icat"] = [ "kitty", "+kitten", "icat" ]
aliases["chmox"] = [ "chmod", "+x" ]
aliases["gs"] = [ "git", "status" ]
aliases["gcl"] = [ "git", "clone" ]
aliases["ga"] = [ "git", "add" ]
aliases["gcb"] = [ "git", "checkout", "-b" ]
aliases["gco"] = [ "git", "checkout" ]
aliases["gl"] = [ "git", "pull" ]
aliases["gp"] = [ "git", "push" ]
aliases["gd"] = [ "git", "diff" ]
aliases["gcam"] = [ "git", "commit", "-am" ]
aliases["gcm"] = [ "git", "commit", "-m" ]
aliases["gr"] = [ "git", "restore" ]
aliases["gm"] = [ "git", "merge" ]
aliases["p"] = p_alias
aliases["l"] = l_alias
aliases["la"] = la_alias
aliases["mnt"] = mnt_alias
aliases["zz"] = [ "z", "$(xplr)" ]
aliases["do_culr"] = [ "culr", "-t", "80", "-o", "roygbiv-split" ]
# alias kaboom='printf "type any input if you wish to update\n\npress enter to continue\n"; read upgrade; if [ -n "$upgrade" ]; then echo upgrading..; sudo nix-channel --update; else echo no upgrade!; fi; sudo nixos-rebuild switch -j9 && rm ~/.gtkrc-2.0; home-manager switch && sudo nix-collect-garbage && nix-store --optimise'
# greet
fresh