rsync updated 3.0.9 to 3.1.0, rsyncd service module

wip/yesman
Emery Hemingway 10 years ago
parent 1296372681
commit 93e9154805
  1. 1
      nixos/modules/module-list.nix
  2. 139
      nixos/modules/services/network-filesystems/rsyncd.nix
  3. 13
      pkgs/applications/networking/sync/rsync/default.nix

@ -159,6 +159,7 @@
./services/network-filesystems/drbd.nix
./services/network-filesystems/nfsd.nix
./services/network-filesystems/openafs-client/default.nix
./services/network-filesystems/rsyncd.nix
./services/network-filesystems/samba.nix
./services/networking/amuled.nix
./services/networking/avahi-daemon.nix

@ -0,0 +1,139 @@
{ config, pkgs, ... }:
with pkgs.lib;
let
cfg = config.services.rsyncd;
motdFile = pkgs.writeText "rsyncd-motd" cfg.motd;
rsyncdCfg = ""
+ optionalString (cfg.motd != "") "motd file = ${motdFile}\n"
+ optionalString (cfg.address != "") "address = ${cfg.address}\n"
+ optionalString (cfg.port != 873) "port = ${toString cfg.port}\n"
+ cfg.extraConfig
+ "\n"
+ flip concatMapStrings cfg.modules (m: "[${m.name}]\n\tpath = ${m.path}\n"
+ optionalString (m.comment != "") "\tcomment = ${m.comment}\n"
+ m.extraConfig
+ "\n"
);
rsyncdCfgFile = pkgs.writeText "rsyncd.conf" rsyncdCfg;
in
{
options = {
services.rsyncd = {
enable = mkOption {
default = false;
description = "Whether to enable the rsync daemon.";
};
motd = mkOption {
type = types.string;
default = "";
description = ''
Message of the day to display to clients on each connect.
This usually contains site information and any legal notices.
'';
};
port = mkOption {
default = 873;
type = types.int;
description = "TCP port the daemon will listen on.";
};
address = mkOption {
default = "";
example = "192.168.1.2";
description = ''
IP address the daemon will listen on; rsyncd will listen on
all addresses if this is not specified.
'';
};
extraConfig = mkOption {
type = types.lines;
default = "";
description = ''
Lines of configuration to add to rsyncd globally.
See <literal>man rsyncd.conf</literal> for more options.
'';
};
modules = mkOption {
default = [ ];
example = [
{ name = "ftp";
path = "/home/ftp";
comment = "ftp export area";
extraConfig = ''
secrets file = /etc/rsyncd.secrets
'';
}
];
description = "The list of file paths to export.";
type = types.listOf types.optionSet;
options = {
name = mkOption {
example = "ftp";
type = types.string;
description = "Name of export module.";
};
comment = mkOption {
default = "";
description = ''
Description string that is displayed next to the module name
when clients obtain a list of available modules.
'';
};
path = mkOption {
example = "/home/ftp";
type = types.string;
description = "Directory to make available in this module.";
};
extraConfig = mkOption {
type = types.lines;
default = "";
description = ''
Lines of configuration to add to this module.
See <literal>man rsyncd.conf</literal> for more options.
'';
};
};
};
};
};
###### implementation
config = mkIf cfg.enable {
environment.etc = singleton
{ source = rsyncdCfgFile;
target = "rsyncd.conf";
};
systemd.services.rsyncd = {
description = "Rsync daemon";
wantedBy = [ "multi-user.target" ];
path = [ pkgs.rsync ];
serviceConfig.ExecStart = "${pkgs.rsync}/bin/rsync --daemon --no-detach";
};
networking.firewall.allowedTCPPorts = [ cfg.port ];
};
}

@ -6,16 +6,17 @@
assert enableACLs -> acl != null;
stdenv.mkDerivation rec {
name = "rsync-3.0.9";
name = "rsync-${version}";
version = "3.1.0";
mainSrc = fetchurl {
url = http://rsync.samba.org/ftp/rsync/src/rsync-3.0.9.tar.gz;
sha256 = "01bw4klqsrlhh3i9lazd485sd9qx5djvnwa21lj2h3a9sn6hzw9h";
url = "http://rsync.samba.org/ftp/rsync/src/rsync-${version}.tar.gz";
sha256 = "0kirw8wglqvwi1v8bwxp373g03xg857h59j5k3mmgff9gzvj7jl1";
};
patchesSrc = fetchurl {
url = http://rsync.samba.org/ftp/rsync/rsync-patches-3.0.9.tar.gz;
sha256 = "0c1e9b56e99667dfc47641124460bac61a04c5d2ee89f575c6bc78c7a69005a9";
url = "http://rsync.samba.org/ftp/rsync/rsync-patches-${version}.tar.gz";
sha256 = "0sl8aadpjblvbb05vgais40z90yzhr09rwz0cykjdiv452gli75p";
};
srcs = [mainSrc] ++ stdenv.lib.optional enableCopyDevicesPatch patchesSrc;
@ -30,6 +31,6 @@ stdenv.mkDerivation rec {
license = stdenv.lib.licenses.gpl3Plus;
platforms = stdenv.lib.platforms.unix;
maintainers = [ stdenv.lib.maintainers.simons ];
maintainers = [ stdenv.lib.maintainers.simons stdenv.lib.maintainers.emery ];
};
}

Loading…
Cancel
Save