-
Notifications
You must be signed in to change notification settings - Fork 0
feat(fish): add global dev command for nix devshell #540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,23 @@ | ||||||||||||||||||
| function _dev_function --description "Enter Nix development shell" | ||||||||||||||||||
| # Find the nearest directory with flake.nix, or use dotfiles | ||||||||||||||||||
| set -l target_dir "" | ||||||||||||||||||
|
|
||||||||||||||||||
| # Check if current directory or any parent has flake.nix | ||||||||||||||||||
| set -l check_dir (pwd) | ||||||||||||||||||
| while test "$check_dir" != "/" | ||||||||||||||||||
| if test -f "$check_dir/flake.nix" | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The function doesn't verify if the found Prompt for Agent |
||||||||||||||||||
| set target_dir $check_dir | ||||||||||||||||||
| break | ||||||||||||||||||
| end | ||||||||||||||||||
| set check_dir (dirname $check_dir) | ||||||||||||||||||
| end | ||||||||||||||||||
|
Comment on lines
+6
to
+13
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current loop for finding |
||||||||||||||||||
|
|
||||||||||||||||||
| # Fallback to dotfiles if no flake found | ||||||||||||||||||
| if test -z "$target_dir" | ||||||||||||||||||
| set target_dir "$HOME/dotfiles" | ||||||||||||||||||
|
||||||||||||||||||
| set target_dir "$HOME/dotfiles" | |
| set -l fallback_dir "$HOME/dotfiles" | |
| if test -d "$fallback_dir" -a -f "$fallback_dir/flake.nix" | |
| set target_dir "$fallback_dir" | |
| else | |
| echo "Error: No flake.nix found in current directory tree, and fallback '$fallback_dir' is missing or lacks flake.nix." >&2 | |
| return 1 | |
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: Fish does not support VAR=value command syntax, so this line tries to run a command named DEVENV_ROOT=… and never sets the variable before invoking nix develop. Use env or set -lx to export DEVENV_ROOT for the command.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At home-manager/programs/fish/functions/_dev_function.fish, line 22:
<comment>Fish does not support `VAR=value command` syntax, so this line tries to run a command named `DEVENV_ROOT=…` and never sets the variable before invoking `nix develop`. Use `env` or `set -lx` to export DEVENV_ROOT for the command.</comment>
<file context>
@@ -0,0 +1,23 @@
+
+ # Enter the devshell
+ echo "Entering devshell in $target_dir"
+ DEVENV_ROOT=$target_dir nix develop $target_dir $argv
+end
</file context>
| DEVENV_ROOT=$target_dir nix develop $target_dir $argv | |
| env DEVENV_ROOT=$target_dir nix develop $target_dir $argv |
Copilot
AI
Jan 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The POSIX-style environment variable syntax works in Fish but is not idiomatic. Consider using the Fish-native approach with begin; set -lx DEVENV_ROOT $target_dir; nix develop $target_dir $argv; end or using env DEVENV_ROOT=$target_dir nix develop $target_dir $argv for better clarity and consistency with Fish conventions.
| DEVENV_ROOT=$target_dir nix develop $target_dir $argv | |
| env DEVENV_ROOT=$target_dir nix develop $target_dir $argv |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: The loop condition exits when
check_dirbecomes/without checking ifflake.nixexists at the root directory. If aflake.nixexists only at/, it won't be found and the function will incorrectly fall back to~/dotfiles. Consider restructuring the loop to check the root directory before exiting.Prompt for AI agents