Fight Covid-19 with Folding@home and NixOS

This is a bit unusual for an announcement.

Recently the Folding@home announced that they are helping the research around Covid-19. The project is about folding protein sequences and finding new working combinations. Which then helps find which molecules could be effective against specific diseases (my wording, don’t quote me on that).

This process is highly parallel and we can contribute to it with CPU and GPU power.

In that light I created a new “NixOS” team (number: 236565 ) and revamped the packaging and NixOS module. And am now looking for beta-testers :slight_smile:

To help out:

  1. use the following nixpkgs channel (rebased on nixos-unstable):
  2. add the following NixOS configuration to your machine:
{ pkgs, ... }:
  nixpkgs.config.allowUnfree = true;
  services.foldingathome.enable = true;
  environment.systemPackages = with pkgs; [ fahviewer fahcontrol ];
  1. nixos-rebuild switch
  2. Run fahcontrol to configure the client. Configure your user and set the team ID to 236565.

If you have a GPU on the machine, make sure that the driver is compatible with OpenCL (basically Nvidia proprietary driver) and look at the logs in fahcontrol to see if there are any errors.


For those of you who want to help without having to switch your machine to nixos-unstable:

export NIX_PATH=nixpkgs=
nix-shell -p foldingathome --run FAHClient &
nix-shell -p fahcontrol --run FAHControl

Does anyone have handy instructions on making it work with fancy NVIDIA GPUs?

With this configuration it “just worked”


I just have have services.xserver.videoDrivers = [ "nvidia" ] in my configuration.nix, and it’s able to pick up my 1070.

… that’s a $60,000 server you got there >.>

It’s two of them :stuck_out_tongue:


If there’s an easy way to get OpenCL working with my 5700XT in a way that makes Folding happy I’d also throw it at it :slight_smile:

1 Like

Wow! Thanks a lot for participating with this project.

source: Folding@home | Statistics

1 Like

Can I do that with just nix or nixos not installed but nix-shell etcetera enabled ?

I got:

error: cannot unlink ‘/nix/store/c4s1vidgfhw0kp11fzhg4gmgfsibcixk-foldingathome.tar.gz/pkgs/applications/blockchains/stellar-core.nix’: Permission denied
error: opening file ‘/nix/store/c4s1vidgfhw0kp11fzhg4gmgfsibcixk-foldingathome.tar.gz/default.nix’: No such file or directory

when running nix-shell -p fahcontrol --run FAHControl

I’m getting

error: Package ‘fahviewer-7.5.1’ in /nix/store/p03yivl26zvk7v5c0yawrsk4wb7dzfnz-folding/folding/pkgs/applications/science/misc/foldingathome/viewer.nix:52 has an unfree license (‘unfree’), refusing to evaluate.

a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowUnfree = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowUnfree = true; }
to ~/.config/nixpkgs/config.nix.

when trying this although I have the option a) in my config.

Did you also set the NIX_PATH as @pjones explained in Fight Covid-19 with Folding@home and NixOS - #2 by pjones ?

Is that for a nixos or nix-shell installation? Try adding option (b) as well.

Yes I think so:
excerpt from history:

995 export NIX_PATH=nixpkgs=
996 nix-shell -p foldingathome --run FAHClient &
997 nix-shell -p fahcontrol --run FAHControl

I have a nixos installation, but didn’t want to mess with the channels. Option b) worked, thanks for that!

@ilikeavocadoes got the same error, seems it’s nix-shell that does not care if your config sets unFree to true. I sligthly changed the command line suggested by @pjones to make it to accept unfree.

Now it works fine for me:

export NIX_PATH=nixpkgs=
nix-shell -p foldingathome --run FAHClient &
nix-shell -p fahcontrol --run FAHControl
1 Like

Tried again after running garbage control, but when firing nix-shell -p foldingathome --run FAHClient & got:

** Message: 12:01:36.932: Requires Linux version >= 3.19 built with CONFIG_USER_NS

** (process:10819): ERROR **: 12:01:36.936: main: unshare: Invalid argument
/tmp/nix-shell-10789-0/rc: line 1: 10817 Trace/breakpoint trap (core dumped) FAHClient

@573 just wondering, what’s your uname -a or simply uname -r ? At first sight the error message is complaining as if you had a really old Linux kernel version.

Maybe that could give info, about the part where it deals with CONFIG_USER_NS : containers - How to check if Linux user namespaces are supported by current OS kernel - Stack Overflow

uname -r


Currently trying to fire up a qemu vm with fahclient. Side note: I am using home-manager and I have system-features = kvm nixos-test in my `~/.config/nix/nix.conf´.

Still, when firing ./result/bin/run-nixos-vm (built vm) getting:

qemu-system-x86_64: CPU model ‘host’ requires KVM

EDIT: Seems I have forgotten to build the vm prior running: nix-build '<nixpkgs/nixos>' -A vm --arg configuration "{ imports = [ ./vm.nix ]; }"
Seems nothing to do with system-features entering in this case/error directly.

In one command and with Viewer button working

nix-shell -I nixpkgs= -p fahcontrol -p fahclient -p fahviewer --run 'FAHClient & FAHControl'
Hosted by Flying Circus.