There’s a way you can do this without disrupting your main flake.lock. It also doesn’t require running nix develop
multiple times.
- Create subdirectory in your project. Say
mkdir extra
. - Create a new
extra/flake.nix
file. Have that flake refer to the mainflake.nix
as an input. - Add
extra/flake.nix
andextra/flake.lock
to the git index but hide it from your commits.
git add --intent-to-add extra/flake.nix
git update-index --assume-unchanged extra/flake.nix
Here’s what your extra/flake.nix
might look like (you could write a cleaner flake, but I hope you get the idea):
{
description = "Extra";
inputs.otherFlake.url = "path:..";
outputs = { self, otherFlake, ... }:
{
devShells.x86_64-linux = let
pkgs = import otherFlake.inputs.nixpkgs { system = "x86_64-linux"; };
in {
default = pkgs.mkShell {
buildInputs =
otherFlake.outputs.devShells.x86_64-linux.default.buildInputs
++ [ pkgs.hello ];
};
};
};
}
Then you can just run nix develop ./extra
instead of nix develop .
(no direnv required).