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

Nixpkgs documentation additions for 19.03 #54659

Merged
merged 7 commits into from
Jan 27, 2019

Conversation

matthewbauer
Copy link
Member

Motivation for this change

These are a bunch of documentation work I have done. They each have an open issue associated with them that I am hoping to close for 19.03.

I put these together in a rush, so proofreading would be great if you are able to! There may also be some things, especially functions, that I have left out.

@GrahamcOfBorg GrahamcOfBorg added 6.topic: fetch Fetchers (e.g. fetchgit, fetchsvn, ...) 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: documentation This PR adds or changes documentation labels Jan 27, 2019
@GrahamcOfBorg GrahamcOfBorg added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Jan 27, 2019
@matthewbauer matthewbauer changed the title Nixpkgs documentation fixes for 19.03 Nixpkgs documentation additions for 19.03 Jan 27, 2019

<para>
<function>fetchpatch</function> works very similarly to
<function>fetchurl</function> with the same arguments expected.
Copy link
Member

@Mic92 Mic92 Jan 27, 2019

Choose a reason for hiding this comment

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

Suggested change
<function>fetchurl</function> with the same arguments expected.
<function>fetchurl</function> with the same arguments expected.
It expects patch files as a source and and performs normalization
on them before computing the checksum. For example it will remove
comments or other unstable parts that are sometimes added
by version control systems and can change over time.

@@ -261,78 +261,15 @@ in

fetchCrate = callPackage ../build-support/rust/fetchcrate.nix { };

fetchFromGitHub = {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

<listitem>
<para>
Used with Git. Expects <literal>url</literal> to a Git repo,
<literal>rev</literal>, and <literal>sha256</literal>.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<literal>rev</literal>, and <literal>sha256</literal>.
<literal>rev</literal>, and <literal>sha256</literal>.
<literal>rev</literal> in this case can be full the git commit id (SHA1 hash)
or a tag name like <literal>refs/tags/v1.0</literal>.

<literal>env</literal>, and <literal>buildCommand</literal>.
<literal>name</literal> is just the name that Nix will use to
refer to the derivation. <literal>env</literal> is an attribute
set specifying environment variables that will be set for this
Copy link
Contributor

Choose a reason for hiding this comment

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

probably mention that env is propagated to underlying mkDerivation?

GitHub HTML page as
<literal>owner</literal>/<literal>repo</literal>.
<literal>rev</literal> corresponds to the Git commit hash or
tag that will be downloaded from Git. Finally,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
tag that will be downloaded from Git. Finally,
tag (e.g <literal>v1.0</literal>) that will be downloaded from Git. Finally,

you will need to create <literal>$out</literal> for Nix to
register the command as successful.
</para>
</listitem>
Copy link
Contributor

Choose a reason for hiding this comment

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

example is missing

doc/stdenv.xml Outdated
to the shebang interpreter. A shebang interpreter is the first
commented line of a script telling the operating system
what to use to run this script. In Nix, we want an exact path
to that interpreter to be used. This often replcaes
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
to that interpreter to be used. This often replcaes
to that interpreter to be used. This often replaces

doc/stdenv.xml Outdated
This setup hook patches installed scripts to use the full path
to the shebang interpreter. A shebang interpreter is the first
commented line of a script telling the operating system
what to use to run this script. In Nix, we want an exact path
Copy link
Member

@Mic92 Mic92 Jan 27, 2019

Choose a reason for hiding this comment

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

Suggested change
what to use to run this script. In Nix, we want an exact path
what to use to run this script (e.g <literal>#!/bin/bash</literal>). In Nix, we want an exact path

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
what to use to run this script. In Nix, we want an exact path
which program will run the script (e.g <literal>#!/bin/bash</literal>). In Nix, we want an exact path

doc/stdenv.xml Outdated
This verifies that no references are left from the install
binaries to the directory used to build those binaries. This
ensures that the binaries do not need things outside the Nix
store. This currently Linux only.
Copy link
Member

@Mic92 Mic92 Jan 27, 2019

Choose a reason for hiding this comment

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

Suggested change
store. This currently Linux only.
store. This is currently supported in Linux only.

</varlistentry>
<varlistentry>
<term>
<literal>writeTextFile</literal>
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe mention writeText, writeTextDir, writeScript, writeScriptBin and say those are specialization of makeTextFile.

I see those have doc and examples attached in trivial-builders.nix, maybe it should be possible to use some autodocs here?

Copy link
Member

Choose a reason for hiding this comment

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

cc @tazjin

Copy link
Member

Choose a reason for hiding this comment

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

I missed this thread - sorry!

@danbst It should be possible to use nixdoc for this, but the current manual structure only includes doc generation for functions in the lib folder. It would be nice to do it for functions in the package set (such as the trivial builders), too. Ping me here or on IRC if you want some pointers!


<para>
When using Nix, you will frequently need to download source code
and other file from the internet. Nixpkgs comes with a few helper
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
and other file from the internet. Nixpkgs comes with a few helper
and other files from the internet. Nixpkgs comes with a few helper

When using Nix, you will frequently need to download source code
and other file from the internet. Nixpkgs comes with a few helper
functions that allow you to fetch fixed-output derivations in
structured way.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
structured way.
a structured way.

<title>Trivial builders</title>

<para>
There are a couple of functions provide in Nixpkgs that help with
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
There are a couple of functions provide in Nixpkgs that help with
Nixpkgs provides a couple of functions that help with

There are a couple of functions provide in Nixpkgs that help with
building derivations. The most important one,
<function>stdenv.mkDerivation</function>, has already been
documented above. These wrap
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
documented above. These wrap
documented above. The following functions wrap

This takes three arguments, <literal>name</literal>,
<literal>env</literal>, and <literal>buildCommand</literal>.
<literal>name</literal> is just the name that Nix will use to
refer to the derivation. <literal>env</literal> is an attribute
Copy link
Member

Choose a reason for hiding this comment

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

the name that Nix will append to the store path.

doc/stdenv.xml Outdated
<listitem>
<para>
This runs the strip command on installed binaries and
libraries. This removed things like debug symbols when they are
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
libraries. This removed things like debug symbols when they are
libraries. This removes unnecessary information like debug symbols when they are

doc/stdenv.xml Outdated
<para>
This runs the strip command on installed binaries and
libraries. This removed things like debug symbols when they are
not needed. This also helps to reduce installed size of
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
not needed. This also helps to reduce installed size of
not needed. This also helps to reduce the installed size of

doc/stdenv.xml Outdated
This setup hook patches installed scripts to use the full path
to the shebang interpreter. A shebang interpreter is the first
commented line of a script telling the operating system
what to use to run this script. In Nix, we want an exact path
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
what to use to run this script. In Nix, we want an exact path
which program will run the script (e.g <literal>#!/bin/bash</literal>). In Nix, we want an exact path

doc/stdenv.xml Outdated

<para>
Here are some more packages that provide a setup hook. Since the
mechanism is modular, this probably isn't an exhaustive list. Then
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
mechanism is modular, this probably isn't an exhaustive list. Then
list of hooks is extensible, this is not an exhaustive list. Then

doc/stdenv.xml Outdated
Here are some more packages that provide a setup hook. Since the
mechanism is modular, this probably isn't an exhaustive list. Then
again, since the mechanism is only to be used as a last resort, it
might be.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
might be.
might cover most uses.

Mostly taken from requested changes exactly as recommended.
@matthewbauer
Copy link
Member Author

Thanks for the review comments! I have integrated all of them mentioned so far.

@matthewbauer matthewbauer merged commit 14ecdbe into NixOS:master Jan 27, 2019
@matthewbauer matthewbauer deleted the doc-fixes branch February 22, 2019 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: fetch Fetchers (e.g. fetchgit, fetchsvn, ...) 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: documentation This PR adds or changes documentation 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants