-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathbuiltins.ncl
56 lines (50 loc) · 1.72 KB
/
builtins.ncl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
let derivations = import "derivation.ncl" in
{
import_file
| String -> derivations.NixPath
| doc m%%"
Take a path as a string and produce a Nix path, which will be
interpreted as a path on the Nix side and added to the store.
# Example
```nickel
cmd = s%"
%{inputs.gcc}/bin/gcc %{import_file "hello.c"} -o hello
%{inputs.coreutils}/bin/mkdir -p $out/bin
%{inputs.coreutils}/bin/cp hello $out/bin/hello
"%,
```
"%%
= fun filepath => { path = filepath },
import_nix
| doc m%%"
Import a Nix value from one of the flake inputs.
The value should be passed in a flakeref-like format
`input_name#attribute_path`.
# Example
```nickel
cmd = nix-s%"%{import_nix "nixpkgs#hello"}/bin/hello > $out"%
```
"%%
| derivations.NixInputSugar -> derivations.NixInput
= fun x => x,
placeholder
| doc m%"
Return a placeholder string for the specified output that will be
substituted by the corresponding output path at build time.
Wrapper around the Nix
[placeholder](https://nixos.org/manual/nix/stable/language/builtins.html#builtins-placeholder)
builtin.
"%
| String -> derivations.NixPlaceholder
= fun _output => { output = _output },
to_file
| doc m%"
Store the string s in a file in the Nix store and return its path.
The file has suffix name.
Wrapper around the Nix
[toFile](https://nixos.org/manual/nix/stable/language/builtins.html#builtins-toFile)
builtin.
"%
| String -> derivations.NixString -> derivations.NixToFile
= fun _name _text => { name = _name, text = _text },
}