Binary Cache: Difference between revisions
Setup a binary cache with Attic and Caddy |
Mdaniels5757 (talk | contribs) fix some syntaxhighlight errors |
||
| (2 intermediate revisions by one other user not shown) | |||
| Line 4: | Line 4: | ||
== Setting up a binary cache with attic and caddy == | == Setting up a binary cache with attic and caddy == | ||
Here's a snippet enabling Attic and Caddy. | Here's a snippet enabling [https://github.com/zhaofengli/attic Attic] and [https://caddyserver.com/ Caddy]. | ||
Please refer to the [https://docs.attic.rs/ Attic documentation] to set it up correctly.<syntaxhighlight lang="nix" line="1"> | Please refer to the [https://docs.attic.rs/ Attic documentation] to set it up correctly. The goal here is to show how those two services can be used together to provide a solid solution.<syntaxhighlight lang="nix" line="1"> | ||
{ | { | ||
networking.firewall = { | networking.firewall = { | ||
| Line 23: | Line 23: | ||
}; | }; | ||
# Inspired from https://github.com/phanirithvij/system/blob/main/nixos/applications/nix/selfhosted/proxy-cache.nix | # Inspired from: | ||
# 1. https://github.com/phanirithvij/system/blob/main/nixos/applications/nix/selfhosted/proxy-cache.nix | |||
# 2. https://github.com/rnl-dei/nixrnl/blob/master/profiles/proxy-cache.nix | |||
caddy = { | caddy = { | ||
enable = true; | enable = true; | ||
| Line 237: | Line 239: | ||
}; | }; | ||
}; | }; | ||
</syntaxhighlight>As described on [https://search.nixos.org/options?show=nix.settings.substituters&type=packages&query=substituters search.nixos.org] by default <nowiki>https://cache.nixos.org/</nowiki> is added to the substituters. You may need to use lib.mkForce to override this and ensure your substituter is the primary choice.<syntaxhighlight> | </syntaxhighlight>As described on [https://search.nixos.org/options?show=nix.settings.substituters&type=packages&query=substituters search.nixos.org] by default <nowiki>https://cache.nixos.org/</nowiki> is added to the substituters. You may need to use lib.mkForce to override this and ensure your substituter is the primary choice.<syntaxhighlight lang="nix"> | ||
# /etc/nixos/configuration.nix | # /etc/nixos/configuration.nix | ||
| Line 295: | Line 297: | ||
You can place a hint to your binary cache in your Flake so when someone builds an output of your Flake, the nix command will ask interactively to trust the specified binary cache. | You can place a hint to your binary cache in your Flake so when someone builds an output of your Flake, the nix command will ask interactively to trust the specified binary cache. | ||
<syntaxHighlight lang=nix> | <syntaxHighlight lang="nix"> | ||
{ | { | ||
nixConfig = { | nixConfig = { | ||