Skip to content

Commit e37d0d8

Browse files
committed
fix: only show flake and dir warning when relevant
Forgetting to set `src` was triggering it. Ideally we'd just change the function to use `{ src, ... }@Args:` so Nix can provide an explicit error the users are accustomed to.
1 parent c6e72ba commit e37d0d8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

nix/load.nix

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,14 @@ args:
3030

3131
let
3232
src = toString (
33-
args.src or (warn
34-
"namaka.load: `flake` and `dir` have been deprecated, use `src` directly instead"
35-
(args.flake + "/${args.dir or "tests"}"))
33+
if args ? src then
34+
args.src
35+
else if args ? flake then
36+
warn
37+
"namaka.load: `flake` and `dir` have been deprecated, use `src` directly instead"
38+
(args.flake + "/${args.dir or "tests"}")
39+
else
40+
throw "namaka.load: missing mandatory `src' argument"
3641
);
3742

3843
tests = haumea.load (removeAttrs args [ "flake" "dir" ] // {

0 commit comments

Comments
 (0)