nixos/services.amule: remove with lib;

This commit is contained in:
Felix Buehler 2024-08-28 21:19:01 +02:00 committed by Jörg Thalheim
parent 46dc82d477
commit d63146859b

View File

@ -1,7 +1,4 @@
{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.amule;
opt = options.services.amule;
@ -16,18 +13,18 @@ in
services.amule = {
enable = mkOption {
type = types.bool;
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Whether to run the AMule daemon. You need to manually run "amuled --ec-config" to configure the service for the first time.
'';
};
dataDir = mkOption {
type = types.str;
dataDir = lib.mkOption {
type = lib.types.str;
default = "/home/${user}/";
defaultText = literalExpression ''
defaultText = lib.literalExpression ''
"/home/''${config.${opt.user}}/"
'';
description = ''
@ -35,8 +32,8 @@ in
'';
};
user = mkOption {
type = types.nullOr types.str;
user = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
description = ''
The user the AMule daemon should run as.
@ -50,16 +47,16 @@ in
###### implementation
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
users.users = mkIf (cfg.user == null) [
users.users = lib.mkIf (cfg.user == null) [
{ name = "amule";
description = "AMule daemon";
group = "amule";
uid = config.ids.uids.amule;
} ];
users.groups = mkIf (cfg.user == null) [
users.groups = lib.mkIf (cfg.user == null) [
{ name = "amule";
gid = config.ids.gids.amule;
} ];