1
0
Fork 0
mirror of https://github.com/NixOS/nix.dev.git synced 2024-10-18 14:32:43 -04:00
nix.dev/source/guides/faq.md
Daniel R ab98971f03
move question 'what are channels...?' -f recipes -t concepts (#744)
Co-authored-by: Alexander Groleau <alex@proof.construction>
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Co-authored-by: Silvan Mosberger <silvan.mosberger@tweag.io>
2023-11-07 03:11:25 +01:00

2.6 KiB

Frequently Asked Questions

Nix

How do I add a new binary cache?

Using NixOS (≥ 22.05):

nix.settings = {
  trusted-substituters = [ "https://cache.nixos.org" ];
  substituters = [ "https://cache.nixos.org" ];
};

Using NixOS (≤ 21.11):

nix = {
  trustedBinaryCaches = [ "https://cache.nixos.org" ];
  binaryCaches = [ "https://cache.nixos.org" ];
};

Using Nix:

$ echo "trusted-binary-caches = https://cache.nixos.org" >> /etc/nix/nix.conf
$ nix-build helpers/bench.nix --option extra-binary-caches https://cache.nixos.org

How do I force nix to re-check whether something exists at a binary cache?

Nix caches the contents of binary caches so that it doesn't have to query them on every command. This includes negative answers (cache doesn't have something). The default timeout for that is 1 hour as of writing.

To wipe all cache-lookup-caches:

$ rm $HOME/.cache/nix/binary-cache-v*.sqlite*

Alternatively, use the narinfo-cache-negative-ttl option to reduce the cache timeout.

How to operate between Nix paths and strings?

See http://stackoverflow.com/a/43850372

How to build reverse dependencies of a package?

$ nix-shell -p nixpkgs-review --run "nixpkgs-review wip"

How can I manage dotfiles in $HOME with Nix?

See https://github.com/nix-community/home-manager

E.g. if I git clone nixpkgs how do I use the cloned repo to define new / updated packages?

NixOS

How to build my own ISO?

See http://nixos.org/nixos/manual/index.html#sec-building-image

How do I connect to any of the machines in NixOS tests?

Apply following patch:

diff --git a/nixos/lib/test-driver/test-driver.pl b/nixos/lib/test-driver/test-driver.pl
index 8ad0d67..838fbdd 100644
--- a/nixos/lib/test-driver/test-driver.pl
+++ b/nixos/lib/test-driver/test-driver.pl
@@ -34,7 +34,7 @@ foreach my $vlan (split / /, $ENV{VLANS} || "") {
     if ($pid == 0) {
         dup2(fileno($pty->slave), 0);
         dup2(fileno($stdoutW), 1);
-        exec "vde_switch -s $socket" or _exit(1);
+        exec "vde_switch -tap tap0 -s $socket" or _exit(1);
     }
     close $stdoutW;
     print $pty "version\n";

And then the vde_switch network should be accessible locally.

How to bootstrap NixOS inside an existing Linux installation?

There are a couple of tools: