Improve Darwin support

This commit is contained in:
greg-compass
2022-09-09 13:30:12 -05:00
parent d0a233fed7
commit 290914bf59
9 changed files with 67 additions and 9 deletions
+9 -1
View File
@@ -44,7 +44,6 @@
tspub = "sudo tailscale up --exit-node=linode";
tshome = "sudo tailscale up --exit-node=2maccabees";
tsclear = "sudo tailscale up --exit-node=''";
rebuild = "sudo nixos-rebuild switch";
};
configHeader = ''
@@ -61,6 +60,14 @@ xontrib load direnv
#$GOPATH = $HOME + '/.go'
#$JAVA_HOME = '/etc/alternatives/java_sdk'
configFooter = ''
def _rebuild(args):
import os
system = os.uname()
if system.sysname == 'Darwin':
darwin-rebuild --flake ~/.config/nix switch
else:
sudo nixos-rebuild switch
def _yaml2json(args, stdin=None, stdout=None):
import sys, yaml, json
from yaml import CLoader
@@ -95,6 +102,7 @@ def _newdock(args):
def _unknown_host(args):
sed -i -e @(args[0])d ~/.ssh/known_hosts
aliases['rebuild'] = _rebuild
aliases['yaml2json'] = _yaml2json
aliases['py2env'] = _py2env
aliases['py3env'] = _py3env