···109 # not be started by default on the installation CD because the
110 # default root password is empty.
111 services.openssh.enable = true;
112- jobs.openssh.startOn = pkgs.lib.mkOverride 50 "";
113114 # To be able to use the systemTarball to catch troubles.
115 boot.crashDump = {
···109 # not be started by default on the installation CD because the
110 # default root password is empty.
111 services.openssh.enable = true;
112+ jobs.openssh.startOn = lib.mkOverride 50 "";
113114 # To be able to use the systemTarball to catch troubles.
115 boot.crashDump = {
···165 # not be started by default on the installation CD because the
166 # default root password is empty.
167 services.openssh.enable = true;
168- jobs.openssh.startOn = pkgs.lib.mkOverride 50 "";
169170 # cpufrequtils fails to build on non-pc
171 powerManagement.enable = false;
···165 # not be started by default on the installation CD because the
166 # default root password is empty.
167 services.openssh.enable = true;
168+ jobs.openssh.startOn = lib.mkOverride 50 "";
169170 # cpufrequtils fails to build on non-pc
171 powerManagement.enable = false;
···1# This module defines the global list of uids and gids. We keep a
2# central list to prevent id collisions.
34-{ config, pkgs, ... }:
56{
7 options = {
89- ids.uids = pkgs.lib.mkOption {
10 internal = true;
11 description = ''
12 The user IDs used in NixOS.
13 '';
14 };
1516- ids.gids = pkgs.lib.mkOption {
17 internal = true;
18 description = ''
19 The group IDs used in NixOS.
···135 influxdb = 125;
136 nsd = 126;
137 gitolite = 127;
0138139 # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
140···243 teamspeak = 124;
244 influxdb = 125;
245 nsd = 126;
0246247 # When adding a gid, make sure it doesn't match an existing uid. And don't use gids above 399!
248
···1# This module defines the global list of uids and gids. We keep a
2# central list to prevent id collisions.
34+{ config, pkgs, lib, ... }:
56{
7 options = {
89+ ids.uids = lib.mkOption {
10 internal = true;
11 description = ''
12 The user IDs used in NixOS.
13 '';
14 };
1516+ ids.gids = lib.mkOption {
17 internal = true;
18 description = ''
19 The group IDs used in NixOS.
···135 influxdb = 125;
136 nsd = 126;
137 gitolite = 127;
138+ znc = 128;
139140 # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
141···244 teamspeak = 124;
245 influxdb = 125;
246 nsd = 126;
247+ znc = 128;
248249 # When adding a gid, make sure it doesn't match an existing uid. And don't use gids above 399!
250
+3-3
nixos/modules/misc/lib.nix
···1-{ config, pkgs, ... }:
23{
4 options = {
5- lib = pkgs.lib.mkOption {
6 default = {};
78- type = pkgs.lib.types.attrsOf pkgs.lib.types.attrs;
910 description = ''
11 This option allows modules to define helper functions, constants, etc.
···1+{ config, lib, ... }:
23{
4 options = {
5+ lib = lib.mkOption {
6 default = {};
78+ type = lib.types.attrsOf lib.types.attrs;
910 description = ''
11 This option allows modules to define helper functions, constants, etc.
+2-2
nixos/modules/misc/passthru.nix
···1# This module allows you to export something from configuration
2# Use case: export kernel source expression for ease of configuring
34-{ config, pkgs, ... }:
56{
7 options = {
8- passthru = pkgs.lib.mkOption {
9 visible = false;
10 description = ''
11 This attribute set will be exported as a system attribute.
···1# This module allows you to export something from configuration
2# Use case: export kernel source expression for ease of configuring
34+{ config, lib, ... }:
56{
7 options = {
8+ passthru = lib.mkOption {
9 visible = false;
10 description = ''
11 This attribute set will be exported as a system attribute.
···4041 options = {
4243- users.defaultUserShell = pkgs.lib.mkOption {
44 description = ''
45 This option defines the default shell assigned to user
46 accounts. This must not be a store path, since the path is
···60 config = {
6162 environment.systemPackages =
63- pkgs.lib.optional config.users.mutableUsers pkgs.shadow;
6465 environment.etc =
66 [ { # /etc/login.defs: global configuration for pwdutils. You
···4041 options = {
4243+ users.defaultUserShell = lib.mkOption {
44 description = ''
45 This option defines the default shell assigned to user
46 accounts. This must not be a store path, since the path is
···60 config = {
6162 environment.systemPackages =
63+ lib.optional config.users.mutableUsers pkgs.shadow;
6465 environment.etc =
66 [ { # /etc/login.defs: global configuration for pwdutils. You
···85 Defines how users authenticate themselves to the server. By
86 default, "trust" access to local users will always be granted
87 along with any other custom options. If you do not want this,
88- set this option using "pkgs.lib.mkForce" to override this
89 behaviour.
90 '';
91 };
···85 Defines how users authenticate themselves to the server. By
86 default, "trust" access to local users will always be granted
87 along with any other custom options. If you do not want this,
88+ set this option using "lib.mkForce" to override this
89 behaviour.
90 '';
91 };
···1+{ config, lib, pkgs, ...}:
2+3+with lib;
4+5+let
6+ cfg = config.services.znc;
7+8+ defaultUser = "znc"; # Default user to own process.
9+10+ # Default user and pass:
11+ # un=znc
12+ # pw=nixospass
13+14+ defaultUserName = "znc";
15+ defaultPassBlock = "
16+ <Pass password>
17+ Method = sha256
18+ Hash = e2ce303c7ea75c571d80d8540a8699b46535be6a085be3414947d638e48d9e93
19+ Salt = l5Xryew4g*!oa(ECfX2o
20+ </Pass>
21+ ";
22+23+ confOptions = { ... }: {
24+ options = {
25+ modules = mkOption {
26+ type = types.listOf types.string;
27+ default = [ "partyline" "webadmin" "adminlog" "log" ];
28+ example = [ "partyline" "webadmin" "adminlog" "log" ];
29+ description = ''
30+ A list of modules to include in the `znc.conf` file.
31+ '';
32+ };
33+34+ userName = mkOption {
35+ default = defaultUserName;
36+ example = "johntron";
37+ type = types.string;
38+ description = ''
39+ The user name to use when generating the `znc.conf` file.
40+ This is the user name used by the user logging into the ZNC web admin.
41+ '';
42+ };
43+44+ nick = mkOption {
45+ default = "znc-user";
46+ example = "john";
47+ type = types.string;
48+ description = ''
49+ The IRC nick to use when generating the `znc.conf` file.
50+ '';
51+ };
52+53+ passBlock = mkOption {
54+ default = defaultPassBlock;
55+ example = "Must be the block generated by the `znc --makepass` command.";
56+ type = types.string;
57+ description = ''
58+ The pass block to use when generating the `znc.conf` file.
59+ This is the password used by the user logging into the ZNC web admin.
60+ This is the block generated by the `znc --makepass` command.
61+ !!! If not specified, please change this after starting the service. !!!
62+ '';
63+ };
64+65+ port = mkOption {
66+ default = "5000";
67+ example = "5000";
68+ type = types.string;
69+ description = ''
70+ Specifies the port on which to listen.
71+ '';
72+ };
73+74+ useSSL = mkOption {
75+ default = true;
76+ example = true;
77+ type = types.bool;
78+ description = ''
79+ Indicates whether the ZNC server should use SSL when listening on the specified port.
80+ '';
81+ };
82+83+ };
84+ };
85+86+ # Keep znc.conf in nix store, then symlink or copy into `dataDir`, depending on `mutable`.
87+ mkZncConf = confOpts: ''
88+ // Also check http://en.znc.in/wiki/Configuration
89+90+ AnonIPLimit = 10
91+ ConnectDelay = 5
92+ # Add `LoadModule = x` for each module...
93+ ${concatMapStrings (n: "LoadModule = ${n}\n") confOpts.modules}
94+ MaxBufferSize = 500
95+ ProtectWebSessions = true
96+ SSLCertFile = ${cfg.dataDir}/znc.pem
97+ ServerThrottle = 30
98+ Skin = dark-clouds
99+ StatusPrefix = *
100+ Version = 1.2
101+102+ <Listener listener0>
103+ AllowIRC = true
104+ AllowWeb = true
105+ IPv4 = true
106+ IPv6 = false
107+ Port = ${if confOpts.useSSL then "+" else ""}${confOpts.port}
108+ SSL = ${if confOpts.useSSL then "true" else "false"}
109+ </Listener>
110+111+ <User ${confOpts.userName}>
112+ Admin = true
113+ Allow = *
114+ AltNick = ${confOpts.nick}_
115+ AppendTimestamp = false
116+ AutoClearChanBuffer = false
117+ Buffer = 150
118+ ChanModes = +stn
119+ DenyLoadMod = false
120+ DenySetBindHost = false
121+ Ident = ident
122+ JoinTries = 10
123+ MaxJoins = 0
124+ MaxNetworks = 1
125+ MultiClients = true
126+ Nick = ${confOpts.nick}
127+ PrependTimestamp = true
128+ QuitMsg = Quit
129+ RealName = ${confOpts.nick}
130+ TimestampFormat = [%H:%M:%S]
131+132+ ${confOpts.passBlock}
133+ </User>
134+ '';
135+136+ zncConfFile = pkgs.writeTextFile {
137+ name = "znc.conf";
138+ text = if cfg.zncConf != ""
139+ then cfg.zncConf
140+ else mkZncConf cfg.confOptions;
141+ };
142+143+in
144+145+{
146+147+ ###### Interface
148+149+ options = {
150+ services.znc = {
151+ enable = mkOption {
152+ default = false;
153+ example = true;
154+ type = types.bool;
155+ description = ''
156+ Enable a ZNC service for a user.
157+ '';
158+ };
159+160+ user = mkOption {
161+ default = "znc";
162+ example = "john";
163+ type = types.string;
164+ description = ''
165+ The name of an existing user account to use to own the ZNC server process.
166+ If not specified, a default user will be created to own the process.
167+ '';
168+ };
169+170+ dataDir = mkOption {
171+ default = "/home/${cfg.user}/.znc";
172+ example = "/home/john/.znc";
173+ type = types.string;
174+ description = ''
175+ The data directory. Used for configuration files and modules.
176+ '';
177+ };
178+179+ zncConf = mkOption {
180+ default = "";
181+ example = "See: http://wiki.znc.in/Configuration";
182+ type = types.string;
183+ description = ''
184+ The contents of the `znc.conf` file to use when creating it.
185+ If specified, `confOptions` will be ignored, and this value, as-is, will be used.
186+ If left empty, a conf file with default values will be used.
187+ Recommended to generate with `znc --makeconf` command.
188+ '';
189+ };
190+191+ confOptions = mkOption {
192+ default = {};
193+ example = {
194+ modules = [ "log" ];
195+ userName = "john";
196+ nick = "johntron";
197+ };
198+ type = types.optionSet;
199+ description = ''
200+ Values to use when creating a `znc.conf` file.
201+ '';
202+ options = confOptions;
203+ };
204+205+ mutable = mkOption {
206+ default = false;
207+ example = true;
208+ type = types.bool;
209+ description = ''
210+ Indicates whether to allow the contents of the `dataDir` directory to be changed
211+ by the user at run-time.
212+ If true, modifications to the ZNC configuration after its initial creation are not
213+ overwritten by a NixOS system rebuild.
214+ If false, the ZNC configuration is rebuilt by every system rebuild.
215+ If the user wants to manage the ZNC service using the web admin interface, this value
216+ should be set to true.
217+ '';
218+ };
219+220+ extraFlags = mkOption {
221+ default = "";
222+ example = "--debug";
223+ type = types.string;
224+ description = ''
225+ Extra flags to use when executing znc command.
226+ '';
227+ };
228+ };
229+ };
230+231+232+ ###### Implementation
233+234+ config = mkIf cfg.enable {
235+236+ systemd.services."znc-${cfg.user}" = {
237+ description = "ZNC Server of ${cfg.user}.";
238+ wantedBy = [ "multi-user.target" ];
239+ after = [ "network.service" ];
240+ path = [ pkgs.znc ];
241+ serviceConfig = {
242+ User = "${cfg.user}";
243+ Restart = "always";
244+ ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
245+ ExecStop = "${pkgs.coreutils}/bin/kill -INT $MAINPID";
246+ };
247+ preStart = ''
248+ ${pkgs.coreutils}/bin/mkdir -p ${cfg.dataDir}
249+ ${pkgs.coreutils}/bin/chown ${cfg.user} ${cfg.dataDir} -R
250+ ${pkgs.coreutils}/bin/mkdir -p ${cfg.dataDir}/configs
251+252+ # If mutable, regenerate conf file every time.
253+ ${optionalString (!cfg.mutable) ''
254+ ${pkgs.coreutils}/echo "znc-${cfg.user} is set to be system-managed. Now deleting old znc.conf file to be regenerated."
255+ ${pkgs.coreutils}/rm -f ${cfg.dataDir}/configs/znc.conf
256+ ''}
257+258+ # Ensure essential files exist.
259+ if [[ ! -f ${cfg.dataDir}/configs/znc.conf ]]; then
260+ ${pkgs.coreutils}/bin/echo "No znc.conf file found in ${cfg.dataDir}. Creating one now."
261+ ${if (!cfg.mutable)
262+ then "${pkgs.coreutils}/bin/ln --force -s ${zncConfFile} ${cfg.dataDir}/configs/znc.conf"
263+ else ''
264+ ${pkgs.coreutils}/bin/cp --no-clobber ${zncConfFile} ${cfg.dataDir}/configs/znc.conf
265+ ${pkgs.coreutils}/bin/chmod u+rw ${cfg.dataDir}/configs/znc.conf
266+ ${pkgs.coreutils}/bin/chown ${cfg.user} ${cfg.dataDir}/configs/znc.conf
267+ ''}
268+ fi
269+270+ if [[ ! -f ${cfg.dataDir}/znc.pem ]]; then
271+ ${pkgs.coreutils}/bin/echo "No znc.pem file found in ${cfg.dataDir}. Creating one now."
272+ ${pkgs.znc}/bin/znc --makepem
273+ fi
274+ '';
275+ script = "${pkgs.znc}/bin/znc --foreground --datadir ${cfg.dataDir} ${cfg.extraFlags}";
276+ };
277+278+ users.extraUsers = optional (cfg.user == defaultUser)
279+ { name = defaultUser;
280+ description = "ZNC server daemon owner";
281+ group = defaultUser;
282+ uid = config.ids.uids.znc;
283+ createHome = true;
284+ createUser = true;
285+ };
286+287+ users.extraGroups = optional (cfg.user == defaultUser)
288+ { name = defaultUser;
289+ gid = config.ids.gids.znc;
290+ members = [ defaultUser ];
291+ };
292+293+ };
294+}
···1-{ config, pkgs, serverInfo, ... }:
23let
4- extraWorkersProperties = pkgs.lib.optionalString (config ? extraWorkersProperties) config.extraWorkersProperties;
56 workersProperties = pkgs.writeText "workers.properties" ''
7# Define list of workers that will be used
···1+{ config, pkgs, serverInfo, lib, ... }:
23let
4+ extraWorkersProperties = lib.optionalString (config ? extraWorkersProperties) config.extraWorkersProperties;
56 workersProperties = pkgs.writeText "workers.properties" ''
7# Define list of workers that will be used
···1+{ stdenv, fetchhg, autoconf, sqlite }:
2+3+stdenv.mkDerivation {
4+ name = "vcprompt";
5+6+ src = fetchhg {
7+ url = "http://hg.gerg.ca/vcprompt/";
8+ rev = "1.2.1";
9+ sha256 = "03xqvp6bfl98bpacrw4n82qv9cw6a4fxci802s3vrygas989v1kj";
10+ };
11+12+ buildInputs = [ sqlite autoconf ];
13+14+ preConfigure = ''
15+ autoconf
16+ makeFlags="$makeFlags PREFIX=$out"
17+ '';
18+19+ meta = with stdenv.lib; {
20+ description = ''
21+ A little C program that prints a short string with barebones information
22+ about the current working directory for various version control systems
23+ '';
24+ homepage = http://hg.gerg.ca/vcprompt;
25+ maintainers = with maintainers; [ cstrahan ];
26+ platforms = with platforms; linux ++ darwin;
27+ };
28+}
···1+http://code.google.com/p/go/source/detail?r=8b13b2ec6b18
2+--- a/src/cmd/cgo/gcc.go 2014-07-02 12:00:12.171796197 +0200
3++++ b/src/cmd/cgo/gcc.go 2014-07-02 12:01:57.844472754 +0200
4+@@ -840,6 +840,15 @@
5+ func (p *Package) gccErrors(stdin []byte) string {
6+ // TODO(rsc): require failure
7+ args := p.gccCmd()
8++
9++ // GCC 4.8.0 has a bug: it sometimes does not apply
10++ // -Wunused-value to values that are macros defined in system
11++ // headers. See issue 5118. Adding -Wsystem-headers avoids
12++ // that problem. This will produce additional errors, but it
13++ // doesn't matter because we will ignore all errors that are
14++ // not marked for the cgo-test file.
15++ args = append(args, "-Wsystem-headers")
16++
17+ if *debugGcc {
18+ fmt.Fprintf(os.Stderr, "$ %s <<EOF\n", strings.Join(args, " "))
19+ os.Stderr.Write(stdin)
···35 longDescription = ''
36 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.
37 '';
00038 };
39}
···35 longDescription = ''
36 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.
37 '';
38+ inherit version;
39+ downloadPage = http://atoptool.nl/downloadatop.php;
40+ updateWalker = true;
41 };
42}
···1+Fix a segfault in handle_interface: if we're adding an interface that
2+we already knew about (in particular due to a udev event), then
3+calling init_state/start_interface on ifp is bad because we later free
4+ifp. This leads to messages like:
5+6+ dhcpcd[1342]: eth0: IAID conflicts with one assigned to eth0
7+8+and then a crash:
9+10+ Invalid read of size 8
11+ at 0x41CD07: dhcp_handlepacket (dhcp.c:2555)
12+ by 0x408A74: eloop_start (eloop.c:399)
13+ by 0x4073B6: main (dhcpcd.c:1537)
14+15+ Address 0x54573d8 is 200 bytes inside a block of size 232 free'd
16+ at 0x4C27507: free (in /nix/store/jafbjc2y6izmh3sk78fl65n55jll4mj8-valgrind-3.9.0/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
17+ by 0x40F0A8: free_interface (net.c:153)
18+ by 0x405443: handle_interface (dhcpcd.c:764) by 0x57E0F06: ??? (udev.c:97)
19+ by 0x42EB62: dev_handle_data (dev.c:153)
20+ by 0x408A74: eloop_start (eloop.c:399)
21+ by 0x4073B6: main (dhcpcd.c:1537)
22+23+So ignore interfaces that we already know about.
24+25+diff -ru -x '*~' dhcpcd-6.4.0-orig/dhcpcd.c dhcpcd-6.4.0/dhcpcd.c
26+--- dhcpcd-6.4.0-orig/dhcpcd.c 2014-06-14 22:13:12.000000000 +0200
27++++ dhcpcd-6.4.0/dhcpcd.c 2014-07-03 11:13:39.133186533 +0200
28+@@ -774,11 +774,11 @@
29 } else {
30 TAILQ_REMOVE(ifs, ifp, next);
31 TAILQ_INSERT_TAIL(ctx->ifaces, ifp, next);
32- }
33+- if (action > 0) {
34- init_state(ifp, ctx->argc, ctx->argv);
35+- run_preinit(ifp);
36+- dhcpcd_startinterface(ifp);
37++ if (action > 0) {
38+ init_state(ifp, ctx->argc, ctx->argv);
39++ run_preinit(ifp);
40++ dhcpcd_startinterface(ifp);
41+ }
42 }
43 }
44000
···1+Fix segfault when reloading the configuration: free_globals() left the
2+ifac/ifdc variables at -1 instead of 0, causing a crash later in
3+splitv().
4+5--- a/dhcpcd.c
6+++ b/dhcpcd.c
7@@ -143,16 +143,18 @@