summary refs log tree commit diff
path: root/nixos/modules/services/misc/folding-at-home.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/services/misc/folding-at-home.nix')
-rw-r--r--nixos/modules/services/misc/folding-at-home.nix32
1 files changed, 13 insertions, 19 deletions
diff --git a/nixos/modules/services/misc/folding-at-home.nix b/nixos/modules/services/misc/folding-at-home.nix
index 392d2d1f002..4f09cbfdd79 100644
--- a/nixos/modules/services/misc/folding-at-home.nix
+++ b/nixos/modules/services/misc/folding-at-home.nix
@@ -49,26 +49,20 @@ in {
         home = stateDir;
       };
 
-    jobs.foldingAtHome =
-      { name = "foldingathome";
-
-        startOn = "started network-interfaces";
-        stopOn = "stopping network-interfaces";
-
-        preStart =
-          ''
-            mkdir -m 0755 -p ${stateDir}
-            chown ${fahUser} ${stateDir}
-            cp -f ${pkgs.writeText "client.cfg" cfg.config} ${stateDir}/client.cfg
-          '';
-        exec = "${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${fahUser} -c 'cd ${stateDir}; ${pkgs.foldingathome}/bin/fah6'";
-      };
-
-      services.foldingAtHome.config = ''
-          [settings]
-          username=${cfg.nickname}
+    systemd.services.foldingathome = {
+      after = [ "network-interfaces.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.stdenv.shell} ${fahUser} -c 'cd ${stateDir}; ${pkgs.foldingathome}/bin/fah6'";
+    };
 
+    services.foldingAtHome.config = ''
+        [settings]
+        username=${cfg.nickname}
+    '';
   };
-
 }