aboutsummaryrefslogtreecommitdiff
path: root/src/nix/add-file.md
blob: ed237a035004290790963401229453f7ac4e1c82 (plain)
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
R""(

# Description

Copy the regular file *path* to the Nix store, and print the resulting
store path on standard output.

> **Warning**
>
> The resulting store path is not registered as a garbage
> collector root, so it could be deleted before you have a
> chance to register it.

# Examples

Add a regular file to the store:

```console
# echo foo > bar

# nix store add-file ./bar
/nix/store/cbv2s4bsvzjri77s2gb8g8bpcb6dpa8w-bar

# cat /nix/store/cbv2s4bsvzjri77s2gb8g8bpcb6dpa8w-bar
foo
```

)""