Skip to content

Commit a7d5dd1

Browse files
authored
[minor cleanup] use flake dir instead of flake-file-path in nix print-dev-env (#1538)
## Summary This has been bugging me for many months. Previously, with DEVBOX_DEBUG=1 and doing some command that evaluated `nix print-dev-env`, we'd see output like: ``` path '/Users/savil/code/jetpack/devbox-projects/lagoja-global/.devbox/gen/flake/flake.nix' does not contain a 'flake.nix', searching up ``` This is because `nix print-dev-env` expects the path to the flake directory but not including the flake.nix itself. ## How was it tested? changed devbox.json to trigger a re-evaluation of `nix print-dev-env`, and then `DEVBOX_DEBUG=1 devbox install` and didn't see such output
1 parent cd4f67c commit a7d5dd1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

internal/impl/devbox.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ func (d *Devbox) computeNixEnv(ctx context.Context, usePrintDevEnvCache bool) (m
782782
maps.Copy(originalEnv, env)
783783

784784
vaf, err := d.nix.PrintDevEnv(ctx, &nix.PrintDevEnvArgs{
785-
FlakesFilePath: d.nixFlakesFilePath(),
785+
FlakeDir: d.flakeDir(),
786786
PrintDevEnvCachePath: d.nixPrintDevEnvCachePath(),
787787
UsePrintDevEnvCache: usePrintDevEnvCache,
788788
})
@@ -935,8 +935,8 @@ func (d *Devbox) nixPrintDevEnvCachePath() string {
935935
return filepath.Join(d.projectDir, ".devbox/.nix-print-dev-env-cache")
936936
}
937937

938-
func (d *Devbox) nixFlakesFilePath() string {
939-
return filepath.Join(d.projectDir, ".devbox/gen/flake/flake.nix")
938+
func (d *Devbox) flakeDir() string {
939+
return filepath.Join(d.projectDir, ".devbox/gen/flake")
940940
}
941941

942942
// ConfigPackageNames returns the package names as defined in devbox.json

internal/nix/nix.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type Variable struct {
3636
}
3737

3838
type PrintDevEnvArgs struct {
39-
FlakesFilePath string
39+
FlakeDir string
4040
PrintDevEnvCachePath string
4141
UsePrintDevEnvCache bool
4242
}
@@ -65,7 +65,7 @@ func (*Nix) PrintDevEnv(ctx context.Context, args *PrintDevEnvArgs) (*PrintDevEn
6565
cmd := exec.CommandContext(
6666
ctx,
6767
"nix", "print-dev-env",
68-
args.FlakesFilePath,
68+
args.FlakeDir,
6969
)
7070
cmd.Args = append(cmd.Args, ExperimentalFlags()...)
7171
cmd.Args = append(cmd.Args, "--json")

0 commit comments

Comments
 (0)