Home Explore Blog CI



nix

doc/manual/source/store/file-system-object.md
23b9cd0c998435a8edd784f9aa838e6abc37f445a02c99f600000003000005df
# File System Object

Nix uses a simplified model of the file system, which consists of file system objects.
Every file system object is one of the following:

 - File

   - A possibly empty sequence of bytes for contents
   - A single boolean representing the [executable](https://en.m.wikipedia.org/wiki/File-system_permissions#Permissions) permission

 - Directory

   Mapping of names to child file system objects

 - [Symbolic link](https://en.m.wikipedia.org/wiki/Symbolic_link)

   An arbitrary string.
   Nix does not assign any semantics to symbolic links.

File system objects and their children form a tree.
A bare file or symlink can be a root file system object.

Nix does not encode any other file system notions such as [hard links](https://en.m.wikipedia.org/wiki/Hard_link), [permissions](https://en.m.wikipedia.org/wiki/File-system_permissions), timestamps, or other metadata.

## Examples of file system objects

A plain file:

```
50 B, executable: false
```

An executable file:

```
122 KB, executable: true
```

A symlink:

```
-> /usr/bin/sh
```

A directory with contents:

```
├── bin
│   └── hello: 35 KB, executable: true
└── share
    ├── info
    │   └── hello.info: 36 KB, executable: false
    └── man
        └── man1
            └── hello.1.gz: 790 B, executable: false
```

A directory that contains a symlink and other directories:

```
├── bin -> share/go/bin
├── nix-support/
└── share/
```

Chunks
9a51fe5d (1st chunk of `doc/manual/source/store/file-system-object.md`)
Title: Nix File System Object Model
Summary
Nix uses a simplified file system model consisting of files (with content and executable permission), directories (mappings of names to child objects), and symbolic links (arbitrary strings). It doesn't encode hard links, timestamps, or other metadata. The objects form a tree structure. The text provides examples of each file system object, including a plain file, an executable file, a symlink, and directories with various contents, including symlinks and other directories.