diff --git a/modules/installer/tools/nixos-bootstrap-archive/default.nix b/modules/installer/tools/nixos-bootstrap-archive/default.nix index d383ad081e14..3fa287bf898a 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 '' diff --git a/modules/misc/ids.nix b/modules/misc/ids.nix index c100ae734563..8d516946868a 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 8e12fd141297..841a6b11a5fd 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -92,10 +92,12 @@ ./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 ./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/misc/nix-daemon.nix b/modules/services/misc/nix-daemon.nix index fcdcc8fb2991..a9a0bc70f1ec 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. "; diff --git a/modules/services/networking/quassel.nix b/modules/services/networking/quassel.nix new file mode 100644 index 000000000000..d4795f3b57d2 --- /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 ]; + + }; + +} diff --git a/modules/services/networking/sabnzbd.nix b/modules/services/networking/sabnzbd.nix new file mode 100644 index 000000000000..7f87343cbb95 --- /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}"; + }; + + }; +}