From 4b3a76f3fce92ba018372f0446d88387b5962259 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 7 Jun 2010 13:54:15 +0000 Subject: [PATCH 01/12] * Fix coverage analysis of the kernel. svn path=/nixos/trunk/; revision=22168 --- tests/subversion.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/subversion.nix b/tests/subversion.nix index 5354a40452b..d43e369b437 100644 --- a/tests/subversion.nix +++ b/tests/subversion.nix @@ -19,7 +19,7 @@ let # To build the kernel with coverage instrumentation, we need a # special patch to make coverage data available under /proc. - kernel = pkgs.kernel.override (orig: { + linux = pkgs.linux.override (orig: { stdenv = cleanupBuildTree (keepBuildTree orig.stdenv); extraConfig = '' From 9e275ffa58c1c1c88a995c0bf1c098b1f06f605f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Mon, 7 Jun 2010 21:09:27 +0000 Subject: [PATCH 02/12] Trying to improve the cups expression a bit, so it can print also with local usb printers. (Thank you Oleksandr) svn path=/nixos/trunk/; revision=22173 --- modules/services/printing/cupsd.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/services/printing/cupsd.nix b/modules/services/printing/cupsd.nix index 40760ec8af5..39ca4f68325 100644 --- a/modules/services/printing/cupsd.nix +++ b/modules/services/printing/cupsd.nix @@ -106,6 +106,11 @@ in services.dbus.packages = [cups]; + # cups uses libusb to talk to printers, and does not use the + # linux kernel driver. If the driver is not in a black list, it + # gets loaded, and then cups cannot access the printers. + boot.blacklistedKernelModules = [ "usblp" ]; + environment.etc = [ # CUPS expects the following files in its ServerRoot. { source = "${cups}/etc/cups/mime.convs"; @@ -122,15 +127,17 @@ in startOn = "started network-interfaces"; stopOn = "stopping network-interfaces"; + environment = { + # Cups scripts for printing (psto...) require awk, sed, grep, ... + PATH = config.system.path; + }; + preStart = '' mkdir -m 0755 -p ${logDir} mkdir -m 0700 -p /var/cache/cups mkdir -m 0700 -p /var/spool/cups mkdir -m 0755 -p ${cfg.tempDir} - - # Make USB printers show up. - ${modprobe}/sbin/modprobe usblp || true ''; exec = "${cups}/sbin/cupsd -c ${pkgs.writeText "cupsd.conf" cfg.cupsdConf} -F"; From dadd6d63e760ef5e3cbb57c3f9fbd5ea01f22024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Mon, 7 Jun 2010 21:44:06 +0000 Subject: [PATCH 03/12] oops. Fixing the cupsd path. How to set a single path there in the job? I don't know. svn path=/nixos/trunk/; revision=22174 --- modules/services/printing/cupsd.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/services/printing/cupsd.nix b/modules/services/printing/cupsd.nix index 39ca4f68325..0ac52fe1038 100644 --- a/modules/services/printing/cupsd.nix +++ b/modules/services/printing/cupsd.nix @@ -129,7 +129,7 @@ in environment = { # Cups scripts for printing (psto...) require awk, sed, grep, ... - PATH = config.system.path; + PATH = "${config.system.path}/bin"; }; preStart = From b25771532af934ea18589f237cfa57da2430fea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Fri, 11 Jun 2010 21:44:06 +0000 Subject: [PATCH 04/12] Fixing the postfix start/stop (through an upstart job script code that will monitor the life of postfix) Adding an assert to upstart jobs, so those with preStop will always need an exec or script, otherwise the preStop will not be run. svn path=/nixos/trunk/; revision=22225 --- modules/services/mail/postfix.nix | 10 +++++++++- modules/system/upstart/upstart.nix | 7 +++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/modules/services/mail/postfix.nix b/modules/services/mail/postfix.nix index 939260632c9..03c77885d06 100644 --- a/modules/services/mail/postfix.nix +++ b/modules/services/mail/postfix.nix @@ -287,7 +287,15 @@ in daemonType = "none"; - respawn = false; + respawn = true; + + script = '' + while ${pkgs.procps}/bin/ps `${pkgs.coreutils}/bin/cat /var/postfix/queue/pid/master.pid` | + grep -q postfix + do + ${pkgs.coreutils}/bin/sleep 1m + done + ''; preStart = '' diff --git a/modules/system/upstart/upstart.nix b/modules/system/upstart/upstart.nix index 3110f376eec..cb3975e694c 100644 --- a/modules/system/upstart/upstart.nix +++ b/modules/system/upstart/upstart.nix @@ -21,6 +21,7 @@ let makeJob = job: let + hasMain = job.script != "" || job.exec != ""; jobText = let log = "/var/log/upstart/${job.name}"; in @@ -77,12 +78,14 @@ let ${optionalString job.task "task"} ${optionalString (!job.task && job.respawn) "respawn"} - ${optionalString (job.preStop != "") '' + ${ # preStop is run only if there is exec or script. + # (upstart 0.6.5, job.c:562) + optionalString (job.preStop != "") (assert hasMain; '' pre-stop script exec >> ${log} 2>&1 ${job.preStop} end script - ''} + '')} ${optionalString (job.postStop != "") '' post-stop script From b1b73f3c0813c67efb39ee7e955c1481567a09b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Sat, 12 Jun 2010 08:44:51 +0000 Subject: [PATCH 05/12] Noting the booted-system as a gcroot svn path=/nixos/trunk/; revision=22228 --- modules/system/boot/stage-2-init.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/system/boot/stage-2-init.sh b/modules/system/boot/stage-2-init.sh index de9b136d02a..3047a210506 100644 --- a/modules/system/boot/stage-2-init.sh +++ b/modules/system/boot/stage-2-init.sh @@ -121,9 +121,15 @@ echo "running activation script..." @activateConfiguration@ "$systemConfig" -# Record the boot configuration. !!! Should this be a GC root? +# Record the boot configuration. if test -n "$systemConfig"; then ln -sfn "$systemConfig" /var/run/booted-system + + # Prevent the booted system form being garbage-collected + # If it weren't a gcroot, if we were running a different kernel, + # switched system, and garbage collected all, we could not load + # kernel modules anymore. + ln -sfn /var/run/booted-system /nix/var/nix/gcroots/booted-system fi From d0fd8da8f0df124680fef1d3a0d049e9d25abd5a Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Tue, 15 Jun 2010 19:04:06 +0000 Subject: [PATCH 06/12] example how to pass options to nix-daemon svn path=/nixos/trunk/; revision=22286 --- modules/services/misc/nix-daemon.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/services/misc/nix-daemon.nix b/modules/services/misc/nix-daemon.nix index a9a0bc70f1e..fcdcc8fb299 100644 --- a/modules/services/misc/nix-daemon.nix +++ b/modules/services/misc/nix-daemon.nix @@ -162,6 +162,10 @@ in internal = true; default = ""; merge = mergeStringOption; + example = '' + export NIX_TARGET_LOAD=$(( 3 * $(${pkgs.coreutils}/bin/nproc) / 2 )) + export NIX_MAX_PARALLELIZATION=$NIX_TARGET_LOAD + ''; description = " Environment variables used by Nix. "; From fbb3046a87b059647359cc91c101c3bc7e52ffeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Wed, 16 Jun 2010 13:58:15 +0000 Subject: [PATCH 07/12] Making the grub menu builder take a better path at distinguishing if / and /boot are different fs. I chose %D over %d because I like hex more. svn path=/nixos/trunk/; revision=22294 --- modules/installer/grub/grub-menu-builder.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/installer/grub/grub-menu-builder.sh b/modules/installer/grub/grub-menu-builder.sh index cf2041002e7..323ff43e85d 100644 --- a/modules/installer/grub/grub-menu-builder.sh +++ b/modules/installer/grub/grub-menu-builder.sh @@ -30,7 +30,7 @@ esac # the GRUB config file must be relative to the root of the /boot # filesystem. `$bootRoot' is the path to be prepended to paths under # /boot. -if [ "$(stat -f -c '%i' /)" = "$(stat -f -c '%i' /boot)" ]; then +if [ "$(stat -f -c '%D' /)" = "$(stat -f -c '%D' /boot)" ]; then bootRoot=/boot copyKernels="@copyKernels@" # user can override in the NixOS config else From f69d7b1768396ecdf8bd0b952a3aa16fb94f8954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Wed, 16 Jun 2010 15:17:02 +0000 Subject: [PATCH 08/12] Fixing my previous bad commit on stat. Thank you David! svn path=/nixos/trunk/; revision=22297 --- modules/installer/grub/grub-menu-builder.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/installer/grub/grub-menu-builder.sh b/modules/installer/grub/grub-menu-builder.sh index 323ff43e85d..90bedf9543d 100644 --- a/modules/installer/grub/grub-menu-builder.sh +++ b/modules/installer/grub/grub-menu-builder.sh @@ -30,7 +30,7 @@ esac # the GRUB config file must be relative to the root of the /boot # filesystem. `$bootRoot' is the path to be prepended to paths under # /boot. -if [ "$(stat -f -c '%D' /)" = "$(stat -f -c '%D' /boot)" ]; then +if [ "$(stat -c '%D' /.)" = "$(stat -c '%D' /boot/.)" ]; then bootRoot=/boot copyKernels="@copyKernels@" # user can override in the NixOS config else From 0dd9b4caafa8a12f1f2cfad55ccf57d6c924a8b7 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Mon, 21 Jun 2010 14:17:19 +0000 Subject: [PATCH 09/12] reverting -r22286 svn path=/nixos/trunk/; revision=22358 --- modules/services/misc/nix-daemon.nix | 4 ---- 1 file changed, 4 deletions(-) diff --git a/modules/services/misc/nix-daemon.nix b/modules/services/misc/nix-daemon.nix index fcdcc8fb299..a9a0bc70f1e 100644 --- a/modules/services/misc/nix-daemon.nix +++ b/modules/services/misc/nix-daemon.nix @@ -162,10 +162,6 @@ in internal = true; default = ""; merge = mergeStringOption; - example = '' - export NIX_TARGET_LOAD=$(( 3 * $(${pkgs.coreutils}/bin/nproc) / 2 )) - export NIX_MAX_PARALLELIZATION=$NIX_TARGET_LOAD - ''; description = " Environment variables used by Nix. "; From ebd9fb6cf397388137fc1e3fc3c252c9cd951bb8 Mon Sep 17 00:00:00 2001 From: Evgeny Egorochkin Date: Mon, 28 Jun 2010 18:36:37 +0000 Subject: [PATCH 10/12] Added Quassel IRC client service svn path=/nixos/trunk/; revision=22425 --- modules/module-list.nix | 1 + modules/services/networking/quassel.nix | 97 +++++++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 modules/services/networking/quassel.nix diff --git a/modules/module-list.nix b/modules/module-list.nix index 8e12fd14129..2925f5a1809 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -92,6 +92,7 @@ ./services/networking/openvpn.nix ./services/networking/portmap.nix ./services/networking/privoxy.nix + ./services/networking/quassel.nix ./services/networking/ssh/lshd.nix ./services/networking/ssh/sshd.nix ./services/networking/tftpd.nix diff --git a/modules/services/networking/quassel.nix b/modules/services/networking/quassel.nix new file mode 100644 index 00000000000..d4795f3b57d --- /dev/null +++ b/modules/services/networking/quassel.nix @@ -0,0 +1,97 @@ +{ config, pkgs, ... }: + +with pkgs.lib; + +let + quassel = pkgs.quassel.override { daemon = true; monolithic = false; client = false; }; + cfg = config.services.quassel; +in + +{ + + ###### interface + + options = { + + services.quassel = { + + enable = mkOption { + default = false; + description = '' + Whether to run the Quassel IRC client daemon. + ''; + }; + + interface = mkOption { + default = "127.0.0.1"; + description = '' + The interface the Quassel daemon will be listening to. If `127.0.0.1', + only clients on the local host can connect to it; if `0.0.0.0', clients + can access it from any network interface. + ''; + }; + + portNumber = mkOption { + default = 4242; + description = '' + The port number the Quassel daemon will be listening to. + ''; + }; + + logFile = mkOption { + default = "/var/log/quassel.log"; + description = "Location of the logfile of the Quassel daemon."; + }; + + dataDir = mkOption { + default = ''/home/${cfg.user}/.config/quassel-irc.org''; + description = '' + The directory holding configuration files, the SQlite database and the SSL Cert. + ''; + }; + + user = mkOption { + default = "quassel"; + description = '' + The user the Quassel daemon should run as. + ''; + }; + + }; + + }; + + + ###### implementation + + config = mkIf cfg.enable { + + users.extraUsers = singleton + { name = cfg.user; + description = "Quassel IRC client daemon"; + }; + + + jobs.quassel = + { description = "Quassel IRC client daemon"; + + startOn = "ip-up"; + + preStart = '' + mkdir -p ${cfg.dataDir} + chown ${cfg.user} ${cfg.dataDir} + touch ${cfg.logFile} && chown ${cfg.user} ${cfg.logFile} + ''; + + exec = '' + ${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${cfg.user} \ + -c '${quassel}/bin/quasselcore --listen=${cfg.interface}\ + --port=${toString cfg.portNumber} --configdir=${cfg.dataDir} --logfile=${cfg.logFile}' + ''; + }; + + environment.systemPackages = [ quassel ]; + + }; + +} From 41cc6ecdbbf043fd994a5ee03b6af9d641a85214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Thu, 1 Jul 2010 17:54:03 +0000 Subject: [PATCH 11/12] Trying to make the nixos-bootstrap-archive (nixos-minimal-archive in other places named) to have an hydra build product for easy tarball download. svn path=/nixos/trunk/; revision=22440 --- modules/installer/tools/nixos-bootstrap-archive/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/installer/tools/nixos-bootstrap-archive/default.nix b/modules/installer/tools/nixos-bootstrap-archive/default.nix index d383ad081e1..3fa287bf898 100644 --- a/modules/installer/tools/nixos-bootstrap-archive/default.nix +++ b/modules/installer/tools/nixos-bootstrap-archive/default.nix @@ -17,4 +17,6 @@ runCommand "nixos-bootstrap-archive" { } '' $(s ${nixosBootstrap}/bin/nixos-bootstrap ) cat tmp.tar | bzip2 > $out/nixos-install-archive.tar.bz2 + ensureDir $out/nix-support + echo "file tarball" $out/nixos-install-archive.tar.bz2 > $out/nix-support/hydra-build-products '' From 2335cb65a393b45949b18fb484eee1d2a09e5252 Mon Sep 17 00:00:00 2001 From: Wouter den Breejen Date: Sat, 3 Jul 2010 15:10:48 +0000 Subject: [PATCH 12/12] Added sabnzbd :) SABnzbd makes Usenet as simple and streamlined as possible by automating everything we can. All you have to do is add an .nzb. SABnzbd takes over from there, where it will be automatically downloaded, verified, repaired, extracted and filed away with zero human interaction. http://sabnzbd.org/ svn path=/nixos/trunk/; revision=22446 --- modules/misc/ids.nix | 1 + modules/module-list.nix | 1 + modules/services/networking/sabnzbd.nix | 52 +++++++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 modules/services/networking/sabnzbd.nix diff --git a/modules/misc/ids.nix b/modules/misc/ids.nix index c100ae73456..8d516946868 100644 --- a/modules/misc/ids.nix +++ b/modules/misc/ids.nix @@ -53,6 +53,7 @@ in davfs2 = 31; privoxy = 32; osgi = 34; + sabnzbd = 33; tor = 35; # When adding a uid, make sure it doesn't match an existing gid. diff --git a/modules/module-list.nix b/modules/module-list.nix index 2925f5a1809..841a6b11a5f 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -97,6 +97,7 @@ ./services/networking/ssh/sshd.nix ./services/networking/tftpd.nix ./services/networking/vsftpd.nix + ./services/networking/sabnzbd.nix ./services/networking/wicd.nix ./services/networking/wpa_supplicant.nix ./services/networking/xinetd.nix diff --git a/modules/services/networking/sabnzbd.nix b/modules/services/networking/sabnzbd.nix new file mode 100644 index 00000000000..7f87343cbb9 --- /dev/null +++ b/modules/services/networking/sabnzbd.nix @@ -0,0 +1,52 @@ +{ config, pkgs, ... }: + +with pkgs.lib; + +let + + cfg = config.services.sabnzbd; + inherit (pkgs) sabnzbd; + +in + +{ + + ###### interface + + options = { + services.sabnzbd = { + enable = mkOption { + default = false; + description = "Whether to enable the sabnzbd FTP server."; + }; + configFile = mkOption { + default = "/var/sabnzbd/sabnzbd.ini"; + description = "Path to config file. (You need to create this file yourself!)"; + }; + }; + }; + + + ###### implementation + + config = mkIf cfg.enable { + + users.extraUsers = + [ { name = "sabnzbd"; + uid = config.ids.uids.sabnzbd; + description = "sabnzbd user"; + home = "/homeless-shelter"; + } + ]; + + jobs.sabnzbd = + { description = "sabnzbd server"; + + startOn = "network-interfaces/started"; + stopOn = "network-interfaces/stop"; + + exec = "${sabnzbd}/bin/sabnzbd -d -f ${cfg.configFile}"; + }; + + }; +}