non important commit
This commit is contained in:
parent
b2069b66ab
commit
182b0f8fd7
1 changed files with 25 additions and 2 deletions
|
|
@ -41,8 +41,32 @@
|
|||
fastfetch
|
||||
}
|
||||
|
||||
def flake [command?: string] {
|
||||
|
||||
def flake [command?: string] {
|
||||
let git_result = do { git rev-parse --show-toplevel } | complete
|
||||
if $git_result.exit_code != 0 {
|
||||
print "You are not in a git repository"
|
||||
return
|
||||
}
|
||||
|
||||
let root = $git_result.stdout | str trim
|
||||
let flake_path = $root | path join "flake.nix"
|
||||
if not ($flake_path | path exists) {
|
||||
print "There is no flake in this repository"
|
||||
return
|
||||
}
|
||||
|
||||
let dev_check = do { nix develop $root --command true } | complete
|
||||
|
||||
if $dev_check.exit_code == 0 {
|
||||
if ($command | is-empty) {
|
||||
nix develop $root
|
||||
} else {
|
||||
nix develop $root --command $command
|
||||
}
|
||||
} else {
|
||||
print "This flake doesn't have a default shell"
|
||||
}
|
||||
}
|
||||
|
||||
def edit [user_file?: path] {
|
||||
|
|
@ -65,7 +89,6 @@
|
|||
return
|
||||
}
|
||||
|
||||
# nix develop will exit with error if no devShell exists
|
||||
let dev_check = do { nix develop $root --command true } | complete
|
||||
|
||||
if $dev_check.exit_code == 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue