@ -46,6 +46,13 @@ in {
'' ;
} ;
socketActivated = mkOption {
default = false ;
type = types . bool ;
description =
" I f e n a b l e d R s y n c w i l l b e s o c k e t - a c t i v a t e d r a t h e r t h a n r u n p e r s i s t e n t l y . " ;
} ;
} ;
} ;
@ -63,12 +70,55 @@ in {
services . rsyncd . settings . global . port = toString cfg . port ;
systemd . services . rsyncd = {
description = " R s y n c d a e m o n " ;
wantedBy = [ " m u l t i - u s e r . t a r g e t " ] ;
serviceConfig . ExecStart =
" ${ pkgs . rsync } / b i n / r s y n c - - d a e m o n - - n o - d e t a c h - - c o n f i g = ${ configFile } " ;
systemd = let
serviceConfigSecurity = {
ProtectSystem = " f u l l " ;
PrivateDevices = " o n " ;
NoNewPrivileges = " o n " ;
} ;
in {
services . rsync = {
enable = ! cfg . socketActivated ;
aliases = [ " r s y n c d " ] ;
description = " f a s t r e m o t e f i l e c o p y p r o g r a m d a e m o n " ;
after = [ " n e t w o r k . t a r g e t " ] ;
documentation = [ " m a n : r s y n c ( 1 ) " " m a n : r s y n c d . c o n f ( 5 ) " ] ;
serviceConfig = serviceConfigSecurity // {
ExecStart =
" ${ pkgs . rsync } / b i n / r s y n c - - d a e m o n - - n o - d e t a c h - - c o n f i g = ${ configFile } " ;
RestartSec = 1 ;
} ;
wantedBy = [ " m u l t i - u s e r . t a r g e t " ] ;
} ;
services . " r s y n c @ " = {
description = " f a s t r e m o t e f i l e c o p y p r o g r a m d a e m o n " ;
after = [ " n e t w o r k . t a r g e t " ] ;
serviceConfig = serviceConfigSecurity // {
ExecStart = " ${ pkgs . rsync } / b i n / r s y n c - - d a e m o n - - c o n f i g = ${ configFile } " ;
StandardInput = " s o c k e t " ;
StandardOutput = " i n h e r i t " ;
StandardError = " j o u r n a l " ;
} ;
} ;
sockets . rsync = {
enable = cfg . socketActivated ;
description = " s o c k e t f o r f a s t r e m o t e f i l e c o p y p r o g r a m d a e m o n " ;
conflicts = [ " r s y n c . s e r v i c e " ] ;
listenStreams = [ ( toString cfg . port ) ] ;
socketConfig . Accept = true ;
wantedBy = [ " s o c k e t s . t a r g e t " ] ;
} ;
} ;
} ;
meta . maintainers = with lib . maintainers ; [ ehmry ] ;