More nushell aliases
Propagate the environment variables out of the functions when appropriate Add rebuild command Add deploy function
This commit is contained in:
@@ -38,15 +38,43 @@ in
|
||||
path add /run/current-system/sw/bin
|
||||
path add ${config.home.homeDirectory}/.nix-profile/bin
|
||||
|
||||
def vpn [] {
|
||||
def --env unlock [] {
|
||||
if "BW_SESSION" not-in $env {
|
||||
$env.BW_SESSION = ^bw unlock --raw
|
||||
}
|
||||
}
|
||||
|
||||
def --env vpn [] {
|
||||
unlock
|
||||
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)"
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
'';
|
||||
settings = {
|
||||
buffer_editor = lib.getExe config.programs.nixvim.package;
|
||||
|
||||
Reference in New Issue
Block a user