flake-compat icon indicating copy to clipboard operation
flake-compat copied to clipboard

Is it possible to use flake-compat without flakes enabled?

Open jalaziz opened this issue 1 year ago • 5 comments

My understanding was that flake-compat could be used to enable the use of flakes with stable Nix. However, when I run nix-shell for my devShell based project, I receive:

error: experimental Nix feature 'flakes' is disabled; add '--extra-experimental-features flakes' to enable it

Am I misunderstanding the purpose of flake-compat?

jalaziz avatar May 20 '24 19:05 jalaziz

The purpose is to allow you to import a flake into a non-flake Nix project.

for my devShell based project,

If you're making your own flake.nix, and using flake-enabled commands such as nix shell (you mentioned nix-shell, but I'm not sure if you meant to?), you still need to enable the flakes experimental feature.

justinas avatar Aug 27 '24 18:08 justinas

The purpose is to allow you to import a flake into a non-flake Nix project.

That's right. It shouldn't be necessary to enable the flakes experimental feature.

The purpose is to allow you to import a flake into a non-flake Nix project.

No, that's what builtins.getFlake is for.

edolstra avatar Nov 27 '24 15:11 edolstra

In principle. There was a regression in #67 due to an old Nix bug that seems to be fixed in 2.24 at least in which builtins.fetchTree is visible but throws if the flakes experimental feature is disabled. This repo needs to have clearer compatibility guarantees since it is broken on Lix and Nix 2.18 today.

We do have a fix in the pipeline in Lix for this, but this is broken in 2.18 today.

lf- avatar Mar 05 '25 18:03 lf-

This is still an issue. Nix version 2.28.4, fresh install of NixOS. Enabling flakes on my install fixed it, but that is obviously not ideal.

JupiterSky11 avatar Aug 01 '25 15:08 JupiterSky11

I have absolutely no idea why this doesn't work for you. Does https://git.lix.systems/lix-project/flake-compat work for you?

lf- avatar Aug 01 '25 17:08 lf-