-
Notifications
You must be signed in to change notification settings - Fork 10
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
Allow to specify the development shell to use #327
Comments
Hi @otavio, does the following combination of options work for your use case? |
It does not. I want to use a specific devShell to reduce the size of the dependencies that I'm fetching for the CI job to execute. So, I would create a CI development shell specifically for this use, and the developer development shell would inherit this one and extend it with command line tools used during user development. |
@otavio You can already do this with existing nix/flake functionality. For example, you could have a CI "base flake" under {
description = "A basic flake with a special devShell package";
inputs = {
nixpkgs.url = "nixpkgs/24.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {...} @ inputs:
inputs.flake-utils.lib.eachDefaultSystem (system: let
pkgs = import inputs.nixpkgs {inherit system;};
in {
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
cmatrix
];
};
});
} (setting working-directory and flakes-from-devshell to use that slimmed down development shell in CI) And then for your local development environment, you can import the CI flake and extend its {
description = "Main project flake that extends the CI flake's devShell";
inputs = {
nixpkgs.url = "nixpkgs/24.05";
flake-utils.url = "github:numtide/flake-utils";
ci.url = "path:./ci";
};
outputs = {
nixpkgs,
flake-utils,
ci,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {inherit system;};
ciBuildInputs = ci.devShell.x86_64-linux.buildInputs;
in {
devShell = pkgs.mkShell {
buildInputs = ciBuildInputs ++ [pkgs.hello];
};
});
} This local Addition: If you plan on maintaining a more complex development shell, I can highly recommend using the excellent https://devenv.sh/ |
I didn't imagine bringing this split setup, this is indeed very clever. However in my specific use case I'm using a single flake as a source for multiple projects so I can standardize the flake setup as well as dependencies. In this specific use case, I would need to have a way to specify the development shell used for entering the If I was going to do that by command-line, I would do: nix develop .#ci And for normal development, I would just call: nix develop Is it possible for you to add support to specify the shell to use? |
@otavio Here's an example in action. |
This seems to be exactly what I was looking for. Thanks for your support. |
@workflow I'm returning to this because I found an interesting side effect of this change. If I use version 3.3, it all works. However, bumping this to version 3.4 breaks the build. I'm having a very hard time figuring out what has changed because I didn't even change the development shell to be used; only the action has been updated in this PR (https://github.com/OSSystems/ZephyrBT/actions/runs/11558586629/job/32171463466). Could you take a look at that and see if you have any idea what's going on? |
Hmm sorry @otavio at first look I have no idea what could be going on here. It seems to be pulling the exact same versions of dependencies like
Since you likely understand more than me what Also as a side-note since your project is already fully Flake-yfied, you could try the excellent https://devenv.sh/ instead of this action for your CI needs, or look at This Action which seems more built for the modern flake age :) |
This is indeed very weird because if you look at the code with the current 3.3 version it works well, however updating the version to the 3.4 it fails. |
I'm facing a situation where the development shell for the CI can be minimal while the developer's development shell must have additional tools installed.
I need to select the appropriate shell for the CI job, but the current action doesn't seem to allow me to do so.
Can you add support for that?
The text was updated successfully, but these errors were encountered: