mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-18 19:03:28 +00:00
AMule: create the user only if the user option is null, don't pollute the system profile with useless packages.
svn path=/nixos/trunk/; revision=23928
This commit is contained in:
parent
d8c72719aa
commit
3bca96e1bd
@ -4,6 +4,7 @@ with pkgs.lib;
|
||||
|
||||
let
|
||||
cfg = config.services.amule;
|
||||
user = if cfg.user != null then cfg.user else "amule";
|
||||
in
|
||||
|
||||
{
|
||||
@ -22,14 +23,14 @@ in
|
||||
};
|
||||
|
||||
dataDir = mkOption {
|
||||
default = ''/home/${cfg.user}/'';
|
||||
default = ''/home/${user}/'';
|
||||
description = ''
|
||||
The directory holding configuration, incoming and temporary files.
|
||||
'';
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
default = "amule";
|
||||
default = null;
|
||||
description = ''
|
||||
The user the AMule daemon should run as.
|
||||
'';
|
||||
@ -44,10 +45,10 @@ in
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
users.extraUsers = singleton
|
||||
users.extraUsers = mkIf (cfg.user == null) [
|
||||
{ name = cfg.user;
|
||||
description = "AMule daemon";
|
||||
};
|
||||
} ];
|
||||
|
||||
jobs.amuled =
|
||||
{ description = "AMule daemon";
|
||||
@ -56,17 +57,15 @@ in
|
||||
|
||||
preStart = ''
|
||||
mkdir -p ${cfg.dataDir}
|
||||
chown ${cfg.user} ${cfg.dataDir}
|
||||
chown ${user} ${cfg.dataDir}
|
||||
'';
|
||||
|
||||
exec = ''
|
||||
${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${cfg.user} \
|
||||
${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${user} \
|
||||
-c 'HOME="${cfg.dataDir}" ${pkgs.amuleDaemon}/bin/amuled'
|
||||
'';
|
||||
};
|
||||
|
||||
environment.systemPackages = [ pkgs.amuleDaemon ];
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user