Skip to content
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

feat: nix shell wrapper and tasks for vscode. #4525

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .vscode/nix-devshell.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh
set -eu
echo $PROJ_DIR
echo "Received $@"

nix_shell(){
nix develop .
}
nix_command(){
nix develop . --command bash -c "source nix/shell.sh;$@"
}

# The condition may be wrong because I'm not sure if Nix (!= NixOS) users have this file
if [ -e "/nix/var/nix/profiles/default/bin/nix" ]; then
if [ "$#" -eq 0 ]; then
nix_shell
else
shift
nix_command "$@"
fi
else
echo "Could not find a nix executable."
exit 1
fi
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"terminal.integrated.profiles.linux": {
"nix": {
"path": "${workspaceRoot}/.vscode/nix-devshell.sh",
"icon": "terminal-bash"
}
},
"terminal.integrated.automationProfile.linux": {
"icon": "terminal-bash",
"path": "${workspaceRoot}/.vscode/nix-devshell.sh",
"env": {
"PROJ_DIR": "${workspaceRoot}"
}
},
"terminal.integrated.defaultProfile.linux": "nix",
}
Loading