Skip to content

[0001] Provide to-dev-shell utility for mkDerivation - #1

Open
jonringer wants to merge 1 commit into
masterfrom
to-dev-shell
Open

jonringer wants to merge 1 commit into
masterfrom
to-dev-shell

Conversation

@jonringer

Copy link
Copy Markdown
Contributor

Make development shells easier to create with all derivations by having mkDerivation provide a toDevShell function, which can be used to convert a derivation into a similar derivation with additional dependencies.

];
in originalArgs // {
inherit name;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To disable hardening flags, which cause issues with debug traces

Suggested change
inherit hardeningDisable;

and add a

, hardeningDisable ? [ "all" ]

as a default

@blaggacao

blaggacao commented Nov 9, 2024

Copy link
Copy Markdown

I believe, that this is a relevant "entry breadcrumb" into the nixpkgs' state of discussion: NixOS/nix#7501

This EEP seems to be more narrowly scoped for pragamtic reasons, but reference of the broader context may be of interest for a deep dive into the topic.

@jonringer

Copy link
Copy Markdown
Contributor Author

If we had stdenv retain a reference to callPackage at the current package scope, then we could feasibly do something like:

devShells.default = myPackage.toDevShell ({ linter, test-runner} : {
  nativeBuildInputs = [ linter test-runner ];
})


## Future work

N/A

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we could also support targeting debug builds for things like cargo, cmake, meson, etc.

, buildInputs ? [ ]
, nativeBuildInputs ? [ ]
, propagatedBuildInputs ? [ ]
, propagatedNativeBuildInputs ? [ ]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

env should also be supported, to reflect upstream preferences

jonringer added a commit to ekala-project/corepkgs that referenced this pull request Sep 5, 2026
Expose a toDevShell function on every mkDerivation output that converts
the derivation into a development shell, preserving its build environment
(compiler, flags, phases, environment variables). Accepts either an
attrset or a function (stdenv -> attrset) for conditional inputs.

See: ekala-project/eeps#1
jonringer added a commit to ekala-project/corepkgs that referenced this pull request Sep 5, 2026
Expose a toDevShell function on every mkDerivation output that converts
the derivation into a development shell, preserving its build environment
(compiler, flags, phases, environment variables). Accepts either an
attrset or a function (stdenv -> attrset) for conditional inputs.

See: ekala-project/eeps#1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants