devShell inputDerivation flake example

A number of topics reference mkDerivation: Introduce .inputDerivation for shell.nix build convenience by infinisil · Pull Request #95536 · NixOS/nixpkgs · GitHub as being the solution to how to build/cache/gc a shell environment, but as newcomer, I’m struggling to wire this up to a flake, where I don’t have an explicit shell.nix or mkShell invocation:

  outputs = { self, nixpkgs, nix-ros-overlay, flake-utils }:
    with flake-utils.lib;
    eachSystem allSystems (system: let
      pkgs = import nixpkgs {
        inherit system;
        overlays = [ nix-ros-overlay.overlay ];
      };
    in {
      packages = pkgs.rosPackages;
      devShell = import ./ros-base.nix { inherit pkgs; rosPackages = pkgs.rosPackages;};
    }) // {
      nixosModule = import ./modules;
    };

It doesn’t seem like I can just grab devShell.inputDerivation or devShell."${system}".inputDerivation. How do I manage this?

1 Like
nix build .#devShell.x86_64-linux.inputDerivation

works for me

1 Like

Works perfectly, thanks for the assistance!