feat(ops/modules): Add shared module for TVL cache

Add a shared nixos module for configuring whitby as a binary nix cache,
and refactor tverskoy to use this module.

This is enabled via an option to pave the way for including it as an
import in all depot-generated nixos configs at some point in the future.

Change-Id: I6dcc0e8eb48b1ac34457666dceebeedd5da6c526
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4344
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Reviewed-by: wpcarro <wpcarro@gmail.com>
Autosubmit: grfn <grfn@gws.fyi>
This commit is contained in:
Griffin Smith 2021-12-15 17:44:37 -05:00 committed by grfn
parent 47f1f3be5f
commit 0f5cc25697
2 changed files with 21 additions and 9 deletions

19
ops/modules/tvl-cache.nix Normal file
View file

@ -0,0 +1,19 @@
{ config, lib, pkgs, ... }:
{
options = {
tvl.cache.enable = lib.mkEnableOption "the TVL binary cache";
};
config = lib.mkIf config.tvl.cache.enable {
nix = {
binaryCachePublicKeys = [
"cache.tvl.su:kjc6KOMupXc1vHVufJUoDUYeLzbwSr9abcAKdn/U1Jk="
];
binaryCaches = [
"https://cache.tvl.su"
];
};
};
}

View file

@ -19,18 +19,11 @@ in lib.fix(self: {
imports = [ imports = [
"${depot.third_party.impermanence}/nixos.nix" "${depot.third_party.impermanence}/nixos.nix"
"${depot.path + "/ops/modules/automatic-gc.nix"}" "${depot.path + "/ops/modules/automatic-gc.nix"}"
"${depot.path + "/ops/modules/tvl-cache.nix"}"
"${pkgs.home-manager.src}/nixos" "${pkgs.home-manager.src}/nixos"
]; ];
nix = { tvl.cache.enable = true;
binaryCachePublicKeys = [
"cache.tvl.su:kjc6KOMupXc1vHVufJUoDUYeLzbwSr9abcAKdn/U1Jk="
];
binaryCaches = [
"https://cache.tvl.su"
];
};
boot = rec { boot = rec {
initrd.availableKernelModules = [ "nvme" "ehci_pci" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; initrd.availableKernelModules = [ "nvme" "ehci_pci" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];