folding@home: 6.02 -> 7.5.1

The v7 series is very different.

This commit introduces the 3 packages: fahclient, fahcontrol and
fahviewer. It also rebuilds the NixOS module to map better with the new
client.
wip/yesman
zimbatm 4 years ago committed by Jon
parent b6fe12b1cc
commit 001be890f7
  1. 6
      nixos/modules/module-list.nix
  2. 81
      nixos/modules/services/computing/foldingathome/client.nix
  3. 67
      nixos/modules/services/misc/folding-at-home.nix
  4. 59
      pkgs/applications/science/misc/foldingathome/client.nix
  5. 58
      pkgs/applications/science/misc/foldingathome/control.nix
  6. 55
      pkgs/applications/science/misc/foldingathome/viewer.nix
  7. 36
      pkgs/misc/foldingathome/default.nix
  8. 1
      pkgs/top-level/aliases.nix
  9. 4
      pkgs/top-level/all-packages.nix

@ -247,9 +247,10 @@
./services/cluster/kubernetes/proxy.nix
./services/cluster/kubernetes/scheduler.nix
./services/computing/boinc/client.nix
./services/computing/torque/server.nix
./services/computing/torque/mom.nix
./services/computing/foldingathome/client.nix
./services/computing/slurm/slurm.nix
./services/computing/torque/mom.nix
./services/computing/torque/server.nix
./services/continuous-integration/buildbot/master.nix
./services/continuous-integration/buildbot/worker.nix
./services/continuous-integration/buildkite-agents.nix
@ -432,7 +433,6 @@
./services/misc/ethminer.nix
./services/misc/exhibitor.nix
./services/misc/felix.nix
./services/misc/folding-at-home.nix
./services/misc/freeswitch.nix
./services/misc/fstrim.nix
./services/misc/gammu-smsd.nix

@ -0,0 +1,81 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.foldingathome;
args =
["--team" "${toString cfg.team}"]
++ lib.optionals (cfg.user != null) ["--user" cfg.user]
++ cfg.extraArgs
;
in
{
imports = [
(mkRenamedOptionModule [ "services" "foldingAtHome" ] [ "services" "foldingathome" ])
(mkRenamedOptionModule [ "services" "foldingathome" "nickname" ] [ "services" "foldingathome" "user" ])
(mkRemovedOptionModule [ "services" "foldingathome" "config" ] ''
Use <literal>services.foldingathome.extraArgs instead<literal>
'')
];
options.services.foldingathome = {
enable = mkEnableOption "Enable the Folding@home client";
package = mkOption {
type = types.package;
default = pkgs.fahclient;
defaultText = "pkgs.fahclient";
description = ''
Which Folding@home client to use.
'';
};
user = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
The user associated with the reported computation results. This will
be used in the ranking statistics.
'';
};
team = mkOption {
type = types.int;
default = 236565;
description = ''
The team ID associated with the reported computation results. This
will be used in the ranking statistics.
By default, use the NixOS folding@home team ID is being used.
'';
};
extraArgs = mkOption {
type = types.listOf types.str;
default = [];
description = ''
Extra startup options for the FAHClient. Run
<literal>FAHClient --help</literal> to find all the available options.
'';
};
};
config = mkIf cfg.enable {
systemd.services.foldingathome = {
description = "Folding@home client";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
script = ''
exec ${cfg.package}/bin/FAHClient ${lib.escapeShellArgs args}
'';
serviceConfig = {
DynamicUser = true;
StateDirectory = "foldingathome";
WorkingDirectory = "%S/foldingathome";
};
};
};
meta = {
maintainers = with lib.maintainers; [ zimbatm ];
};
}

@ -1,67 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
let
stateDir = "/var/lib/foldingathome";
cfg = config.services.foldingAtHome;
fahUser = "foldingathome";
in {
###### interface
options = {
services.foldingAtHome = {
enable = mkOption {
default = false;
description = ''
Whether to enable the Folding@Home to use idle CPU time.
'';
};
nickname = mkOption {
default = "Anonymous";
description = ''
A unique handle for statistics.
'';
};
config = mkOption {
default = "";
description = ''
Extra configuration. Contents will be added verbatim to the
configuration file.
'';
};
};
};
###### implementation
config = mkIf cfg.enable {
users.users.${fahUser} =
{ uid = config.ids.uids.foldingathome;
description = "Folding@Home user";
home = stateDir;
};
systemd.services.foldingathome = {
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
preStart = ''
mkdir -m 0755 -p ${stateDir}
chown ${fahUser} ${stateDir}
cp -f ${pkgs.writeText "client.cfg" cfg.config} ${stateDir}/client.cfg
'';
script = "${pkgs.su}/bin/su -s ${pkgs.runtimeShell} ${fahUser} -c 'cd ${stateDir}; ${pkgs.foldingathome}/bin/fah6'";
};
services.foldingAtHome.config = ''
[settings]
username=${cfg.nickname}
'';
};
}

@ -0,0 +1,59 @@
{ stdenv
, autoPatchelfHook
, buildFHSUserEnv
, dpkg
, fetchurl
, gcc-unwrapped
, ocl-icd
, zlib
, extraPkgs ? []
}:
let
majMin = stdenv.lib.versions.majorMinor version;
version = "7.5.1";
fahclient = stdenv.mkDerivation rec {
inherit version;
pname = "fahclient";
src = fetchurl {
url = "https://download.foldingathome.org/releases/public/release/fahclient/debian-stable-64bit/v${majMin}/fahclient_${version}_amd64.deb";
hash = "sha256-7+RwYdMoZnJZwYFbmLxsN9ozk2P7jpOGZz9qlvTTfSY=";
};
nativeBuildInputs = [
autoPatchelfHook
dpkg
];
buildInputs = [
gcc-unwrapped.lib
zlib
];
unpackPhase = "dpkg-deb -x ${src} ./";
installPhase = "cp -ar usr $out";
};
in
buildFHSUserEnv {
name = fahclient.name;
targetPkgs = pkgs': [
fahclient
ocl-icd
] ++ extraPkgs;
runScript = "/bin/FAHClient";
extraInstallCommands = ''
mv $out/bin/$name $out/bin/FAHClient
'';
meta = {
description = "Folding@home client";
homepage = "https://foldingathome.org/";
license = stdenv.lib.licenses.unfree;
maintainers = [ stdenv.lib.maintainers.zimbatm ];
platforms = [ "x86_64-linux" ];
};
}

@ -0,0 +1,58 @@
{ stdenv
, autoPatchelfHook
, dpkg
, fetchurl
, makeWrapper
, python2
}:
let
majMin = stdenv.lib.versions.majorMinor version;
version = "7.5.1";
python = python2.withPackages
(
ps: [
ps.pycairo
ps.pygobject2
ps.pygtk
]
);
in
stdenv.mkDerivation rec {
inherit version;
pname = "fahcontrol";
src = fetchurl {
url = "https://download.foldingathome.org/releases/public/release/fahcontrol/debian-stable-64bit/v${majMin}/fahcontrol_${version}-1_all.deb";
hash = "sha256-ydN4I6vmZpI9kD+/TXxgWc+AQqIIlUvABEycWmY1tNg=";
};
nativeBuildInputs = [
dpkg
makeWrapper
];
buildInputs = [ python ];
doBuild = false;
unpackPhase = ''
dpkg-deb -x ${src} ./
'';
installPhase = "cp -ar usr $out";
postFixup = ''
sed -e 's|/usr/bin|$out/bin|g' -i $out/share/applications/FAHControl.desktop
wrapProgram "$out/bin/FAHControl" \
--set PYTHONPATH "$out/lib/python2.7/dist-packages"
'';
meta = {
description = "Folding@home control";
homepage = "https://foldingathome.org/";
license = stdenv.lib.licenses.unfree;
maintainers = [ stdenv.lib.maintainers.zimbatm ];
platforms = [ "x86_64-linux" ];
};
}

@ -0,0 +1,55 @@
{ stdenv
, autoPatchelfHook
, dpkg
, fetchurl
, freeglut
, gcc-unwrapped
, libGL
, libGLU
, makeWrapper
, zlib
}:
let
majMin = stdenv.lib.versions.majorMinor version;
version = "7.5.1";
in
stdenv.mkDerivation rec {
inherit version;
pname = "fahviewer";
src = fetchurl {
url = "https://download.foldingathome.org/releases/public/release/fahviewer/debian-stable-64bit/v${majMin}/fahviewer_${version}_amd64.deb";
hash = "sha256-yH0zGjX8aNBEJ5lq7wWydcpp2rO+9Ah++q9eJ+ldeyk=";
};
nativeBuildInputs = [
autoPatchelfHook
dpkg
makeWrapper
];
buildInputs = [
freeglut
gcc-unwrapped.lib
libGL
libGLU
zlib
];
unpackPhase = ''
dpkg-deb -x ${src} ./
sed -e 's|/usr/bin|$out/bin|g' -i usr/share/applications/FAHViewer.desktop
'';
installPhase = ''
cp -ar usr $out
'';
meta = {
description = "Folding@home viewer";
homepage = "https://foldingathome.org/";
license = stdenv.lib.licenses.unfree;
maintainers = [ stdenv.lib.maintainers.zimbatm ];
platforms = [ "x86_64-linux" ];
};
}

@ -1,36 +0,0 @@
{stdenv, fetchurl}:
stdenv.mkDerivation {
name = "folding-at-home-6.02";
src = fetchurl {
url = http://www.stanford.edu/group/pandegroup/folding/release/FAH6.02-Linux.tgz;
sha256 = "01nwi0lb4vv0xg4k04i2fbf5v5qgabl70jm5cgvw1ibgqjz03910";
};
unpackPhase = "tar xvzf $src";
# Otherwise it doesn't work at all, even ldd thinks it's not a dynamic executable
dontStrip = true;
# This program, to run with '-smp', wants to execute the program mpiexec
# as "./mpiexec", although it also expects to write the data files into "."
# I suggest, if someone wants to run it, in the data directory set a link
# to the store for 'mpiexec', so './mpiexec' will work. That link better
# be considered a gcroot.
installPhase = ''
BINFILES="fah6 mpiexec";
for a in $BINFILES; do
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $a
done
mkdir -p $out/bin
cp $BINFILES $out/bin
'';
meta = {
homepage = http://folding.stanford.edu/;
description = "Folding@home distributed computing client";
license = stdenv.lib.licenses.unfree;
platforms = [ "i686-linux" ];
};
}

@ -132,6 +132,7 @@ mapAliases ({
firestr = throw "firestr has been removed."; # added 2019-12-08
flameGraph = flamegraph; # added 2018-04-25
foldingathome = fahclient; # added 2020-09-03
font-awesome-ttf = font-awesome; # 2018-02-25
# 2019-10-31
fontconfig-ultimate = throw ''

@ -25033,7 +25033,9 @@ in
flockit = callPackage ../tools/backup/flockit { };
foldingathome = callPackage ../misc/foldingathome { };
fahclient = callPackage ../applications/science/misc/foldingathome/client.nix {};
fahcontrol = callPackage ../applications/science/misc/foldingathome/control.nix {};
fahviewer = callPackage ../applications/science/misc/foldingathome/viewer.nix {};
foo2zjs = callPackage ../misc/drivers/foo2zjs {};

Loading…
Cancel
Save