infra/modules/shared/nix-daemon.nix

50 lines
1.2 KiB
Nix
Raw Normal View History

{
config,
inputs,
pkgs,
...
}:
2021-03-04 10:56:14 +01:00
let
2023-09-05 17:27:20 +10:00
asGB = size: toString (size * 1024 * 1024 * 1024);
2021-03-04 10:56:14 +01:00
in
{
nix = {
settings.trusted-public-keys = [
2021-03-04 10:56:14 +01:00
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
2024-07-24 19:05:26 +10:00
settings.substituters = [ "https://nix-community.cachix.org" ];
2021-03-04 10:56:14 +01:00
# auto-free the /nix/store
2024-08-11 12:05:42 +10:00
settings.min-free = asGB 1;
settings.max-free = asGB 50;
2021-03-04 10:56:14 +01:00
channel.enable = false;
# disable global registry
settings.flake-registry = "";
# set system registry
registry = {
nixpkgs.to = {
type = "path";
path = inputs.nixpkgs;
};
self.to = {
type = "path";
path = inputs.self;
};
};
# explicitly set nix-path, NIX_PATH to nixpkgs from system registry
settings.nix-path = [ "nixpkgs=flake:nixpkgs" ];
nixPath = config.nix.settings.nix-path;
2021-03-04 10:56:14 +01:00
2024-08-11 12:05:42 +10:00
gc.automatic = pkgs.lib.mkDefault true;
2023-09-07 12:47:33 +10:00
gc.options = pkgs.lib.mkDefault "--delete-older-than 14d";
# match buildbot timeouts
# https://github.com/nix-community/buildbot-nix/blob/85c0b246cc96cc244e4d9889a97c4991c4593dc3/buildbot_nix/__init__.py#L1008
settings.max-silent-time = toString (60 * 20);
settings.timeout = toString (60 * 60 * 3);
2021-03-04 10:56:14 +01:00
};
}