···109109 # not be started by default on the installation CD because the
110110 # default root password is empty.
111111 services.openssh.enable = true;
112112- jobs.openssh.startOn = pkgs.lib.mkOverride 50 "";
112112+ jobs.openssh.startOn = lib.mkOverride 50 "";
113113114114 # To be able to use the systemTarball to catch troubles.
115115 boot.crashDump = {
···165165 # not be started by default on the installation CD because the
166166 # default root password is empty.
167167 services.openssh.enable = true;
168168- jobs.openssh.startOn = pkgs.lib.mkOverride 50 "";
168168+ jobs.openssh.startOn = lib.mkOverride 50 "";
169169170170 # cpufrequtils fails to build on non-pc
171171 powerManagement.enable = false;
···11# This module defines the global list of uids and gids. We keep a
22# central list to prevent id collisions.
3344-{ config, pkgs, ... }:
44+{ config, pkgs, lib, ... }:
5566{
77 options = {
8899- ids.uids = pkgs.lib.mkOption {
99+ ids.uids = lib.mkOption {
1010 internal = true;
1111 description = ''
1212 The user IDs used in NixOS.
1313 '';
1414 };
15151616- ids.gids = pkgs.lib.mkOption {
1616+ ids.gids = lib.mkOption {
1717 internal = true;
1818 description = ''
1919 The group IDs used in NixOS.
···135135 influxdb = 125;
136136 nsd = 126;
137137 gitolite = 127;
138138+ znc = 128;
138139139140 # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
140141···243244 teamspeak = 124;
244245 influxdb = 125;
245246 nsd = 126;
247247+ znc = 128;
246248247249 # When adding a gid, make sure it doesn't match an existing uid. And don't use gids above 399!
248250
···11# This module allows you to export something from configuration
22# Use case: export kernel source expression for ease of configuring
3344-{ config, pkgs, ... }:
44+{ config, lib, ... }:
5566{
77 options = {
88- passthru = pkgs.lib.mkOption {
88+ passthru = lib.mkOption {
99 visible = false;
1010 description = ''
1111 This attribute set will be exported as a system attribute.
···40404141 options = {
42424343- users.defaultUserShell = pkgs.lib.mkOption {
4343+ users.defaultUserShell = lib.mkOption {
4444 description = ''
4545 This option defines the default shell assigned to user
4646 accounts. This must not be a store path, since the path is
···6060 config = {
61616262 environment.systemPackages =
6363- pkgs.lib.optional config.users.mutableUsers pkgs.shadow;
6363+ lib.optional config.users.mutableUsers pkgs.shadow;
64646565 environment.etc =
6666 [ { # /etc/login.defs: global configuration for pwdutils. You
···8585 Defines how users authenticate themselves to the server. By
8686 default, "trust" access to local users will always be granted
8787 along with any other custom options. If you do not want this,
8888- set this option using "pkgs.lib.mkForce" to override this
8888+ set this option using "lib.mkForce" to override this
8989 behaviour.
9090 '';
9191 };
···11+{ config, lib, pkgs, ...}:
22+33+with lib;
44+55+let
66+ cfg = config.services.znc;
77+88+ defaultUser = "znc"; # Default user to own process.
99+1010+ # Default user and pass:
1111+ # un=znc
1212+ # pw=nixospass
1313+1414+ defaultUserName = "znc";
1515+ defaultPassBlock = "
1616+ <Pass password>
1717+ Method = sha256
1818+ Hash = e2ce303c7ea75c571d80d8540a8699b46535be6a085be3414947d638e48d9e93
1919+ Salt = l5Xryew4g*!oa(ECfX2o
2020+ </Pass>
2121+ ";
2222+2323+ confOptions = { ... }: {
2424+ options = {
2525+ modules = mkOption {
2626+ type = types.listOf types.string;
2727+ default = [ "partyline" "webadmin" "adminlog" "log" ];
2828+ example = [ "partyline" "webadmin" "adminlog" "log" ];
2929+ description = ''
3030+ A list of modules to include in the `znc.conf` file.
3131+ '';
3232+ };
3333+3434+ userName = mkOption {
3535+ default = defaultUserName;
3636+ example = "johntron";
3737+ type = types.string;
3838+ description = ''
3939+ The user name to use when generating the `znc.conf` file.
4040+ This is the user name used by the user logging into the ZNC web admin.
4141+ '';
4242+ };
4343+4444+ nick = mkOption {
4545+ default = "znc-user";
4646+ example = "john";
4747+ type = types.string;
4848+ description = ''
4949+ The IRC nick to use when generating the `znc.conf` file.
5050+ '';
5151+ };
5252+5353+ passBlock = mkOption {
5454+ default = defaultPassBlock;
5555+ example = "Must be the block generated by the `znc --makepass` command.";
5656+ type = types.string;
5757+ description = ''
5858+ The pass block to use when generating the `znc.conf` file.
5959+ This is the password used by the user logging into the ZNC web admin.
6060+ This is the block generated by the `znc --makepass` command.
6161+ !!! If not specified, please change this after starting the service. !!!
6262+ '';
6363+ };
6464+6565+ port = mkOption {
6666+ default = "5000";
6767+ example = "5000";
6868+ type = types.string;
6969+ description = ''
7070+ Specifies the port on which to listen.
7171+ '';
7272+ };
7373+7474+ useSSL = mkOption {
7575+ default = true;
7676+ example = true;
7777+ type = types.bool;
7878+ description = ''
7979+ Indicates whether the ZNC server should use SSL when listening on the specified port.
8080+ '';
8181+ };
8282+8383+ };
8484+ };
8585+8686+ # Keep znc.conf in nix store, then symlink or copy into `dataDir`, depending on `mutable`.
8787+ mkZncConf = confOpts: ''
8888+ // Also check http://en.znc.in/wiki/Configuration
8989+9090+ AnonIPLimit = 10
9191+ ConnectDelay = 5
9292+ # Add `LoadModule = x` for each module...
9393+ ${concatMapStrings (n: "LoadModule = ${n}\n") confOpts.modules}
9494+ MaxBufferSize = 500
9595+ ProtectWebSessions = true
9696+ SSLCertFile = ${cfg.dataDir}/znc.pem
9797+ ServerThrottle = 30
9898+ Skin = dark-clouds
9999+ StatusPrefix = *
100100+ Version = 1.2
101101+102102+ <Listener listener0>
103103+ AllowIRC = true
104104+ AllowWeb = true
105105+ IPv4 = true
106106+ IPv6 = false
107107+ Port = ${if confOpts.useSSL then "+" else ""}${confOpts.port}
108108+ SSL = ${if confOpts.useSSL then "true" else "false"}
109109+ </Listener>
110110+111111+ <User ${confOpts.userName}>
112112+ Admin = true
113113+ Allow = *
114114+ AltNick = ${confOpts.nick}_
115115+ AppendTimestamp = false
116116+ AutoClearChanBuffer = false
117117+ Buffer = 150
118118+ ChanModes = +stn
119119+ DenyLoadMod = false
120120+ DenySetBindHost = false
121121+ Ident = ident
122122+ JoinTries = 10
123123+ MaxJoins = 0
124124+ MaxNetworks = 1
125125+ MultiClients = true
126126+ Nick = ${confOpts.nick}
127127+ PrependTimestamp = true
128128+ QuitMsg = Quit
129129+ RealName = ${confOpts.nick}
130130+ TimestampFormat = [%H:%M:%S]
131131+132132+ ${confOpts.passBlock}
133133+ </User>
134134+ '';
135135+136136+ zncConfFile = pkgs.writeTextFile {
137137+ name = "znc.conf";
138138+ text = if cfg.zncConf != ""
139139+ then cfg.zncConf
140140+ else mkZncConf cfg.confOptions;
141141+ };
142142+143143+in
144144+145145+{
146146+147147+ ###### Interface
148148+149149+ options = {
150150+ services.znc = {
151151+ enable = mkOption {
152152+ default = false;
153153+ example = true;
154154+ type = types.bool;
155155+ description = ''
156156+ Enable a ZNC service for a user.
157157+ '';
158158+ };
159159+160160+ user = mkOption {
161161+ default = "znc";
162162+ example = "john";
163163+ type = types.string;
164164+ description = ''
165165+ The name of an existing user account to use to own the ZNC server process.
166166+ If not specified, a default user will be created to own the process.
167167+ '';
168168+ };
169169+170170+ dataDir = mkOption {
171171+ default = "/home/${cfg.user}/.znc";
172172+ example = "/home/john/.znc";
173173+ type = types.string;
174174+ description = ''
175175+ The data directory. Used for configuration files and modules.
176176+ '';
177177+ };
178178+179179+ zncConf = mkOption {
180180+ default = "";
181181+ example = "See: http://wiki.znc.in/Configuration";
182182+ type = types.string;
183183+ description = ''
184184+ The contents of the `znc.conf` file to use when creating it.
185185+ If specified, `confOptions` will be ignored, and this value, as-is, will be used.
186186+ If left empty, a conf file with default values will be used.
187187+ Recommended to generate with `znc --makeconf` command.
188188+ '';
189189+ };
190190+191191+ confOptions = mkOption {
192192+ default = {};
193193+ example = {
194194+ modules = [ "log" ];
195195+ userName = "john";
196196+ nick = "johntron";
197197+ };
198198+ type = types.optionSet;
199199+ description = ''
200200+ Values to use when creating a `znc.conf` file.
201201+ '';
202202+ options = confOptions;
203203+ };
204204+205205+ mutable = mkOption {
206206+ default = false;
207207+ example = true;
208208+ type = types.bool;
209209+ description = ''
210210+ Indicates whether to allow the contents of the `dataDir` directory to be changed
211211+ by the user at run-time.
212212+ If true, modifications to the ZNC configuration after its initial creation are not
213213+ overwritten by a NixOS system rebuild.
214214+ If false, the ZNC configuration is rebuilt by every system rebuild.
215215+ If the user wants to manage the ZNC service using the web admin interface, this value
216216+ should be set to true.
217217+ '';
218218+ };
219219+220220+ extraFlags = mkOption {
221221+ default = "";
222222+ example = "--debug";
223223+ type = types.string;
224224+ description = ''
225225+ Extra flags to use when executing znc command.
226226+ '';
227227+ };
228228+ };
229229+ };
230230+231231+232232+ ###### Implementation
233233+234234+ config = mkIf cfg.enable {
235235+236236+ systemd.services."znc-${cfg.user}" = {
237237+ description = "ZNC Server of ${cfg.user}.";
238238+ wantedBy = [ "multi-user.target" ];
239239+ after = [ "network.service" ];
240240+ path = [ pkgs.znc ];
241241+ serviceConfig = {
242242+ User = "${cfg.user}";
243243+ Restart = "always";
244244+ ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
245245+ ExecStop = "${pkgs.coreutils}/bin/kill -INT $MAINPID";
246246+ };
247247+ preStart = ''
248248+ ${pkgs.coreutils}/bin/mkdir -p ${cfg.dataDir}
249249+ ${pkgs.coreutils}/bin/chown ${cfg.user} ${cfg.dataDir} -R
250250+ ${pkgs.coreutils}/bin/mkdir -p ${cfg.dataDir}/configs
251251+252252+ # If mutable, regenerate conf file every time.
253253+ ${optionalString (!cfg.mutable) ''
254254+ ${pkgs.coreutils}/echo "znc-${cfg.user} is set to be system-managed. Now deleting old znc.conf file to be regenerated."
255255+ ${pkgs.coreutils}/rm -f ${cfg.dataDir}/configs/znc.conf
256256+ ''}
257257+258258+ # Ensure essential files exist.
259259+ if [[ ! -f ${cfg.dataDir}/configs/znc.conf ]]; then
260260+ ${pkgs.coreutils}/bin/echo "No znc.conf file found in ${cfg.dataDir}. Creating one now."
261261+ ${if (!cfg.mutable)
262262+ then "${pkgs.coreutils}/bin/ln --force -s ${zncConfFile} ${cfg.dataDir}/configs/znc.conf"
263263+ else ''
264264+ ${pkgs.coreutils}/bin/cp --no-clobber ${zncConfFile} ${cfg.dataDir}/configs/znc.conf
265265+ ${pkgs.coreutils}/bin/chmod u+rw ${cfg.dataDir}/configs/znc.conf
266266+ ${pkgs.coreutils}/bin/chown ${cfg.user} ${cfg.dataDir}/configs/znc.conf
267267+ ''}
268268+ fi
269269+270270+ if [[ ! -f ${cfg.dataDir}/znc.pem ]]; then
271271+ ${pkgs.coreutils}/bin/echo "No znc.pem file found in ${cfg.dataDir}. Creating one now."
272272+ ${pkgs.znc}/bin/znc --makepem
273273+ fi
274274+ '';
275275+ script = "${pkgs.znc}/bin/znc --foreground --datadir ${cfg.dataDir} ${cfg.extraFlags}";
276276+ };
277277+278278+ users.extraUsers = optional (cfg.user == defaultUser)
279279+ { name = defaultUser;
280280+ description = "ZNC server daemon owner";
281281+ group = defaultUser;
282282+ uid = config.ids.uids.znc;
283283+ createHome = true;
284284+ createUser = true;
285285+ };
286286+287287+ users.extraGroups = optional (cfg.user == defaultUser)
288288+ { name = defaultUser;
289289+ gid = config.ids.gids.znc;
290290+ members = [ defaultUser ];
291291+ };
292292+293293+ };
294294+}
···11+{ stdenv, fetchhg, autoconf, sqlite }:
22+33+stdenv.mkDerivation {
44+ name = "vcprompt";
55+66+ src = fetchhg {
77+ url = "http://hg.gerg.ca/vcprompt/";
88+ rev = "1.2.1";
99+ sha256 = "03xqvp6bfl98bpacrw4n82qv9cw6a4fxci802s3vrygas989v1kj";
1010+ };
1111+1212+ buildInputs = [ sqlite autoconf ];
1313+1414+ preConfigure = ''
1515+ autoconf
1616+ makeFlags="$makeFlags PREFIX=$out"
1717+ '';
1818+1919+ meta = with stdenv.lib; {
2020+ description = ''
2121+ A little C program that prints a short string with barebones information
2222+ about the current working directory for various version control systems
2323+ '';
2424+ homepage = http://hg.gerg.ca/vcprompt;
2525+ maintainers = with maintainers; [ cstrahan ];
2626+ platforms = with platforms; linux ++ darwin;
2727+ };
2828+}
···11+http://code.google.com/p/go/source/detail?r=8b13b2ec6b18
22+--- a/src/cmd/cgo/gcc.go 2014-07-02 12:00:12.171796197 +0200
33++++ b/src/cmd/cgo/gcc.go 2014-07-02 12:01:57.844472754 +0200
44+@@ -840,6 +840,15 @@
55+ func (p *Package) gccErrors(stdin []byte) string {
66+ // TODO(rsc): require failure
77+ args := p.gccCmd()
88++
99++ // GCC 4.8.0 has a bug: it sometimes does not apply
1010++ // -Wunused-value to values that are macros defined in system
1111++ // headers. See issue 5118. Adding -Wsystem-headers avoids
1212++ // that problem. This will produce additional errors, but it
1313++ // doesn't matter because we will ignore all errors that are
1414++ // not marked for the cgo-test file.
1515++ args = append(args, "-Wsystem-headers")
1616++
1717+ if *debugGcc {
1818+ fmt.Fprintf(os.Stderr, "$ %s <<EOF\n", strings.Join(args, " "))
1919+ os.Stderr.Write(stdin)
···3535 longDescription = ''
3636 Atop is an ASCII full-screen performance monitor that is capable of reporting the activity of all processes (even if processes have finished during the interval), daily logging of system and process activity for long-term analysis, highlighting overloaded system resources by using colors, etc. At regular intervals, it shows system-level activity related to the CPU, memory, swap, disks and network layers, and for every active process it shows the CPU utilization, memory growth, disk utilization, priority, username, state, and exit code.
3737 '';
3838+ inherit version;
3939+ downloadPage = http://atoptool.nl/downloadatop.php;
4040+ updateWalker = true;
3841 };
3942}
···11-Index: dhcpcd.c
22-==================================================================
33---- a/dhcpcd.c
44-+++ b/dhcpcd.c
55-@@ -747,14 +747,14 @@
66- if (ifp->hwlen != 0)
77- memcpy(ifl->hwaddr, ifp->hwaddr, ifl->hwlen);
11+Fix a segfault in handle_interface: if we're adding an interface that
22+we already knew about (in particular due to a udev event), then
33+calling init_state/start_interface on ifp is bad because we later free
44+ifp. This leads to messages like:
55+66+ dhcpcd[1342]: eth0: IAID conflicts with one assigned to eth0
77+88+and then a crash:
99+1010+ Invalid read of size 8
1111+ at 0x41CD07: dhcp_handlepacket (dhcp.c:2555)
1212+ by 0x408A74: eloop_start (eloop.c:399)
1313+ by 0x4073B6: main (dhcpcd.c:1537)
1414+1515+ Address 0x54573d8 is 200 bytes inside a block of size 232 free'd
1616+ at 0x4C27507: free (in /nix/store/jafbjc2y6izmh3sk78fl65n55jll4mj8-valgrind-3.9.0/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
1717+ by 0x40F0A8: free_interface (net.c:153)
1818+ by 0x405443: handle_interface (dhcpcd.c:764) by 0x57E0F06: ??? (udev.c:97)
1919+ by 0x42EB62: dev_handle_data (dev.c:153)
2020+ by 0x408A74: eloop_start (eloop.c:399)
2121+ by 0x4073B6: main (dhcpcd.c:1537)
2222+2323+So ignore interfaces that we already know about.
2424+2525+diff -ru -x '*~' dhcpcd-6.4.0-orig/dhcpcd.c dhcpcd-6.4.0/dhcpcd.c
2626+--- dhcpcd-6.4.0-orig/dhcpcd.c 2014-06-14 22:13:12.000000000 +0200
2727++++ dhcpcd-6.4.0/dhcpcd.c 2014-07-03 11:13:39.133186533 +0200
2828+@@ -774,11 +774,11 @@
829 } else {
930 TAILQ_REMOVE(ifs, ifp, next);
1031 TAILQ_INSERT_TAIL(ctx->ifaces, ifp, next);
1132- }
1212-- if (action == 1) {
3333+- if (action > 0) {
1334- init_state(ifp, ctx->argc, ctx->argv);
1414-- start_interface(ifp);
1515-+ if (action == 1) {
3535+- run_preinit(ifp);
3636+- dhcpcd_startinterface(ifp);
3737++ if (action > 0) {
1638+ init_state(ifp, ctx->argc, ctx->argv);
1717-+ start_interface(ifp);
3939++ run_preinit(ifp);
4040++ dhcpcd_startinterface(ifp);
1841+ }
1942 }
2043 }
21442222- /* Free our discovered list */
2323- while ((ifp = TAILQ_FIRST(ifs))) {
2424-
···11+Fix segfault when reloading the configuration: free_globals() left the
22+ifac/ifdc variables at -1 instead of 0, causing a crash later in
33+splitv().
44+15--- a/dhcpcd.c
26+++ b/dhcpcd.c
37@@ -143,16 +143,18 @@