diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index f98b621111fd7..70856259f6fc2 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -137,6 +137,8 @@ ./services/mail/postfix.nix ./services/mail/spamassassin.nix #./services/misc/autofs.nix + ./services/misc/autofs.nix + ./services/misc/boinc.nix ./services/misc/cgminer.nix ./services/misc/dictd.nix ./services/misc/disnix.nix diff --git a/nixos/modules/services/misc/boinc.nix b/nixos/modules/services/misc/boinc.nix new file mode 100644 index 0000000000000..05eba2f806f7a --- /dev/null +++ b/nixos/modules/services/misc/boinc.nix @@ -0,0 +1,54 @@ +{ config, pkgs, ... }: + +with pkgs.lib; + +let + cfg = config.services.boinc; +in +{ + options = { + + services.boinc = { + + enable = mkOption { + default = false; + description = "Whether to enable the Berkeley Open Infrastructure for Network Computing (BOINC) worker."; + }; + + home = mkOption { + default = "/var/lib/boinc"; + description = "Location of BOINC work directory."; + }; + + user = mkOption { + default = "nobody"; + description = "User that shall run BOINC."; + }; + }; + }; + + config = mkIf cfg.enable { + + environment.systemPackages = [ pkgs.boinc ]; + + systemd.services.boinc = { + description = "Berkeley Open Infrastructure for Network Computing worker"; + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; + path = [ pkgs.boinc ]; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.boinc}/bin/boinc"; + User = cfg.user; + WorkingDirectory = cfg.home; + CPUSchedulingPolicy = "idle"; + IOSchedulingClass = "idle"; + }; + }; + + system.activationScripts.boinc = '' + ${pkgs.coreutils}/bin/mkdir -p "${cfg.home}" + ${pkgs.coreutils}/bin/chown -R "${cfg.user}" "${cfg.home}" + ''; + }; +} diff --git a/pkgs/applications/science/misc/boinc/default.nix b/pkgs/applications/science/misc/boinc/default.nix index 0bc5c3cb7c7cf..be46a353e09e1 100644 --- a/pkgs/applications/science/misc/boinc/default.nix +++ b/pkgs/applications/science/misc/boinc/default.nix @@ -1,14 +1,19 @@ +#TODO: build without GUI for headless operation. + { fetchgit, stdenv, autoconf, automake, pkgconfig, m4, curl, mesa, libXmu, libXi, freeglut, libjpeg, libtool, wxGTK, xcbutil, sqlite, gtk, patchelf, libXScrnSaver, libnotify, libX11, libxcb }: +let + version = "7.2.42"; +in stdenv.mkDerivation rec { - name = "boinc-7.0.44"; + name = "boinc-${version}"; src = fetchgit { - url = "git://boinc.berkeley.edu/boinc-v2.git"; - rev = "7c449b1fb8a681ceb27d6895751b62a2b3adf0f2"; - sha256 = "0hdramyl9nip3gadp7xiaz8ngyld15i93d8ai1nsd04bmrvdfqia"; + url = git://boinc.berkeley.edu/boinc-v2.git; + rev = "refs/tags/client_release/7.2/${version}"; + sha256 = "1zifpi3mjgaj68fba6kammp3x7z8n2x164zz6fj91xfiapnan56j"; }; buildInputs = [ libtool automake autoconf m4 pkgconfig curl mesa libXmu libXi @@ -16,16 +21,11 @@ stdenv.mkDerivation rec { libxcb xcbutil ]; - postConfigure = '' - sed -i -e s,/etc,$out/etc, client/scripts/Makefile - ''; + patches = [ ./no-runscript.patch ]; NIX_LDFLAGS = "-lX11"; - preConfigure = '' - ./_autosetup - configureFlags="$configureFlags --sysconfdir=$out/etc" - ''; + preConfigure = "./_autosetup"; enableParallelBuilding = true; @@ -33,11 +33,9 @@ stdenv.mkDerivation rec { meta = { description = "Free software for distributed and grid computing"; - homepage = http://boinc.berkeley.edu/; - - license = "LGPLv2+"; - + license = stdenv.lib.licenses.lgpl21Plus; + maintainers = [ stdenv.lib.maintainers.emery ]; platforms = stdenv.lib.platforms.linux; # arbitrary choice }; } diff --git a/pkgs/applications/science/misc/boinc/no-runscript.patch b/pkgs/applications/science/misc/boinc/no-runscript.patch new file mode 100644 index 0000000000000..0c0ff43167fe8 --- /dev/null +++ b/pkgs/applications/science/misc/boinc/no-runscript.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile.am b/Makefile.am +index 6322db1..9820912 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -21,7 +21,7 @@ if ENABLE_SERVER + endif + + if ENABLE_CLIENT +- CLIENT_SUBDIRS = client client/scripts ++ CLIENT_SUBDIRS = client + endif + + if ENABLE_MANAGER