non important commit

This commit is contained in:
maxstrb 2025-10-01 21:21:00 +02:00
parent ce704e9e6f
commit 5fa8c51008

View file

@ -41,32 +41,26 @@
fastfetch fastfetch
} }
def flake [ def edit [file?: path] {
shell?: string if ($file | is-empty) or ($file == null) {
--edit (-e) $file = pwd
--command (-c): string
] {
if $edit {
nvim ~/.nix-config/flakes/flake.nix
} else {
match $command {
null => {nix develop $"/home/maxag/.nix-config/flakes/#($shell)"}
_ => {nix develop $"/home/maxag/.nix-config/flakes/#($shell)" --command bash -c $"($command)"}
}
} }
}
def edit [file: path] { let git_result = do { git rev-parse --show-toplevel } | complete
let result = do {
git rev-parse --show-toplevel
} | complete
if $result.exit_code == 0 { if $git_result.exit_code == 0 {
let root = $result.stdout | str trim let root = $git_result.stdout | str trim
cd root
let flake_path = $root | path join "flake.nix"
if not ($flake_path | path exists) {
nvim $file
return
}
cd $root
nix develop . --command bash -c $"nvim ($file)" nix develop . --command bash -c $"nvim ($file)"
} else { } else {
nvim file nvim $file
} }
} }