-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
Conversation
Apparently this is a little slower but much safer & not prone to potential argument errors.
5e8c0d3
to
498a242
Compare
doc/functions/fetchers.xml
Outdated
|
||
<para> | ||
<function>fetchpatch</function> works very similarly to | ||
<function>fetchurl</function> with the same arguments expected. |
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.
<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 = { |
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.
👍
<listitem> | ||
<para> | ||
Used with Git. Expects <literal>url</literal> to a Git repo, | ||
<literal>rev</literal>, and <literal>sha256</literal>. |
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.
<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>. |
doc/functions/trivial-builders.xml
Outdated
<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 |
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.
probably mention that env
is propagated to underlying mkDerivation
?
doc/functions/fetchers.xml
Outdated
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, |
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.
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> |
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.
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 |
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.
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 |
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.
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 |
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.
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. |
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.
store. This currently Linux only. | |
store. This is currently supported in Linux only. |
doc/functions/trivial-builders.xml
Outdated
</varlistentry> | ||
<varlistentry> | ||
<term> | ||
<literal>writeTextFile</literal> |
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.
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?
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.
cc @tazjin
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.
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!
doc/functions/fetchers.xml
Outdated
|
||
<para> | ||
When using Nix, you will frequently need to download source code | ||
and other file from the internet. Nixpkgs comes with a few helper |
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.
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. |
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.
structured way. | |
a structured way. |
doc/functions/trivial-builders.xml
Outdated
<title>Trivial builders</title> | ||
|
||
<para> | ||
There are a couple of functions provide in Nixpkgs that help with |
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.
There are a couple of functions provide in Nixpkgs that help with | |
Nixpkgs provides a couple of functions that help with |
doc/functions/trivial-builders.xml
Outdated
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 |
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.
documented above. These wrap | |
documented above. The following functions wrap |
doc/functions/trivial-builders.xml
Outdated
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 |
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 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 |
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.
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 |
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.
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 |
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.
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 |
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.
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. |
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.
might be. | |
might cover most uses. |
Mostly taken from requested changes exactly as recommended.
Thanks for the review comments! I have integrated all of them mentioned so far. |
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.