infra/roles/nix-daemon.nix
2022-01-29 11:24:59 +01:00

40 lines
948 B
Nix

{ config, lib, pkgs, ... }:
let
asGB = size: toString (size * 1024 * 1024);
in
{
nix = {
settings.trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
settings.substituters = [
"https://nix-community.cachix.org"
];
# Hard-link duplicated files
settings.auto-optimise-store = true;
# auto-free the /nix/store
settings.min-free = asGB 10;
settings.max-free = asGB 200;
# avoid copying unecessary stuff over SSH
settings.builders-use-substitutes = true;
# allow flakes
settings.experimental-features = "nix-command flakes";
# users in trusted group are trusted by the nix-daemon
settings.trusted-users = [ "@trusted" ];
# useful for ad-hoc nix-shell's for debugging
nixPath = [ "nixpkgs=${pkgs.path}" ];
gc.automatic = true;
gc.options = "--delete-older-than 30d";
};
users.groups.trusted = {};
}