commit e947c6744c7efa060ec7b2515a75722a82dcd0b9
parent d15a79f60a3fc4d7761c643abc92fa26c9ad979a
Author: figsoda <figsoda@pm.me>
Date: Sat, 1 Apr 2023 10:35:19 -0400
parent d15a79f60a3fc4d7761c643abc92fa26c9ad979a
Author: figsoda <figsoda@pm.me>
Date: Sat, 1 Apr 2023 10:35:19 -0400
loaders: add `path`
6 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md @@ -140,9 +140,15 @@ Default values of optional function arguments will be ignored, e.g. for `{ foo ? "bar" }: foo`, `"bar"` will be ignored, and it requires `inputs` to contain `foo`. For that reason, although not strictly forbidden, optional arguments are discouraged since they are no-ops. +### [`loaders.path`](src/loaders/verbatim.nix) + +Type: `{ ... } -> Path -> Path` + +This loader will simply return the path of the file without `import`ing it. + ### [`loaders.verbatim`](src/loaders/verbatim.nix) -Type: `{ self, super, root, ... } -> Path -> a` +Type: `{ ... } -> Path -> a` This loader will simply `import` the file without providing any input. It is useful when the files being loaded are mostly functions that don't require any external input.
diff --git a/src/loaders/path.nix b/src/loaders/path.nix @@ -0,0 +1,3 @@ +_: + +_: path: path
diff --git a/tests/path/__fixture/foo/bar.nix b/tests/path/__fixture/foo/bar.nix @@ -0,0 +1 @@ +"foo.bar"
diff --git a/tests/path/expected.nix b/tests/path/expected.nix @@ -0,0 +1,4 @@ +{ + foo.bar = ./__fixture/foo/bar.nix; + baz = ./__fixture/baz.nix; +}
diff --git a/tests/path/expr.nix b/tests/path/expr.nix @@ -0,0 +1,6 @@ +{ haumea }: + +haumea.load { + src = ./__fixture; + loader = haumea.loaders.path; +}