From 182b0f8fd7ba06382811a01eb3628358b05aed00 Mon Sep 17 00:00:00 2001 From: maxstrb Date: Sat, 4 Oct 2025 14:41:30 +0200 Subject: [PATCH] non important commit --- home/modules/shells.nix | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/home/modules/shells.nix b/home/modules/shells.nix index 5ecf8e4..87c1c9e 100644 --- a/home/modules/shells.nix +++ b/home/modules/shells.nix @@ -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 {