dev env vs CI env #236
-
nix newb here, this might be obvious to others Im diggin devshell and just barey starting to tinker with it. I dont need devshell, githooks, and whatnot in CI but I do need things like dprint cargo-make, pnpm, node, etc. I think I need a devshell flake that also uses a CI flake? Or can I have I but if CI=true then I skip the devShell (would this be a conditional output?)? Can I have pure but still have pkgs defined outside the devShell scope? Whats is a right way to solve this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Good question! One way is to split the devshell in two: {
inputs.devshell.url = "github:numtide/devshell";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, flake-utils, devshell, nixpkgs }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ devshell.overlay ];
};
in
{
devShells.default = pkgs.devshell.mkShell {
imports = [ (pkgs.devshell.importTOML ./devshell.toml) ];
};
devShells.ci = pkgs.devshell.mkShell {
imports = [ (pkgs.devshell.importTOML ./devshell-ci.toml) ];
}
});
} Then use You could also have a Hope that helps! |
Beta Was this translation helpful? Give feedback.
-
Oh that looks way easier than expected :D - thank you @zimbatm The language still throws me but Ill get sorted - eventually. A shell for CI seems intuitive and more "normal". Should nix-shell be used for CI instead of devshell? A flake app that preforms the needed CI tasks rather than use a shell? Subsequent If I use same package in each shell do they share cache (only matters if using remote cache)? Do they have to declared outside of an individual shell? |
Beta Was this translation helpful? Give feedback.
Good question!
One way is to split the devshell in two:
Then use
nix develop
for developm…