forked from Bos55/nix-config
feat(substituters): Implement client-side binary cache
This commit is contained in:
parent
c0f5d9ef1f
commit
f49821161c
1 changed files with 28 additions and 0 deletions
28
modules/common/substituters.nix
Normal file
28
modules/common/substituters.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{ config, lib, pkgs, inputs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.homelab.common.substituters;
|
||||
in {
|
||||
options.homelab.common.substituters = {
|
||||
enable = lib.mkEnableOption "Binary cache substituters";
|
||||
domain = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = inputs.self.nixosConfigurations.BinaryCache.config.homelab.services.attic.domain;
|
||||
description = "The domain name of the binary cache.";
|
||||
};
|
||||
publicKey = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
description = "The public key of the Attic cache (e.g., 'homelab:...')";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
nix.settings = {
|
||||
substituters = [
|
||||
"https://${cfg.domain}"
|
||||
];
|
||||
trusted-public-keys = lib.optional (cfg.publicKey != null) cfg.publicKey;
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue