mirror of
https://github.com/NixOS/rfcs.git
synced 2025-12-21 00:11:20 +01:00
Design sec improvements
This commit is contained in:
parent
5ddd60b028
commit
778bc99383
1 changed files with 15 additions and 16 deletions
|
|
@ -191,8 +191,8 @@ need feedback regarding whether `gdb` will play nice with this.
|
||||||
This issue may not directly relate to declarative wrappers, and it is already
|
This issue may not directly relate to declarative wrappers, and it is already
|
||||||
addressed in @FRidh's [pull 95569](https://github.com/NixOS/nixpkgs/pull/95569), but perhaps
|
addressed in @FRidh's [pull 95569](https://github.com/NixOS/nixpkgs/pull/95569), but perhaps
|
||||||
both ideas could be integrated into an alternative, simpler creation method of
|
both ideas could be integrated into an alternative, simpler creation method of
|
||||||
binary wrappers. See
|
binary wrappers. See [my
|
||||||
[comment](https://github.com/NixOS/nixpkgs/pull/95569#issuecomment-674508806)
|
comment](https://github.com/NixOS/nixpkgs/pull/95569#issuecomment-674508806).
|
||||||
|
|
||||||
# Detailed design
|
# Detailed design
|
||||||
[design]: #detailed-design
|
[design]: #detailed-design
|
||||||
|
|
@ -200,13 +200,16 @@ binary wrappers. See
|
||||||
The current design is roughly implemented at
|
The current design is roughly implemented at
|
||||||
[pull 85103](https://github.com/NixOS/nixpkgs/pull/85103) .
|
[pull 85103](https://github.com/NixOS/nixpkgs/pull/85103) .
|
||||||
|
|
||||||
The idea is to have a Nix function, called `wrapGeneric` with an interface
|
The idea is to have a Nix function, let us call it `wrapGeneric`, with an
|
||||||
similar to [`wrapMpv`](https://github.com/NixOS/nixpkgs/blob/a5985162e31587ae04ddc65c4e06146c2aff104c/pkgs/applications/video/mpv/wrapper.nix#L9-L23) and [`wrapNeovim`](https://github.com/NixOS/nixpkgs/blob/a5985162e31587ae04ddc65c4e06146c2aff104c/pkgs/applications/editors/neovim/wrapper.nix#L11-L24) which will accept a single derivation or
|
interface similar to
|
||||||
an array of them and it'll wrap all of their executables with the proper
|
[`wrapMpv`](https://github.com/NixOS/nixpkgs/blob/a5985162e31587ae04ddc65c4e06146c2aff104c/pkgs/applications/video/mpv/wrapper.nix#L9-L23)
|
||||||
environment, based on their inputs.
|
and
|
||||||
|
[`wrapNeovim`](https://github.com/NixOS/nixpkgs/blob/a5985162e31587ae04ddc65c4e06146c2aff104c/pkgs/applications/editors/neovim/wrapper.nix#L11-L24)
|
||||||
|
which will accept a single derivation or an array of them and it'll wrap all of
|
||||||
|
their executables with the proper environment, based on their inputs.
|
||||||
|
|
||||||
`wrapGeneric` should iterate recursively all `buildInputs` and
|
`wrapGeneric` should iterate recursively all `buildInputs` and
|
||||||
`propagatedBuildInputs` of the input derivations, and construct an attrset with
|
`propagatedBuildInputs` of the input derivation(s), and construct an attrset with
|
||||||
which it'll calculate the necessary environment of the executables. Then either
|
which it'll calculate the necessary environment of the executables. Then either
|
||||||
via `wrapProgram` or a better method, it'll create the wrappers.
|
via `wrapProgram` or a better method, it'll create the wrappers.
|
||||||
|
|
||||||
|
|
@ -218,20 +221,16 @@ and with this information at hand, construct the necessary wrapper.
|
||||||
|
|
||||||
In order for `wrapGenric` to know all of this information about our packaged
|
In order for `wrapGenric` to know all of this information about our packaged
|
||||||
libraries - the information about runtime env, we need to write in the
|
libraries - the information about runtime env, we need to write in the
|
||||||
`passthru`s of these libraries, what env vars they need.
|
`passthru`s of these libraries, what env vars they need. Such information was
|
||||||
|
added in the POC pull at [commit
|
||||||
This Nix function, let us call it `wrapGeneric`, should iterate recursively all
|
|
||||||
`buildInputs` and `propagatedBuildInputs` of a given derivation, and decide
|
|
||||||
what environment this derivation will need to run. Such information was added
|
|
||||||
in the [POC pull's
|
|
||||||
@6283f15](https://github.com/NixOS/nixpkgs/pull/85103/commits/6283f15bb9b65af64571a78b039115807dcc2958).
|
@6283f15](https://github.com/NixOS/nixpkgs/pull/85103/commits/6283f15bb9b65af64571a78b039115807dcc2958).
|
||||||
|
|
||||||
Additional features / improvements are [already
|
Additional features / improvements are [already
|
||||||
available](https://github.com/NixOS/nixpkgs/pull/85103#issuecomment-614195666)
|
available](https://github.com/NixOS/nixpkgs/pull/85103#issuecomment-614195666)
|
||||||
in the POC pull. For example:
|
in the POC pull. For example:
|
||||||
|
|
||||||
- It should be impossible for multi-value env vars to have duplicates, as
|
- It should be **impossible** for multi-value env vars to have duplicates, as
|
||||||
that's guaranteed by Nix' behavior when constructing arrays.
|
that's guaranteed by Nix' behavior when constructing arrays / attrsets.
|
||||||
- Asking the wrapper creator to use more links and less colon-separated values
|
- Asking the wrapper creator to use more links and less colon-separated values
|
||||||
in env vars - should help avoid what [pull
|
in env vars - should help avoid what [pull
|
||||||
84689](https://github.com/NixOS/nixpkgs/pull/84689) fixed.
|
84689](https://github.com/NixOS/nixpkgs/pull/84689) fixed.
|
||||||
|
|
@ -242,7 +241,7 @@ in the POC pull. For example:
|
||||||
All examples are copied from and based on the [POC
|
All examples are copied from and based on the [POC
|
||||||
pull](https://github.com/NixOS/nixpkgs/pull/85103).
|
pull](https://github.com/NixOS/nixpkgs/pull/85103).
|
||||||
|
|
||||||
The new method of creating a python environment:
|
Here's a new method of creating a python environment:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
my-python-env = wrapGeneric python3 {
|
my-python-env = wrapGeneric python3 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue