infra/modules/shared/nix-daemon.nix
2024-11-25 02:57:16 +00:00

48 lines
1 KiB
Nix

{
config,
inputs,
pkgs,
...
}:
let
asGB = size: toString (size * 1024 * 1024 * 1024);
in
{
nixpkgs.hostPlatform = {
inherit (pkgs.hostPlatform) system;
};
nix = {
settings.trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
settings.substituters = [ "https://nix-community.cachix.org" ];
# auto-free the /nix/store
settings.min-free = asGB 1;
settings.max-free = asGB 50;
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;
gc.automatic = pkgs.lib.mkDefault true;
gc.options = pkgs.lib.mkDefault "--delete-older-than 14d";
};
}