FAQ: Difference between revisions

TLATER (talk | contribs)
Add FAQ entry on mixing stable/unstable
Ardenet (talk | contribs)
m Adjust the position of page translation tags
Line 413: Line 413:
NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/release-17.09.tar.gz nix-shell -p $software
NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/release-17.09.tar.gz nix-shell -p $software
</syntaxhighlight>
</syntaxhighlight>
<translate>
<translate>
=== There's an updated version for $software on the unstable branch, but I use stable, how can I use it? ===


=== There's an updated version for $software on the unstable branch, but I use stable, how can I use it? ===
Before going ahead with this, note that firstly, this likely means that the package you intend to update has had a major version change. If you have used it previously, there is a chance that your existing data either will not work with the new version or will need to be migrated; If in doubt, consult the upstream documentation of the package.  
Before going ahead with this, note that firstly, this likely means that the package you intend to update has had a major version change. If you have used it previously, there is a chance that your existing data either will not work with the new version or will need to be migrated; If in doubt, consult the upstream documentation of the package.  


Line 427: Line 428:


==== Using channels ====
==== Using channels ====
First we need to add the unstable channel to our system channels:
First we need to add the unstable channel to our system channels:
{{Warning|`nixos-rebuild --upgrade` will by default only update the channel named `nixos`, which this new channel is not. Use `nixos-rebuild --upgrade-all` instead.}}
{{Warning|`nixos-rebuild --upgrade` will by default only update the channel named `nixos`, which this new channel is not. Use `nixos-rebuild --upgrade-all` instead.}}
</translate>
</translate>
<syntaxhighlight lang="console">
<syntaxhighlight lang="console">
$ sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos-unstable
$ sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos-unstable
$ sudo nix-channel --update
$ sudo nix-channel --update
</syntaxhighlight>
</syntaxhighlight>
<translate>
<translate>
Then we can import this channel using the angle-bracket notation to refer to it:
Then we can import this channel using the angle-bracket notation to refer to it:
</translate>
</translate>
<syntaxhighlight lang="nixos"># configuration.nix
<syntaxhighlight lang="nixos"># configuration.nix
{  
{  
Line 454: Line 460:
   ];
   ];
}</syntaxhighlight>
}</syntaxhighlight>
<translate>
<translate>
==== Using flakes ====


==== Using flakes ====
We simply add the unstable branch to our flake inputs, and pass them into the NixOS module system using <code>specialArgs</code>:
We simply add the unstable branch to our flake inputs, and pass them into the NixOS module system using <code>specialArgs</code>:
</translate>
</translate>
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
# flake.nix
# flake.nix
Line 488: Line 496:
}
}
</syntaxhighlight>
</syntaxhighlight>
<translate>
<translate>
Using this in <code>configuration.nix</code> then looks as follows:
Using this in <code>configuration.nix</code> then looks as follows:
</translate>
</translate>
<syntaxhighlight lang="nixos">
<syntaxhighlight lang="nixos">
# configuration.nix
# configuration.nix
Line 503: Line 513:
}
}
</syntaxhighlight>
</syntaxhighlight>
<translate>
<translate>
=== How do I install a specific version of a package for build reproducibility etc.? === <!--T:14-->
=== How do I install a specific version of a package for build reproducibility etc.? === <!--T:14-->