···11+diff -ruN cloud-init-0.7.6.orig/cloudinit/distros/__init__.py cloud-init-0.7.6/cloudinit/distros/__init__.py
22+--- cloud-init-0.7.6.orig/cloudinit/distros/__init__.py 2014-10-10 15:26:25.000000000 +0000
33++++ cloud-init-0.7.6/cloudinit/distros/__init__.py 2016-06-08 07:51:45.230357099 +0000
44+@@ -43,6 +43,7 @@
55+ 'freebsd': ['freebsd'],
66+ 'suse': ['sles'],
77+ 'arch': ['arch'],
88++ 'nixos': ['nixos'],
99+ }
1010+1111+ LOG = logging.getLogger(__name__)
1212+diff -ruN cloud-init-0.7.6.orig/cloudinit/distros/nixos.py cloud-init-0.7.6/cloudinit/distros/nixos.py
1313+--- cloud-init-0.7.6.orig/cloudinit/distros/nixos.py 1970-01-01 00:00:00.000000000 +0000
1414++++ cloud-init-0.7.6/cloudinit/distros/nixos.py 2016-06-08 07:50:58.602616595 +0000
1515+@@ -0,0 +1,98 @@
1616++# vi: ts=4 expandtab
1717++#
1818++# Copyright (C) 2012 Canonical Ltd.
1919++# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
2020++# Copyright (C) 2012 Yahoo! Inc.
2121++#
2222++# Author: Scott Moser <scott.moser@canonical.com>
2323++# Author: Juerg Haefliger <juerg.haefliger@hp.com>
2424++# Author: Joshua Harlow <harlowja@yahoo-inc.com>
2525++#
2626++# This program is free software: you can redistribute it and/or modify
2727++# it under the terms of the GNU General Public License version 3, as
2828++# published by the Free Software Foundation.
2929++#
3030++# This program is distributed in the hope that it will be useful,
3131++# but WITHOUT ANY WARRANTY; without even the implied warranty of
3232++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3333++# GNU General Public License for more details.
3434++#
3535++# You should have received a copy of the GNU General Public License
3636++# along with this program. If not, see <http://www.gnu.org/licenses/>.
3737++
3838++from cloudinit import distros
3939++from cloudinit import helpers
4040++from cloudinit import log as logging
4141++from cloudinit import util
4242++
4343++from cloudinit.distros.parsers.hostname import HostnameConf
4444++
4545++LOG = logging.getLogger(__name__)
4646++
4747++class Distro(distros.Distro):
4848++
4949++ def __init__(self, name, cfg, paths):
5050++ distros.Distro.__init__(self, name, cfg, paths)
5151++ # This will be used to restrict certain
5252++ # calls from repeatly happening (when they
5353++ # should only happen say once per instance...)
5454++ self._runner = helpers.Runners(paths)
5555++ self.osfamily = 'nixos'
5656++
5757++ def _select_hostname(self, hostname, fqdn):
5858++ # Prefer the short hostname over the long
5959++ # fully qualified domain name
6060++ if not hostname:
6161++ return fqdn
6262++ return hostname
6363++
6464++ def _write_hostname(self, your_hostname, out_fn):
6565++ conf = None
6666++ try:
6767++ # Try to update the previous one
6868++ # so lets see if we can read it first.
6969++ conf = self._read_hostname_conf(out_fn)
7070++ except IOError:
7171++ pass
7272++ if not conf:
7373++ conf = HostnameConf('')
7474++ conf.set_hostname(your_hostname)
7575++ util.write_file(out_fn, str(conf), 0644)
7676++
7777++ def _read_system_hostname(self):
7878++ sys_hostname = self._read_hostname(self.hostname_conf_fn)
7979++ return (self.hostname_conf_fn, sys_hostname)
8080++
8181++ def _read_hostname_conf(self, filename):
8282++ conf = HostnameConf(util.load_file(filename))
8383++ conf.parse()
8484++ return conf
8585++
8686++ def _read_hostname(self, filename, default=None):
8787++ hostname = None
8888++ try:
8989++ conf = self._read_hostname_conf(filename)
9090++ hostname = conf.hostname
9191++ except IOError:
9292++ pass
9393++ if not hostname:
9494++ return default
9595++ return hostname
9696++
9797++ def _write_network(self, settings):
9898++ raise NotImplementedError()
9999++
100100++ def apply_locale(self, locale, out_fn=None):
101101++ raise NotImplementedError()
102102++
103103++ def install_packages(self, pkglist):
104104++ raise NotImplementedError()
105105++
106106++ def package_command(self, command, args=None, pkgs=None):
107107++ raise NotImplementedError()
108108++
109109++ def set_timezone(self, tz):
110110++ raise NotImplementedError()
111111++
112112++ def update_package_sources(self):
113113++ raise NotImplementedError()