Shell
symlinks
A reference page for the symlinks resource
The symlinks resource reference. This resource manages multiple symbolic links in a single
resource configuration. Unlike the singular symlink resource which
creates one link per resource instance, the symlinks resource allows you to define and
manage multiple links together as an array.
ln -s TARGET PATHParameters:
- symlinks: (array[object], optional) An array of symlink definitions. Each entry
contains:
- path: (string, required) The location where the symlink should be created.
- target: (string, required) The file or directory the symlink should point to.
Example usage:
Managing multiple symlinks in one resource
[
{
"type": "symlinks",
"symlinks": [
{ "path": "~/.vimrc", "target": "~/dotfiles/vimrc" },
{ "path": "~/.zshrc", "target": "~/dotfiles/zshrc" },
{ "path": "~/.gitconfig", "target": "~/dotfiles/gitconfig" }
]
}
]Symlinking config directories and applications
[
{
"type": "symlinks",
"symlinks": [
{ "path": "~/.config/nvim", "target": "~/dotfiles/nvim" },
{ "path": "/Applications/MyApp.app", "target": "~/Applications/MyApp.app" }
]
}
]Comparison: symlinks vs symlink
Use symlinks when:
- You want to manage multiple symlinks in a single resource
- You prefer a more compact configuration for a dotfiles-style setup
- This is the resource
codify import/codify initwill use when discovering existing links
Use symlink when:
- You want fine-grained control over an individual link
- You want to use Codify's resource dependency features for a specific link
- You prefer to distribute link definitions across your configuration
Notes:
- Adding an entry creates that link; removing an entry from the array only removes that
link (the file/directory it pointed to is untouched); changing an entry's
targetre-links it in place. - If a real file or directory (not a symlink) already exists at one of the declared
pathvalues, Codify will raise an error instead of overwriting it. - Missing parent directories of each
pathare created automatically. - Both
symlinkandsymlinksresources can be used in the same configuration without conflicts.