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

Reworked Getting started guide #1012

Merged
merged 2 commits into from
Jul 10, 2024
Merged

Reworked Getting started guide #1012

merged 2 commits into from
Jul 10, 2024

Conversation

phaer
Copy link
Member

@phaer phaer commented Jul 9, 2024

Our getting started guide previously mostly showed a template but didn't explain too much what's happening. I tried to improve that using code annotations.

Happy for any feedback, especially from people who do not have too much experience with nix & dream2nix yet as you are the target audience :)

I am also working on a Python & Pip guide, hope to push that one soonish.

Comment on lines +70 to +76
1. Import dream2nix and tell nix to use whatever version of nixpkgs dream2nix declares. You can use other versions, but this it what we run our automated tests with.
2. Define a helper function that allows us to reduce boilerplate and still support all of of the listed systems for our package.
3. Create our package, called `hello` here, by *evaluating* the given dream2nix [modules](../modules.md).
4. Pass the given instance of nixpkgs to build our package with as a *module argument*.
5. Include our package definition from `hello.nix`. See below for its contents!
6. Define relative paths to aid dream2nix to find lock files and so on during *evaluation time*. These settings should work for repos containing multiple python projects as simpler ones.
7. We declare `hello` to be the default package. This allows us to just call i.e. `nix build .#` instead of `nix build .#hello`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should these be inlined instead of referenced?

Copy link
Member

Choose a reason for hiding this comment

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

After rendering via mkdocs those get inlined.
Try:

nix build .#website
python3 -m http.server -d ./result

Copy link
Member Author

Choose a reason for hiding this comment

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

As regular comments? I tried both and found this to be a bit nicer in context, but don't know. Maybe newer users would tend to read it linearly from top to bottom anyway.

Copy link
Member

@DavHau DavHau left a comment

Choose a reason for hiding this comment

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

I really like how much of the information is hidden behind clickable tooltips. It makes the guide short and concise. I wonder if we should have a hint at the beginning of the document telling the user to click on the plus icons to discover more. It took me a while to find that out.

Comment on lines +95 to +101
# (4)
# deps = {nixpkgs, ...}: {
# inherit
# (nixpkgs)
# stdenv
# ;
# };
Copy link
Member

Choose a reason for hiding this comment

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

Maybe remove this for now? The deps concept could still be introduced in another guide.
Also I'm not even sure if we should keep deps, or if we better just provide access to pkgs. The user can still use overlays to override deps etc.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, same applies for the lock mention. I'd suggest moving it into a modules guide when thats done :)

@phaer
Copy link
Member Author

phaer commented Jul 10, 2024

Merging this for now, going to remove the deps example later on. Think it's useful to show the rendered annotations, as that caused confusion earlier in the thread here.

@phaer phaer merged commit 0c6b5c8 into nix-community:main Jul 10, 2024
145 checks passed
@phaer phaer deleted the guides branch July 10, 2024 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants