Nix flake equivalent for `nix build` on older non flake projects?

872 Views Asked by At

Previously I could nix build a project / derivation with a default.nix file.

However after upgrading to Nixos 22.05, and hence Nix 2.8+ running nix build results in:

path '/example/lib' does not contain a 'flake.nix', searching up
error: path '/example/lib' is not part of a flake (neither it nor its parent directories contain a 'flake.nix' file)

Is there some way I can run / build this as before with nix 2.8, without having to modify the project (integrate it with the flakes functionality)? Perhaps a blank/default flake.nix file I could reference in the command? As an alternative I can run nix-env -if default.nix which builds the project however it also adds it to the user profile.

0

There are 0 best solutions below