Use Determinate with nix-darwin
You can use nix-darwin with Determinate without issue provided that you let Determinate Nix handle your Nix configuration rather than nix-darwin. To that end, you need to add this line to your nix-darwin configuration:
flake.nix
{
darwinConfigurations.my-system-aarch64-darwin = nix-darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = [
({ ... }: {
# Let Determinate Nix handle Nix configuration
nix.enable = false;
})
];
};
}
To supply custom Nix configuration, such values for trusted-substituters
and trusted-public-keys
, you can use the /etc/nix/nix.custom.conf
file.
See our documentation on configuring Determinate Nix for more information.
If you’d like to set that custom configuration using nix-darwin, you can use the determinate
nix-darwin module.
Here’s an example nix-darwin configuration that writes custom settings:
flake.nix
{
inputs.determinate.url = "https://flakehub.com/f/DeterminateSystems/determinate/3";
inputs.nix-darwin = {
url = "https://flakehub.com/f/nix-darwin/nix-darwin/0";
inputs.nixpkgs.follows = "nixpkgs";
};
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0";
outputs = { determinate, nixpkgs, ... }: {
darwinConfigurations."my-username-aarch64-darwin" = inputs.nix-darwin.lib.darwinSystem {
inherit system;
modules = [
# Add the determinate nix-darwin module
inputs.determinate.darwinModules.default
({ ... }: {
# Let Determinate Nix handle Nix configuration rather than nix-darwin
nix.enable = false;
# Custom settings written to /etc/nix/nix.custom.conf
determinate-nix.customSettings = {
flake-registry = "/etc/nix/flake-registry.json";
};
})
];
};
};
}