Ca-derivations: Difference between revisions
imported>Regnat Created page with "'''ca derivations''' (or more formally ''Floating content-addressed derivations'') is an upcoming feature of the Nix package manager. Without entering too much into the detai..." |
The NGI0 Cache doesn't exist since at least summer of 2024 |
||
| (10 intermediate revisions by 6 users not shown) | |||
| Line 12: | Line 12: | ||
<syntaxhighlight lang="nix">{ pkgs, ... }: { | <syntaxhighlight lang="nix">{ pkgs, ... }: { | ||
nix | nix.settings.experimental-features = [ | ||
"ca-derivations" | |||
]; | |||
}</syntaxhighlight> | }</syntaxhighlight> | ||
=== Non NixOS === | === Non NixOS === | ||
Make sure the file `/etc/nix/nix.conf` exists and contains the following: | |||
<syntaxhighlight lang="ini"> | |||
experimental-features = ca-derivations | |||
</syntaxhighlight> | |||
== Using CA derivations == | == Using CA derivations == | ||
The feature is | The feature is opt-in, meaning that each derivation must individually be marked as content-addressed. When using <code>nixpkgs-unstable</code>, this can be done by setting <code>__contentAddressed = true</code> in the call to mkDerivation. | ||
It is also possible to mark all the derivations as content-addressed by default, by passing <code>config.contentAddressedByDefault = true</code> as argument to nixpkgs. | It is also possible to mark all the derivations as content-addressed by default, by passing <code>config.contentAddressedByDefault = true</code> as argument to nixpkgs. | ||
== Ensuring that a derivation is properly content-addressed == | == Ensuring that a derivation is properly content-addressed == | ||
| Line 43: | Line 37: | ||
$ nix path-info --sigs ./result | $ nix path-info --sigs ./result | ||
/nix/store/988jq9bj7s336q48bzdaamcl90k5g1yw-vim-8.2.2567 ca:fixed:r:sha256:0z37vk3ndszn3p2in3li6rk3kln1lfqd9b6vl6w0qhkn7bixqibc</syntaxhighlight> | /nix/store/988jq9bj7s336q48bzdaamcl90k5g1yw-vim-8.2.2567 ca:fixed:r:sha256:0z37vk3ndszn3p2in3li6rk3kln1lfqd9b6vl6w0qhkn7bixqibc</syntaxhighlight> | ||
== Links == | |||
Tweag + Nix dev update #12: https://discourse.nixos.org/t/tweag-nix-dev-update-12/13185/3 | |||
[[Category:Nix]] | |||