-
-
Notifications
You must be signed in to change notification settings - Fork 234
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 outline for "sharing deps" tutorial #622
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a short snippet/idea.
|
||
<!-- What is the reader supposed to gain from reading this? --> | ||
- Show the reader how to set up a development environment. | ||
- Show the reader how not to repeat themselves. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Show the reader how to repeat themselves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(this is intended as a step before showing the readers how not to repeat themselves)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed in LJWG meeting, comments are collaborative.
|
||
## Assumptions | ||
- The reader has seen a derivation before. | ||
- The reader understands that builders come from `nixpkgs`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: There is a Nixpkgs PR discussing to rename "builder" to "build helper"
# Sharing dependencies between `default.nix` and `shell.nix` | ||
|
||
## Assumptions | ||
- The reader has seen a derivation before. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to specify which tutorials or explanations should have been read first. Is it "packaging existing software"?
- Demonstrate that in order to bring those tools into our environment with the current `default.nix` those packages would also be included in the build even though they aren't necessary to build our application. | ||
- (Optional) Add the packages to `propagatedBuildInputs` and show that they're included in the closure. | ||
- Create a `shell.nix` to separate build dependencies from development dependencies. | ||
- Duplicate dependencies from `default.nix` so that you can still perform the build in `shell.nix`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skip the duplication step, go directly to the viable solution.
# default.nix | ||
let | ||
myPackage = python3Packages.buildPythonApplication { | ||
propagatedBuildInputs = [ | ||
python3Packages.flask | ||
]; | ||
}; | ||
in myPackage // { | ||
shell = mkShell { | ||
inputsFrom = [ | ||
myPackage | ||
]; | ||
buildInputs = [ | ||
curl | ||
]; | ||
}; | ||
} | ||
|
||
# shell.nix | ||
(import ./default.nix).shell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be also a recipe that assumes you know the skills and concepts involved.
## Assumptions | ||
- The reader has seen a derivation before. | ||
- The reader understands that builders come from `nixpkgs`. | ||
- The reader knows what a shell environment is. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The reader knows what a shell environment is. | |
- The reader knows what a declarative shell environment is. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-06-29-learning-journey-working-group-meeting-notes-15/29799/1 |
* Add outline for sharing deps tutorial
This PR contains the outline for #600.