diff --git a/home/modules/baseline/xonsh_footer.xsh b/home/modules/baseline/xonsh_footer.xsh index 351100b..bb3a5b9 100644 --- a/home/modules/baseline/xonsh_footer.xsh +++ b/home/modules/baseline/xonsh_footer.xsh @@ -1,6 +1,6 @@ -# vim: set ft=python : +# vim: set ft=xonsh : -from tempfile import NamedTemporaryFile +from tempfile import NamedTemporaryFile, TemporaryDirectory def bw_unlock(): """Unlocks the BitWarden CLI and adds the resulting session code to the @@ -48,7 +48,7 @@ aliases['glrestart'] = _glrestart def _cfetch(args): 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 aliases['cfetch'] = _cfetch @@ -59,10 +59,18 @@ aliases['aws_creds'] = _aws_creds def _rebuild(args): system = uname() + hostname = system.nodename if system.sysname == 'Darwin': darwin-rebuild --flake ~/.config/darwin switch else: - sudo nixos-rebuild switch + with TemporaryDirectory() as td: + pushd @(td) + import platform + nom build f"/etc/nixos#nixosConfigurations.{hostname}.config.build.toplevel" + if g`result`: + nvd diff /run/current-system result + sudo result/bin/switch-to-configuration switch + popd aliases['rebuild'] = _rebuild def _yaml2json(args, stdin=None, stdout=None): diff --git a/modules/baseline.nix b/modules/baseline.nix index 98f497a..2b1ff90 100644 --- a/modules/baseline.nix +++ b/modules/baseline.nix @@ -93,6 +93,7 @@ in iperf killall nano + nix-output-monitor pciutils pwgen unzip