-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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
manual: add "declarative package management" section #25955
manual: add "declarative package management" section #25955
Conversation
This section gives some details on how to setup an "environment" without having to go through NixOS (although it could be used there too). I’ve tried to make it straightforward and have a kind of "tutorial" feel. Not sure if that’s appropriate for the manual, so any recommended changes would be helpful.
Might there be a wiki migration issue this fixes? |
mkdir -p $out/etc/profile.d | ||
cp ${myProfile} $out/etc/profile.d/my-profile.sh | ||
'') | ||
aspell |
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 think it might be better to stick to 2 or 3 packages for the examples.
Just for record, I personally prefer using simple attrmaps instead of |
Do you have an example of your setup? My understanding was you could never get man pages/info pages setup correctly without |
Correct; I do consider #24717 a bug. It's still possible to map over the custom set and amend |
|
||
<para> | ||
<literal>pathsToLink</literal> tells Nixpkgs to only link the paths listed | ||
which gets rid of the extra stuff in the profile. |
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 linking the extra stuff (like <insert concrete non-matching file path>) in the profile.
(feel free to modify slightly if what I am saying is not correct, the point I want to make is that it's vague)
<literal>pathsToLink</literal> tells Nixpkgs to only link the paths listed | ||
which gets rid of the extra stuff in the profile. | ||
<filename>/bin</filename> and <filename>/share</filename> are good | ||
defaults for a user environment, getting rid of the clutter. If you 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.
defaults for a clutter free user environment
is shorter.
|
||
<para> | ||
After building that new environment, look through | ||
<filename>~/.nix-profile</filename> to make sure everything is there that |
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.
-that we wanted
<para> | ||
After building that new environment, look through | ||
<filename>~/.nix-profile</filename> to make sure everything is there that | ||
we wanted. Discerning readers will note that some files are missing. Look |
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.
A fairly long paragraph to make a simple point. Spending words to tell the user is super smart, might be attractive to the latent narcissists , but I count them as waste.
</screen> | ||
|
||
<para> | ||
This provides us with some useful documentation for using our packages. |
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 line doesn't add anything.
|
||
<para> | ||
This provides us with some useful documentation for using our packages. | ||
However, if we actually want those manpages to be detected by man, we need |
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 make man detect our written manpages...
<para> | ||
This provides us with some useful documentation for using our packages. | ||
However, if we actually want those manpages to be detected by man, we need | ||
to set up our environment. This can also be managed within 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.
Overloading the word environment makes it harder to read.
|
||
<screen> | ||
#!/bin/sh | ||
if [ -d $HOME/.nix-profile/etc/profile.d ]; 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.
Not quoting $HOME makes baby Jezus cry. It's better to replace it with ~
.
<screen> | ||
#!/bin/sh | ||
if [ -d $HOME/.nix-profile/etc/profile.d ]; then | ||
for i in $HOME/.nix-profile/etc/profile.d/*.sh; do |
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.
Same
#!/bin/sh | ||
if [ -d $HOME/.nix-profile/etc/profile.d ]; then | ||
for i in $HOME/.nix-profile/etc/profile.d/*.sh; do | ||
if [ -r $i ]; 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.
Quotes
if [ -d $HOME/.nix-profile/etc/profile.d ]; then | ||
for i in $HOME/.nix-profile/etc/profile.d/*.sh; do | ||
if [ -r $i ]; then | ||
. $i |
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.
Quotes
</screen> | ||
|
||
<para> | ||
Now just run <literal>source $HOME/.profile</literal> and you can starting |
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.
~
<title>GNU info setup</title> | ||
|
||
<para> | ||
Configuring GNU info is a little bit trickier than man pages. To work |
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.
Qualifications about difficulty are a waste of words.
To let GNU Info display our <info pages/documentation/whatever> it needs this information indexed in a database, which is done as followed:
extraOutputsToInstall = [ "man" "doc" "info" ]; | ||
postBuild = '' | ||
if [ -x $out/bin/install-info -a -w $out/share/info ]; then | ||
shopt -s nullglob |
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 documentation, not a course in how to program shell, so please rewrite the code such that it doesn't need this.
if [ -x $out/bin/install-info -a -w $out/share/info ]; then | ||
shopt -s nullglob | ||
for i in $out/share/info/*.info $out/share/info/*.info.gz; do | ||
$out/bin/install-info $i $out/share/info/dir |
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.
Quotes
</screen> | ||
|
||
<para> | ||
<literal>postBuild</literal> tells Nixpkgs to run a command after building |
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.
Nixpkgs doesn't really run anything. Please rewrite to be correct.
<para> | ||
<literal>postBuild</literal> tells Nixpkgs to run a command after building | ||
the environment. In this case, <literal>install-info</literal> adds the | ||
installed info pages to <literal>dir</literal> which is GNU info's default |
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 environment. In this case, <literal>install-info</literal> adds the | ||
installed info pages to <literal>dir</literal> which is GNU info's default | ||
root node. Note that <literal>texinfoInteractive</literal> is added to the | ||
environment to give the <literal>install-info</literal> command. |
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 give
is unspecific language.
we wanted. Discerning readers will note that some files are missing. Look | ||
inside <filename>~/.nix-profile/share/man/man1/</filename> to verify this. | ||
There are no man pages for any of the Nix tools! This is because some | ||
packages like Nix have multiple outputs for things like documentation (see |
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.
DocBook is a hyperlinked format, so just link to the section.
|
||
<section xml:id="sec-building-environment"> | ||
<title>Build an environment</title> | ||
|
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.
Please define what is understood by an environment.
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.
Thanks for taking the time to write documentation, but I have quite some comments.
Merging, this is better than what is there. Thank you. |
This section gives some details on how to setup an "environment"
without having to go through NixOS (although it could be used there
too). I’ve tried to make it straightforward and have a kind of
"tutorial" feel. Not sure if that’s appropriate for the manual, so any
recommended changes would be helpful.
Also the section might not be totally appropriate, but this is a fairly general use case, I think.