Files
nixos/home/baseline/nushell.nix
T

88 lines
2.5 KiB
Nix
Raw Normal View History

2025-06-11 12:35:01 -05:00
{
config,
lib,
2025-08-19 15:09:42 -05:00
pkgs,
2025-06-11 12:35:01 -05:00
...
}:
2025-08-19 15:09:42 -05:00
let
vpn = pkgs.writeText "vpn" ''
on run argv
ignoring application responses
tell application "Viscosity"
connect "350Main"
end tell
end ignoring
delay 1.0
activate application "Viscosity"
tell application "System Events" to keystroke item 1 of argv
2025-08-19 15:12:09 -05:00
delay 0.1
2025-08-19 15:09:42 -05:00
tell application "System Events" to keystroke tab
2025-08-19 15:12:09 -05:00
delay 0.1
2025-08-19 15:09:42 -05:00
tell application "System Events" to keystroke item 2 of argv
2025-08-19 15:12:09 -05:00
delay 0.1
2025-08-19 15:09:42 -05:00
tell application "System Events" to keystroke return
end run
'';
in
2025-06-11 12:35:01 -05:00
{
programs = {
nushell = {
enable = true;
2025-08-15 22:59:11 -05:00
environmentVariables = config.home.sessionVariables;
2025-06-11 12:35:01 -05:00
extraConfig = ''
use std/util "path add"
path add ${config.home.homeDirectory}/src/bin
path add /opt/homebrew/bin
path add /run/current-system/sw/bin
path add ${config.home.homeDirectory}/.nix-profile/bin
2025-08-19 15:09:42 -05:00
2025-08-19 15:43:55 -05:00
def --env unlock [] {
2025-08-19 15:09:42 -05:00
if "BW_SESSION" not-in $env {
$env.BW_SESSION = ^bw unlock --raw
}
2025-08-19 15:43:55 -05:00
}
def --env vpn [] {
unlock
2025-08-19 15:09:42 -05:00
let username = ^bw get username f7351f9c-b25b-4317-8352-affc00da4644
let password = ^bw get password f7351f9c-b25b-4317-8352-affc00da4644
let otp = ^bw get totp 10371487-7f40-4b08-9a45-b33e00de318b
osascript ${vpn} $username $"($password)($otp)"
}
2025-08-19 15:43:55 -05:00
def rebuild [] {
if (uname | get operating-system) == "Darwin" {
sudo darwin-rebuild switch
} else {
let hostname = uname | get nodename
let build = ^nom build $"/etc/nixos#nixosConfigurations.($hostname).config.system.build.toplevel" | complete
if build.exit_code == 0 {
nvd diff /run/current-system result
sudo nixos-rebuild switch
}
}
}
def deploy [ $host: string, $build: string = "" ] {
mut buildhost = $build
if $build == "" {
$buildhost = $host
}
if $buildhost == "linode" {
$buildhost = "isaiah"
}
nixos-rebuild switch --use-remote-sudo --use-substitutes --target-host $host --build-host $buildhost
}
2025-06-11 12:35:01 -05:00
'';
settings = {
buffer_editor = lib.getExe config.programs.nixvim.package;
2025-08-15 13:34:02 -05:00
"history.isolation" = true;
2025-08-18 02:06:03 -05:00
"history.file_format" = "sqlite";
2025-06-11 12:35:01 -05:00
};
};
};
2025-08-13 22:32:54 -05:00
home.shell.enableNushellIntegration = true;
2025-06-11 12:35:01 -05:00
}