in older Nix versions, nix fmt
using treefmt-nix
has different results depending on cwd.
#303
Labels
bug
Something isn't working
note
it seems this issue happens with Lix 2.91, but doesn't happen with nix 2.24.
Maybe the fix is to note a minimum supported Nix version in the README?
Describe the bug
NOTE: I'm using
lix
using treefmt-nix, i have my
treefmt.nix
file in a./nix
folder, while my flake is in the root.if i set
projectRootFile = "./flake.nix";
then formatting doesn't work if i run
nix fmt
in the cwd of the./nix
folder, just outputtingeven though the
nix fmt
command logspath '/home/ari/src/project_here/nix' does not contain a 'flake.nix', searching up
and runs successfully.but if i set it to
projectRootFile = "../flake.nix";
, then it doesn't work when i runnix fmt
from the root, withtreefmt: error: could not find [../flake.nix] in /home/ari/src/project_here
.To Reproduce
Steps to reproduce the behavior:
and write to treefmt.nix
and flake.nix
Expected behavior
In
treefmt.nix
,either
projectRootFile = "../flake.nix";
should work when i runnix fmt
from the root,or
projectRootFile = "./flake.nix";
should work when i runnix fmt
from thenix
folder.System information
Commit
f2cc121df15418d028a59c9737d38e3a90fbaf8f
onNixOS 25.05.20250115.0bd024d (Warbler) x86_64
nix (Lix, like Nix) 2.91.1
Reproduction is available here: https://github.com/arilotter/fmt-tree-bug
The text was updated successfully, but these errors were encountered: