aboutsummaryrefslogtreecommitdiff
path: root/src/nix/add-to-store.md
blob: 593ad67ad9d8d0c15809c038d95e26d81d300676 (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 file or directory *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 add-to-store --flat ./bar
/nix/store/cbv2s4bsvzjri77s2gb8g8bpcb6dpa8w-bar

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

)""