# Nix daemon settings, binary caches, garbage collection and flake registry. { config, inputs, ... }: let inherit (config.meta) owner; in { flake.modules.nixos.core = { nix = { settings = { experimental-features = [ "nix-command" "flakes" ]; auto-optimise-store = true; # root is already trusted by default; this adds the admin group. trusted-users = [ "@wheel" ]; warn-dirty = false; # Same caches as flake.nixConfig, so the system keeps using them after # install without the "untrusted flake settings" prompt. extra-substituters = [ "https://nix-community.cachix.org" "https://noctalia.cachix.org" ]; extra-trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "noctalia.cachix.org-1:pCOR47nnMEo5thcxNDtzWpOxNFQsBRglJzxWPp3dkU4=" ]; }; gc = { automatic = true; dates = "weekly"; options = "--delete-older-than 14d"; }; # `nix shell nixpkgs#foo` and use the exact nixpkgs of this flake # instead of fetching a different revision. channel.enable = false; registry.nixpkgs.flake = inputs.nixpkgs; nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; }; programs = { # Nicer `nixos-rebuild` front-end that knows where the flake lives. nh = { enable = true; flake = "/home/${owner.name}/nixos-config"; }; }; }; }