#
# General nix settings.
#
# vim: et:ts=2:sw=2:
#
{ config, ... }:
{

  nix = {
    settings = {

      # Use nix, lix, and our local cache.
      substituters = [
        "https://cache.nixos.org"
        "https://cache.lix.systems" # for lix
        "https://niri.cachix.org"   # for niri
        "https://cache.soopy.moe"   # for t2-linux
      ];
      trusted-public-keys = [
        "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
        "cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o="
        "niri.cachix.org-1:Wv0OmO7PsuocRKzfDoJ3mulSl7Z6oezYhGhR+3W2964="
        "cache.soopy.moe-1:0RZVsQeR+GOh0VQI9rvnHz55nVXkFardDqfm4+afjPo="
      ];

    };

    # For non-trailblazer machines, allow building on Trailblazer.
    distributedBuilds = !(config.networking.hostName == "trailblazer");
    buildMachines =
      if config.nix.distributedBuilds then
        [
          {
            system = "x86_64-linux";
            protocol = "ssh";

            #hostName = "trailblazer.kate.tailnet.polytheon.org";
            hostName = "100.64.0.12";

            sshUser = "deprekated";
            sshKey = "/home/deprekated/.ssh/id_ed25519";

            maxJobs = 24;
            speedFactor = 25;
          }
        ]
      else
        [ ];
  };

  nixpkgs.config.permittedInsecurePackages = [
    "olm-3.2.16"
  ];

}
