Add input for alternate dev shells
- Add new devShell input
- defaults to default
- add test to make sure we can enter
Passing the devshell in the args line wasn't working, because default was added to the args list in the script. This change give a clean mechanism to enable that
Thank you for the contribution but I don't understand the defect you're encountering. I test setting the arguments input to devShell outputs besides default on this line: https://github.com/nicknovitski/nix-develop/blob/82048009667406ecdc696956b5bc019de10a6dd3/.github/workflows/ci.yml#L34
You can see from any run of that workflow that the matrix is a list of many different devShells, like example, cpp, hook, etc.
Also, I pushed a branch that adds the same test you've added here, and it passes without your change: https://github.com/nicknovitski/nix-develop/actions/runs/12385445478/job/34571695093
default was added to the args list in the script When this happens, what are the effects, and what environment is it happening in? Does the action fail, or are the wrong tools present?
In bash, the parameter expansion ${varname:-word} evaluates to word if $varname is unset or null, and to $varname otherwise, so the expression ${@:-./#default} evaluates to ./#default if the parameters variable $@ is null and to $@ otherwise. This is what I see on my system:
~/Source/nix-develop/ > nix develop
bash-5.2$ defaultOr() {
> echo "${@:-./#default}"
> }
bash-5.2$ defaultOr
./#default
bash-5.2$ defaultOr ./#notDefault
./#notDefault
So, we have a dev shell for local dev with a lot of tools for doing dev, and a ci one with only the build tools. When passing .#ci as an argument, the default profile was still activating
Then what am I doing wrong here? https://github.com/nicknovitski/nix-develop/blob/c0ddc123bb54dd045a5afd5624843e5becc099f4/.github/workflows/ci.yml#L37-L46
The notDefault devShell is evaluated, and then which shfmt fails, because it doesn't include that package. The default devShell does, but it's not evaluated, and it's packages are not added to PATH. Here's the ci job where it passes. https://github.com/nicknovitski/nix-develop/actions/runs/12385985222/job/34573126333
No, I mean, I am probably doing something wrong. Let me go back and look at it again, and see if I can figure out why it wasn't working for me. At worst, I'll have some logs to share