Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add inputsFrom option #861

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/modules/top-level.nix
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ in
default = [ ];
};

inputsFrom = lib.mkOption {
type = types.listOf types.package;
description = "A list of packages whose inputs will be exposed inside the developer environment";
default = [ ];
};

shell = lib.mkOption {
type = types.package;
internal = true;
Expand Down Expand Up @@ -194,6 +200,21 @@ in
ln -s ${profile} .devenv/profile
'';

packages =
let
mergeInputs = attrPath:
lib.subtractLists config.inputsFrom (builtins.concatMap (lib.attrByPath attrPath [ ]) config.inputsFrom);
allInputs = builtins.filter lib.isDerivation (builtins.concatMap mergeInputs [
[ "buildInputs" ]
[ "nativeBuildInputs" ]
[ "propagatedBuildInputs" ]
[ "propagatedNativeBuildInputs" ]
[ "stdenv" "initialPath" ]
[ "stdenv" "defaultBuildInputs" ]
[ "stdenv" "defaultNativeBuildInputs" ]
]);
in
lib.mkAfter allInputs;
Copy link
Contributor Author

@BurNiinTRee BurNiinTRee Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will most likely have a lot of duplicate packages when passed multiple packages, how is this handled?
Packages added like this should appear in search paths after any explicitly added packages.

shell = performAssertions (
mkNakedShell {
name = "devenv-shell";
Expand Down