8000 nix-shell load file and additional package from command line · Issue #16812 · NixOS/nix · GitHub
[go: up one dir, main page]

Skip to content

nix-shell load file and additional package from command line #16812

Open

Description

@kaddkaka

Is your feature request related to a problem?

Yes, it's the same question as asked here: #278

I want to load a project's nix environment, plus add a few packages of my own. But nix-shell doesn't support ~ nix-shell shell.nix -p foo bar which would have been very convenient.

Proposed solution

Support loading both a nix for file and additional packages.

1.nix-shell shell.nix -p foo bar
2. `nix-shell -f shell.nix -p foo bar

Alternative solutions

Combining two separate .nix files, somehow. (quite a lot more work).

Checklist


Add 👍 to [issues you find important](https://github.com/NixOS/nix/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc

Activity

  1. added
    feature
    on Nov 13, 2026
  2. Filippo-Galli commented on Nov 14, 2026

    @Filippo-Galli
    Contributor

    Hi, thanks for the question.
    I'm kinda a newbie but for me seems a bit "strange" as behavior. I'm using nix primarily to have something reproducible and well-documented, so adding package in this way seems counter-intuitive at my eyes.

    With my knowledge, to combine two or more nix file, something like this should work:

    { pkgs ? import <nixpkgs> {} }:
    
    let
      projectShell = import ./shell.nix { inherit pkgs; };
      otherShell   = import ./other-tools.nix { inherit pkgs; };
    in
    pkgs.mkShell {
      inputsFrom = [
        projectShell
        otherShell
      ];
    }
  3. kaddkaka commented on Nov 14, 2026

    @kaddkaka
    Author

    I'm using nix primarily to have something reproducible and well-documented, so adding package in this way seems counter-intuitive at my eyes.

    This is what I mostly use it for as well, but to be able to develop, and be able to use copy paste inside opencode Ai cli tool, I need to also have something xclip. So it's a development requirement that is not needed for running/using the project, but it's something I want. How is this usually solved?

  4. Filippo-Galli commented on Nov 14, 2026

    @Filippo-Galli
    Contributor

    I'm using nix primarily to have something reproducible and well-documented, so adding package in this way seems counter-intuitive at my eyes.

    This is what I mostly use it for as well, but to be able to develop, and be able to use copy paste inside opencode Ai cli tool, I need to also have something xclip. So it's a development requirement that is not needed for running/using the project, but it's something I want. How is this usually solved?

    I would says this is a system-level problem of having a set up for handle clipboard properly more than a single environment addition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0