This repository was archived by the owner on Mar 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
use-case: deeply replace packages #12
Merged
Merged
Changes from 2 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
fddb8ee
use-cases: deeply replace package
alex-ameen 9c5ac53
focus on existing solution
alex-ameen b0f8ad9
various changes and rename
alex-ameen ba160d9
fmt
alex-ameen ec1a36d
fix bullets
alex-ameen 3f80244
expand nested overlay example
alex-ameen 3bcbab3
fix link
alex-ameen 10f8e5b
fix link
alex-ameen 3062ca3
fix link
alex-ameen 957ade6
fix link
alex-ameen 5a44d92
fix link
alex-ameen 37c35ff
add large example
alex-ameen c7714b7
Update use-cases/deep-replace.md
alex-ameen 40ebafb
add composeOverlays to util
alex-ameen 778029e
improve example
alex-ameen 324a322
Update use-cases/deep-replace.md
alex-ameen 4adf08f
Update use-cases/deep-replace.md
alex-ameen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| #+TITLE: Deeply Replacing Packages in Nixpkgs | ||
|
|
||
| * General Information | ||
|
|
||
| Replace all "instances" of a package across a dependency graph. | ||
| This may be replacing all usage in a package set, collection of package sets, | ||
| a collection of ad-hoc recipes, or a collection of flakes. | ||
|
|
||
| A possible motivation for _deep replacement_ may be to ensure that a security | ||
| fix provided by a new release of a piece of software is used "everywhere" in | ||
| the dependency graph. | ||
|
|
||
|
|
||
| * Concrete Examples | ||
|
|
||
| While the precise organization of packages will effect the complexity and | ||
| effort required to perform _deep replacement_, in general we say that this | ||
| is accomplished using helper functions such as =callPackageWith=, | ||
| =makeScope=, =override=, or =extend=. | ||
|
alex-ameen marked this conversation as resolved.
Outdated
|
||
|
|
||
| #+BEGIN_SRC nix | ||
| let | ||
| nixpkgs = builtins.getFlake "nixpkgs"; | ||
| pkgsFor = builtins.getAttr builtins.currentSystem nixpkgs.legacyPackages; | ||
| patchFoo = final: prev: { foo = final.callPackage ./my-pkgs/foo {}; }; | ||
| in ( pkgsFor.extend patchFoo ).bar | ||
|
alex-ameen marked this conversation as resolved.
Outdated
|
||
| #+END_SRC | ||
|
|
||
| * Current Problems | ||
|
|
||
| With this approach we have three main sources of complexity, none of which | ||
| truly prevent a user from accomplishing their goal; but we might suffice to | ||
| say that it may be worthwhile to provide a more straightforward mechanism | ||
| for handling this use case. | ||
|
|
||
| 1. [[https://github.com/NixOS/nixpkgs/blob/master/lib/customization.nix][github:NixOS/nixpkgs://lib/customization.nix]] routines aren't intuitively understood by many users. | ||
|
alex-ameen marked this conversation as resolved.
Outdated
|
||
|
|
||
|
alex-ameen marked this conversation as resolved.
Outdated
|
||
| 2. Nested scopes are difficult to locate, and the relationship between | ||
| parent scopes and child scopes is not opaque to users. | ||
|
alex-ameen marked this conversation as resolved.
Outdated
|
||
|
|
||
| 3. With ad-hoc recipes and flakes there isn't standardized usage of | ||
| =overlays= that allow deep overriding of packages transitively. | ||
| - Improved guidance on the use of =overlays= and =follows= in =flakes= | ||
| could help a bit here. | ||
|
alex-ameen marked this conversation as resolved.
Outdated
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.