Convert "samba"
svn path=/nixos/branches/fix-style/; revision=14386
This commit is contained in:
parent
e0240ddf3d
commit
e6144b4763
@ -479,18 +479,6 @@ in
|
||||
|
||||
};
|
||||
|
||||
samba = {
|
||||
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
description = "
|
||||
Whether to enable the samba server. (to communicate with, and provide windows shares)
|
||||
";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
ircdHybrid = {
|
||||
|
||||
enable = mkOption {
|
||||
@ -983,6 +971,7 @@ in
|
||||
(import ../upstart-jobs/vsftpd.nix)
|
||||
(import ../upstart-jobs/cupsd.nix) # CUPS printing daemon
|
||||
(import ../upstart-jobs/udev.nix) # The udev daemon creates devices nodes and runs programs when hardware events occur.
|
||||
(import ../upstart-jobs/samba.nix) # TODO: doesn't start here (?)
|
||||
|
||||
# nix
|
||||
(import ../upstart-jobs/nix.nix) # nix options and daemon
|
||||
|
@ -149,13 +149,6 @@ let
|
||||
inherit config pkgs;
|
||||
})
|
||||
|
||||
# Samba service.
|
||||
++ optional config.services.samba.enable
|
||||
(import ../upstart-jobs/samba.nix {
|
||||
inherit pkgs;
|
||||
inherit (pkgs) glibc samba;
|
||||
})
|
||||
|
||||
# X Font Server
|
||||
++ optional config.services.xfs.enable
|
||||
(import ../upstart-jobs/xfs.nix {
|
||||
|
@ -1,4 +1,26 @@
|
||||
{pkgs, samba, glibc}:
|
||||
{pkgs, config, ...}:
|
||||
|
||||
###### interface
|
||||
let
|
||||
inherit (pkgs.lib) mkOption mkIf;
|
||||
|
||||
options = {
|
||||
services = {
|
||||
samba = {
|
||||
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
description = "
|
||||
Whether to enable the samba server. (to communicate with, and provide windows shares)
|
||||
";
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
|
||||
###### implementation
|
||||
|
||||
let
|
||||
|
||||
@ -7,52 +29,65 @@ let
|
||||
|
||||
smbConfig = ./smb.conf ;
|
||||
|
||||
inherit (pkgs) samba;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
name = "samba";
|
||||
|
||||
users = [
|
||||
{ name = user;
|
||||
description = "Samba service user";
|
||||
group = group;
|
||||
}
|
||||
];
|
||||
|
||||
groups = [
|
||||
{ name = group;
|
||||
}
|
||||
|
||||
mkIf config.services.samba.enable {
|
||||
require = [
|
||||
options
|
||||
];
|
||||
|
||||
job = "
|
||||
|
||||
description \"Samba Service\"
|
||||
users = {
|
||||
extraUsers = [
|
||||
{ name = user;
|
||||
description = "Samba service user";
|
||||
group = group;
|
||||
}
|
||||
];
|
||||
|
||||
extraGroups = [
|
||||
{ name = group;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
start on network-interfaces/started
|
||||
stop on network-interfaces/stop
|
||||
services = {
|
||||
extraJobs = [{
|
||||
name = "samba";
|
||||
job = ''
|
||||
|
||||
start script
|
||||
description "Samba Service"
|
||||
|
||||
if ! test -d /home/smbd ; then
|
||||
mkdir -p /home/smbd
|
||||
chown ${user} /home/smbd
|
||||
chmod a+rwx /home/smbd
|
||||
fi
|
||||
start on network-interfaces/started
|
||||
stop on network-interfaces/stop
|
||||
|
||||
if ! test -d /var/samba ; then
|
||||
mkdir -p /var/samba/locks /var/samba/cores/nmbd /var/samba/cores/smbd /var/samba/cores/winbindd
|
||||
fi
|
||||
start script
|
||||
|
||||
${samba}/sbin/nmbd -D -s ${smbConfig} &
|
||||
${samba}/sbin/smbd -D -s ${smbConfig} &
|
||||
${samba}/sbin/winbindd -B -s ${smbConfig} &
|
||||
if ! test -d /home/smbd ; then
|
||||
mkdir -p /home/smbd
|
||||
chown ${user} /home/smbd
|
||||
chmod a+rwx /home/smbd
|
||||
fi
|
||||
|
||||
ln -fs ${smbConfig} /var/samba/config
|
||||
if ! test -d /var/samba ; then
|
||||
mkdir -p /var/samba/locks /var/samba/cores/nmbd /var/samba/cores/smbd /var/samba/cores/winbindd
|
||||
fi
|
||||
|
||||
end script
|
||||
${samba}/sbin/nmbd -D -s ${smbConfig} &
|
||||
${samba}/sbin/smbd -D -s ${smbConfig} &
|
||||
${samba}/sbin/winbindd -B -s ${smbConfig} &
|
||||
|
||||
respawn ${samba}/sbin/nmbd -D -s ${smbConfig} &; ${samba}/sbin/smbd -D -s ${smbConfig} &; ${samba}/sbin/winbindd -B &
|
||||
ln -fs ${smbConfig} /var/samba/config
|
||||
|
||||
";
|
||||
end script
|
||||
|
||||
respawn ${samba}/sbin/nmbd -D -s ${smbConfig} &; ${samba}/sbin/smbd -D -s ${smbConfig} &; ${samba}/sbin/winbindd -B &
|
||||
|
||||
'';
|
||||
}];
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user