1---
2title: Install Vector via Nix
3sidebar_label: Nix
4description: Install Vector through the Nix package manager
5---
6
7<%- package_manager = metadata.installation.package_managers.nix -%>
8<%- downloads = metadata.installation.select_downloads(package_manager: package_manager.name) -%>
9<%- interfaces = fetch_interfaces(package_manager.interfaces) -%>
10<%- strategies = fetch_strategies(package_manager.strategies) -%>
11
12Vector can be installed through the [Nix package manager][urls.nix] via
13[Vector's Nix package][urls.vector_nix_package]. This package manager is
14generally used on [NixOS][urls.nixos].
15
16<Alert type="warning">
17
18Because Vector must be manually updated on Nix, new Vector releases will be
19delayed. Generally new Vector releases are made available within a few days.
20
21</Alert>
22
23## Install
24
25<%= installation_tutorial(interfaces, strategies, heading_depth: 3) %>
26
27## Configuring
28
29The [Vector nix package][urls.vector_nix_package] does not install any
30configuration files by default. You'll need to create a
31[Vector configuration file][docs.configuration] and pass it to Vector via the
32`--config` flag when [starting][docs.process-management#starting] Vector.
33
34## Deploying
35
36How you deploy Vector is largely dependent on your use case and environment.
37Please see the [deployment section][docs.deployment] for more info on how to
38deploy Vector.
39
40## Administering
41
42The Vector nix package does not use Systemd by default, but Vector does provide
43a [Systemd service file][urls.vector_systemd_file] that you can use as a
44starting point. How you manage the Vector process is up to you, and the
45process administration section covers how to do this:
46
47<Jump to="[[[docs.administration]]]">Administration</Jump>
48
49## Uninstalling
50
51```bash
52nix-env --uninstall vector
53```
54
55## Updating
56
57```bash
58nix-env --file https://github.com/NixOS/nixpkgs/archive/master.tar.gz --upgrade vector
59```
60
61## Package
62
63### Architectures
64
65Vector's Nix packages only support the X86_64 architecture.
66
67### Versions
68
69Installing previous versions of Vector through `nix` is possible, but not
70straightforward. For example, installing Vector `0.7.1` can be achieved with
71the following command:
72
73```bash
74nix-env --file https://github.com/NixOS/nixpkgs/archive/20bbe6cba68fb9d37b5d0e373b6180dce2961e0d.tar.gz --install --attr vector
75```
76
77`20bbe6...` represents the commit sha for the `0.7.1` on the
78[nix package repo][urls.vector_nix_package].
79
80#### Listing Versions & Commit SHAs
81
82For situations that required automated retrieval, we've thrown thogether this
83handy Ruby function that will list the Vector versions and their commit sha:
84
85```ruby
86require "net/http"
87require "json"
88
89# Returns a hash mapping Vector versions to commits in `nixpkgs/nixos` repository
90def nix_versions
91  nixpkgs_repo = "nixos/nixpkgs"
92  commits_url = "https://api.github.com/repos/#{nixpkgs_repo}/commits?path=pkgs/tools/misc/vector"
93
94  response = Net::HTTP.get URI(commits_url)
95  items = JSON.parse response
96
97  versions = {}
98  for item in items do
99    match = item["commit"]["message"].match "^vector:.*(\\d+\.\\d+\.\\d+)$"
100    if match
101      version = match[1]
102      versions[version] = item["sha"]
103    end
104  end
105
106  versions
107end
108```
109
110### Source Files
111
112Vector's Nix source files are located in the
113[Nix repo][urls.vector_nix_package].
114