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
parent
b6fe12b1cc
commit
001be890f7
@ -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" ]; |
||||
}; |
||||
} |
Loading…
Reference in new issue