Skip to content

Commit 6a846d3

Browse files
authored
Use flake.nix for the project root when dealing with flakes (#364)
The default value for `config.projectRootFile` is `.git/config`, which is a nice default that doesn't assume flakes (because flakes are more controversial than git in the nix community :)) However, if you're using flake-parts, then you're definitely OK with flakes, and using `flake.nix` as a project root file makes sense. As a consequence of this, subflakes now probably do what you expect. In other words, this fixes #357. Side note: in the future, nix will expose a `PRJ_ROOT` env var that we could use instead. See NixOS/nix@7635874.
1 parent 4a09832 commit 6a846d3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

flake-module.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ in
6262
Path to the root of the project on which treefmt operates
6363
'';
6464
};
65+
66+
config.projectRootFile = lib.mkDefault "flake.nix";
6567
}
6668
];
6769
};

0 commit comments

Comments
 (0)