infra/roles/nix-daemon.nix

40 lines
855 B
Nix
Raw Normal View History

2021-03-04 10:56:14 +01:00
{ config, lib, pkgs, ... }:
let
asGB = size: toString (size * 1024 * 1024);
in
{
nix = {
binaryCachePublicKeys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
binaryCaches = [
"https://nix-community.cachix.org"
];
2021-03-06 19:15:05 +01:00
# useful for ad-hoc nix-shell's for debugging
nixPath = [ "nixpkgs=${pkgs.path}" ];
2021-03-04 10:56:14 +01:00
extraOptions = ''
# auto-free the /nix/store
min-free = ${asGB 10}
max-free = ${asGB 200}
# avoid copying unecessary stuff over SSH
builders-use-substitutes = true
# allow flakes
experimental-features = nix-command flakes
'';
# Hard-link duplicated files
autoOptimiseStore = true;
# Add support for flakes
package = pkgs.nixUnstable;
gc.automatic = true;
gc.options = "--delete-older-than 30d";
};
}