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