1 { config, lib, options, pkgs, ... }:
3 cfg = config.services.amule;
4 opt = options.services.amule;
5 user = if cfg.user != null then cfg.user else "amule";
16 enable = lib.mkOption {
17 type = lib.types.bool;
20 Whether to run the AMule daemon. You need to manually run "amuled --ec-config" to configure the service for the first time.
24 dataDir = lib.mkOption {
26 default = "/home/${user}/";
27 defaultText = lib.literalExpression ''
28 "/home/''${config.${opt.user}}/"
31 The directory holding configuration, incoming and temporary files.
36 type = lib.types.nullOr lib.types.str;
39 The user the AMule daemon should run as.
50 config = lib.mkIf cfg.enable {
52 users.users = lib.mkIf (cfg.user == null) [
54 description = "AMule daemon";
56 uid = config.ids.uids.amule;
59 users.groups = lib.mkIf (cfg.user == null) [
61 gid = config.ids.gids.amule;
64 systemd.services.amuled = {
65 description = "AMule daemon";
66 wantedBy = [ "multi-user.target" ];
67 after = [ "network.target" ];
70 mkdir -p ${cfg.dataDir}
71 chown ${user} ${cfg.dataDir}
75 ${pkgs.su}/bin/su -s ${pkgs.runtimeShell} ${user} \
76 -c 'HOME="${cfg.dataDir}" ${pkgs.amule-daemon}/bin/amuled'