non important commit
This commit is contained in:
parent
ce704e9e6f
commit
5fa8c51008
1 changed files with 15 additions and 21 deletions
|
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue