FAQ: Difference between revisions

SYMYS (talk | contribs)
No edit summary
Klinger (talk | contribs)
m changed link from redirect to article
(10 intermediate revisions by 6 users not shown)
Line 11: Line 11:
** PHP 7.3.33 (EOL 2021-12)
** PHP 7.3.33 (EOL 2021-12)
** ICU 64.2
** ICU 64.2
* Cloudflare DDOS protection makes wiki edits fail sometimes.
* Cloudflare DDOS protection makes wiki edits fail sometimes.
* There is no WYSIWYG editor.
* There is no WYSIWYG editor.
* The wiki infrastructure, which was supposed to be made public after launch, never ended-up being made public.


* The wiki infrastructure, which was supposed to be made public after launch, never ended-up being made public.
We tried to address these issues multiple times over multiple years across multiple channels (email, matrix). We never got a direct answer. The last point of contact was made through zimbatm representing the NixOS foundation, asking the maintainer about possible cooperation on a new wiki. The answer was no. With the old wiki deteriorating and the maintainer unresponsive, forking the content into a new wiki remained the only way forward.
We tried to address these issues multiple times over multiple years across multiple channels (email, matrix). We never got a direct answer. The last point of contact was made through zimbatm representing the NixOS foundation, asking the maintainer about possible cooperation on a new wiki. The answer was no. With the old wiki deteriorating and the maintainer unresponsive, forking the content into a new wiki remained the only way forward.


Also see: https://nixos.wiki/wiki/User:Winny/WikiRisks
Also see:
* https://nixos.wiki/wiki/User:Winny/WikiRisks
* https://greasyfork.org/en/scripts/495011-redirect-to-wiki-nixos-org (trivial userscript to redirect nixos.wiki links here)
 
== Why is Nix written in C++ rather than a functional language like Haskell? ==
== Why is Nix written in C++ rather than a functional language like Haskell? ==


Line 151: Line 152:


If you are in a hurry and just want to get shit running, continue reading:<br />
If you are in a hurry and just want to get shit running, continue reading:<br />
Compiled binaries have hard-coded interpreter and require certain dynamic libraries. You can use [https://nixos.org/patchelf.html patchelf] to set the library path and dynamic linker appropriately:
 
You can use [https://github.com/Mic92/nix-ld nix-ld] to run compiled binaries. For example, if your binary needs zlib and openssl:
 
<syntaxhighlight lang="nix">
programs.nix-ld = {
  enable = true;
  libraries = [ pkgs.zlib pkgs.openssl ];
};</syntaxhighlight>
 
Log out and back in to apply the environment variables it sets, and you can then directly run the binary.
 
If you don't want to configure the list of libraries manually, a quick and dirty way to run nearly any precompiled binary is the following:
 
<syntaxhighlight lang="nix">
programs.nix-ld = {
  enable = true;
  libraries = pkgs.steam-run.fhsenv.args.multiPkgs pkgs;
};</syntaxhighlight>
 
This uses the libraries that are used by [[Steam]] to simulate a traditional Linux FHS environment to run games in. It's a [https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/games/steam/fhsenv.nix big list] that usually contains all the libraries your binary needs to run.
 
Another possibility is to use [https://nixos.org/patchelf.html patchelf] to set the library path and dynamic linker appropriately, since compiled binaries have hard-coded interpreter and require certain dynamic libraries.


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
Line 209: Line 231:


== What are channels and how do they get updated? ==
== What are channels and how do they get updated? ==
{{main|Nix Channels}}
{{main|Channel branches}}


[https://github.com/NixOS/nixpkgs Nixpkgs] is the git repository containing all packages and NixOS modules/expressions. Installing packages directly from Nixpkgs master branch is possible but a bit risky as git commits are merged into master before being heavily tested. That's where channels are useful.
[https://github.com/NixOS/nixpkgs Nixpkgs] is the git repository containing all packages and NixOS modules/expressions. Installing packages directly from Nixpkgs master branch is possible but a bit risky as git commits are merged into master before being heavily tested. That's where channels are useful.
Line 253: Line 275:


== Nixpkgs branches ==
== Nixpkgs branches ==
Branches on the nixpkgs repo have a relationship with [[channels]], but that relationship is not 1:1.
Branches on the nixpkgs repo have a relationship with channels, but that relationship is not 1:1.


Some branches are reified as channels (e.g. the <code>nixos-XX.YY</code> branches, or <code>nix(os|pkgs)-unstable</code>), whereas others are the starting point for those branches (e.g. the <code>master</code> or <code>release-XX.YY</code> branches). For example:
Some branches are reified as channels (e.g. the <code>nixos-XX.YY</code> branches, or <code>nix(os|pkgs)-unstable</code>), whereas others are the starting point for those branches (e.g. the <code>master</code> or <code>release-XX.YY</code> branches). For example:


* When a change in master needs to be backported to the current NixOS release, it is cherry-picked into the current <code>release-XX.YY</code> branch
* When a change in master needs to be backported to the current NixOS release, it is cherry-picked into the current <code>release-XX.YY</code> branch
* [[Nix_channels#Channel_update_process|Hydra]] picks up this change, runs tests, and if those tests pass, updates the corresponding <code>nixos-XX.YY</code> branch, which is then reified as a channel.
* [[Channel branches#Channel_update_process|Hydra]] picks up this change, runs tests, and if those tests pass, updates the corresponding <code>nixos-XX.YY</code> branch, which is then reified as a channel.


So in short, the <code>relase-XX.YY</code> branches have not been run through Hydra yet, whereas the <code>nixos-XX.YY</code> ones have.
So in short, the <code>relase-XX.YY</code> branches have not been run through Hydra yet, whereas the <code>nixos-XX.YY</code> ones have.
Line 343: Line 365:
</syntaxhighlight>
</syntaxhighlight>


See [[Nix Package Manager#Sandbox_builds]] for more details.
See [[Nix package manager#Sandbox_builds]] for more details.
 
{{:FAQ/notfound}}
{{:FAQ/unfree}}


== How can I install a package from unstable while remaining on the stable channel? ==
== How can I install a package from unstable while remaining on the stable channel? ==
Line 412: Line 431:
The name <code>Nix</code> comes from the Dutch word [https://en.wiktionary.org/wiki/nix niks] which means ''nothing''. It reflects the fact that Nix derivations do not have access to anything that has not been explicitly declared as an input.<ref>Eelco Dolstra et al. “Nix: A Safe and Policy-Free System for Software Deployment.” LiSA (2004), https://pdfs.semanticscholar.org/5fd8/8f89bd8738816e62808a1b7fb12d3ab14a2f.pdf</ref>
The name <code>Nix</code> comes from the Dutch word [https://en.wiktionary.org/wiki/nix niks] which means ''nothing''. It reflects the fact that Nix derivations do not have access to anything that has not been explicitly declared as an input.<ref>Eelco Dolstra et al. “Nix: A Safe and Policy-Free System for Software Deployment.” LiSA (2004), https://pdfs.semanticscholar.org/5fd8/8f89bd8738816e62808a1b7fb12d3ab14a2f.pdf</ref>


== What does it mean to say that NixOS is "immutable"? ==
== What does it mean to say that NixOS is "immutable" ==
Immutability is a property of data, in general, which means that the data cannot be modified after it is created. In the context of an operating system, it really means that certain parts of the system have this property. In the case of Nix and NixOS, that includes the Nix store, where files can be created but not modified after the time they are created. It does not apply to every part of the operating system, in that users can still modify their own files in their home directory, for example.
Immutability is a property of data, in general, which means that the data cannot be modified after it is created. In the context of an operating system, it really means that certain parts of the system have this property. In the case of Nix and NixOS, that includes the Nix store, where files can be created but not modified after the time they are created. It does not apply to every part of the operating system, in that users can still modify their own files in their home directory, for example.
{{:FAQ/Libraries}}
{{:FAQ/nix-env -iA}}
{{:FAQ/stateVersion}}
{{:FAQ/notfound}}
{{:FAQ/unfree}}
<!-- Transclude subpages -->


== References ==
== References ==


[[Category:Cookbook]]
[[Category:Cookbook]]