nix shell --impure --expr 'with import <nixpkgs> {}; pkgs.mkShell {
        buildInputs = [
                pkgs.python311
                pkgs.python311Packages.selenium
        ];
}'
  • use something from a flake
nix shell --impure --expr 'let
	flake = builtins.getFlake "github:c2vi/nixos";
	nixpkgs = builtins.getFlake "nixpkgs";
	system = builtins.currentSystem;
	pkgs = nixpkgs.outputs.legacyPackages.${system}
	in
	flake.outputs.packages.${system}.cbm
'