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 = {
|
ircdHybrid = {
|
||||||
|
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
@ -983,6 +971,7 @@ in
|
|||||||
(import ../upstart-jobs/vsftpd.nix)
|
(import ../upstart-jobs/vsftpd.nix)
|
||||||
(import ../upstart-jobs/cupsd.nix) # CUPS printing daemon
|
(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/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
|
# nix
|
||||||
(import ../upstart-jobs/nix.nix) # nix options and daemon
|
(import ../upstart-jobs/nix.nix) # nix options and daemon
|
||||||
|
@ -149,13 +149,6 @@ let
|
|||||||
inherit config pkgs;
|
inherit config pkgs;
|
||||||
})
|
})
|
||||||
|
|
||||||
# Samba service.
|
|
||||||
++ optional config.services.samba.enable
|
|
||||||
(import ../upstart-jobs/samba.nix {
|
|
||||||
inherit pkgs;
|
|
||||||
inherit (pkgs) glibc samba;
|
|
||||||
})
|
|
||||||
|
|
||||||
# X Font Server
|
# X Font Server
|
||||||
++ optional config.services.xfs.enable
|
++ optional config.services.xfs.enable
|
||||||
(import ../upstart-jobs/xfs.nix {
|
(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
|
let
|
||||||
|
|
||||||
@ -7,52 +29,65 @@ let
|
|||||||
|
|
||||||
smbConfig = ./smb.conf ;
|
smbConfig = ./smb.conf ;
|
||||||
|
|
||||||
|
inherit (pkgs) samba;
|
||||||
|
|
||||||
in
|
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
|
services = {
|
||||||
stop on network-interfaces/stop
|
extraJobs = [{
|
||||||
|
name = "samba";
|
||||||
|
job = ''
|
||||||
|
|
||||||
start script
|
description "Samba Service"
|
||||||
|
|
||||||
if ! test -d /home/smbd ; then
|
start on network-interfaces/started
|
||||||
mkdir -p /home/smbd
|
stop on network-interfaces/stop
|
||||||
chown ${user} /home/smbd
|
|
||||||
chmod a+rwx /home/smbd
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! test -d /var/samba ; then
|
start script
|
||||||
mkdir -p /var/samba/locks /var/samba/cores/nmbd /var/samba/cores/smbd /var/samba/cores/winbindd
|
|
||||||
fi
|
|
||||||
|
|
||||||
${samba}/sbin/nmbd -D -s ${smbConfig} &
|
if ! test -d /home/smbd ; then
|
||||||
${samba}/sbin/smbd -D -s ${smbConfig} &
|
mkdir -p /home/smbd
|
||||||
${samba}/sbin/winbindd -B -s ${smbConfig} &
|
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…
x
Reference in New Issue
Block a user