1diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
2index 79e26235..bdc32c52 100644
3--- a/cloudinit/distros/__init__.py
4+++ b/cloudinit/distros/__init__.py
5@@ -91,6 +91,7 @@ OSFAMILIES = {
6 ],
7 "openeuler": ["openeuler"],
8 "OpenCloudOS": ["OpenCloudOS", "TencentOS"],
9+ "nixos": ["nixos"],
10 }
11
12 LOG = logging.getLogger(__name__)
13diff --git a/cloudinit/distros/nixos.py b/cloudinit/distros/nixos.py
14new file mode 100644
15index 00000000..67c049b8
16--- /dev/null
17+++ b/cloudinit/distros/nixos.py
18@@ -0,0 +1,109 @@
19+# vi: ts=4 expandtab
20+#
21+# Copyright (C) 2012 Canonical Ltd.
22+# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
23+# Copyright (C) 2012 Yahoo! Inc.
24+#
25+# Author: Scott Moser <scott.moser@canonical.com>
26+# Author: Juerg Haefliger <juerg.haefliger@hp.com>
27+# Author: Joshua Harlow <harlowja@yahoo-inc.com>
28+#
29+# This program is free software: you can redistribute it and/or modify
30+# it under the terms of the GNU General Public License version 3, as
31+# published by the Free Software Foundation.
32+#
33+# This program is distributed in the hope that it will be useful,
34+# but WITHOUT ANY WARRANTY; without even the implied warranty of
35+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36+# GNU General Public License for more details.
37+#
38+# You should have received a copy of the GNU General Public License
39+# along with this program. If not, see <http://www.gnu.org/licenses/>.
40+
41+import logging
42+import os
43+
44+from cloudinit import distros
45+from cloudinit import helpers
46+from cloudinit import util
47+from cloudinit import atomic_helper
48+
49+from cloudinit.distros.parsers.hostname import HostnameConf
50+from cloudinit.net import dhcp
51+
52+LOG = logging.getLogger(__name__)
53+
54+class Distro(distros.Distro):
55+
56+ def __init__(self, name, cfg, paths):
57+ distros.Distro.__init__(self, name, cfg, paths)
58+ # This will be used to restrict certain
59+ # calls from repeatly happening (when they
60+ # should only happen say once per instance...)
61+ self._runner = helpers.Runners(paths)
62+ self.usr_lib_exec = os.path.join(os.path.dirname(__file__),
63+ "../../../../../libexec")
64+ self.osfamily = 'nixos'
65+ self.dhcp_client_priority = [
66+ dhcp.Udhcpc,
67+ dhcp.IscDhclient,
68+ dhcp.Dhcpcd,
69+ ]
70+
71+ def _select_hostname(self, hostname, fqdn):
72+ # Prefer the short hostname over the long
73+ # fully qualified domain name
74+ if not hostname:
75+ return fqdn
76+ return hostname
77+
78+ def _write_hostname(self, your_hostname, out_fn):
79+ conf = None
80+ try:
81+ # Try to update the previous one
82+ # so lets see if we can read it first.
83+ conf = self._read_hostname_conf(out_fn)
84+ except IOError:
85+ pass
86+ if not conf:
87+ conf = HostnameConf('')
88+ conf.set_hostname(your_hostname)
89+ atomic_helper.write_file(out_fn, str(conf).encode("utf-8"))
90+
91+ def _read_system_hostname(self):
92+ sys_hostname = self._read_hostname(self.hostname_conf_fn)
93+ return (self.hostname_conf_fn, sys_hostname)
94+
95+ def _read_hostname_conf(self, filename):
96+ conf = HostnameConf(util.load_text_file(filename))
97+ conf.parse()
98+ return conf
99+
100+ def _read_hostname(self, filename, default=None):
101+ hostname = None
102+ try:
103+ conf = self._read_hostname_conf(filename)
104+ hostname = conf.hostname
105+ except IOError:
106+ pass
107+ if not hostname:
108+ return default
109+ return hostname
110+
111+ def _write_network(self, settings):
112+ raise NotImplementedError()
113+
114+ def apply_locale(self, locale, out_fn=None):
115+ raise NotImplementedError()
116+
117+ def install_packages(self, pkglist):
118+ raise NotImplementedError()
119+
120+ def package_command(self, command, args=None, pkgs=None):
121+ pass
122+
123+ def set_timezone(self, tz):
124+ pass
125+
126+ def update_package_sources(self):
127+ pass