Skip to content

Commit b993835

Browse files
devusbclaude
andcommitted
docs: add troubleshooting for Flox building from source as flake input
Covers two common causes: using `follows` for nixpkgs (which changes store paths away from what's cached) and the Flox binary cache not appearing in `substituters` (only in `trusted-substituters`). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4e855fb commit b993835

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

docs/install-flox/troubleshooting.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,88 @@ brew uninstall --force --zap flox
166166
After rebooting, re-install Flox following the instructions on the
167167
[Install](install.md) page.
168168

169+
## Flox builds from source when installed as a Nix flake input
170+
171+
If you consume Flox as a flake input in your NixOS or nix-darwin configuration,
172+
you may find that Nix builds Flox from source instead of fetching it from the
173+
Flox binary cache.
174+
There are two common causes.
175+
176+
### Using `follows` for nixpkgs
177+
178+
If your flake input for Flox uses `inputs.nixpkgs.follows = "nixpkgs"`,
179+
the resulting store paths will differ from the ones in the Flox binary cache
180+
because the cache was built against the nixpkgs revision pinned in the
181+
[Flox flake.lock](https://github.com/flox/flox).
182+
183+
#### Solution
184+
185+
Remove the `follows` directive so that Flox uses its own pinned nixpkgs:
186+
187+
```nix
188+
# flake.nix
189+
{
190+
inputs = {
191+
flox.url = "github:flox/flox";
192+
# Do NOT add: flox.inputs.nixpkgs.follows = "nixpkgs";
193+
};
194+
}
195+
```
196+
197+
The trade-off is an extra copy of nixpkgs in your Nix store,
198+
but Flox's dependencies and yours will coexist without collisions.
199+
200+
### Flox binary cache not in `substituters`
201+
202+
Even with the correct Nix configuration files,
203+
the Flox binary cache (`cache.flox.dev`) may appear only in
204+
`trusted-substituters` and not in `substituters`.
205+
Nix only queries caches listed in `substituters` (or `extra-substituters`)
206+
during builds.
207+
The `trusted-substituters` setting only controls which caches
208+
non-root users are *permitted* to add via `extra-substituters` —
209+
it does not cause Nix to query those caches on its own.
210+
211+
#### Diagnosis
212+
213+
```{ .sh .code-command .copy }
214+
nix config show | grep substituters
215+
```
216+
217+
If `cache.flox.dev` appears in `trusted-substituters` but **not** in
218+
`substituters`, Nix will never query it and will fall back to building
219+
from source.
220+
221+
#### Solution
222+
223+
Add the Flox cache to `extra-substituters` so that it is merged into
224+
`substituters` and actually queried during builds.
225+
For example, in your NixOS or nix-darwin `nix.settings`:
226+
227+
```nix
228+
nix.settings = {
229+
extra-substituters = [ "https://cache.flox.dev" ];
230+
extra-trusted-public-keys = [
231+
"flox-cache-public-1:7F4OyH7ZCnFhcze3fJdfyXYLQw/aV7GEed86nQ7IsOs="
232+
];
233+
};
234+
```
235+
236+
Or directly in `/etc/nix/nix.conf`:
237+
238+
```ini
239+
extra-substituters = https://cache.flox.dev
240+
extra-trusted-public-keys = flox-cache-public-1:7F4OyH7ZCnFhcze3fJdfyXYLQw/aV7GEed86nQ7IsOs=
241+
```
242+
243+
Verify the change took effect:
244+
245+
```{ .sh .code-command .copy }
246+
nix config show | grep substituters
247+
```
248+
249+
`cache.flox.dev` should now appear in the `substituters` line.
250+
169251
## Reporting issues
170252
171253
If your issue is not covered here,

0 commit comments

Comments
 (0)