mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-12 05:16:25 +03:00
commit
3ee1adcf6e
9 changed files with 9 additions and 378 deletions
|
@ -1,73 +0,0 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.services.crashplansb;
|
||||
crashplansb = pkgs.crashplansb.override { maxRam = cfg.maxRam; };
|
||||
in
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
options = {
|
||||
services.crashplansb = {
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Starts crashplan for small business background service.
|
||||
'';
|
||||
};
|
||||
maxRam = mkOption {
|
||||
default = "1024m";
|
||||
example = "2G";
|
||||
type = types.str;
|
||||
description = ''
|
||||
Maximum amount of ram that the crashplan engine should use.
|
||||
'';
|
||||
};
|
||||
openPorts = mkOption {
|
||||
description = "Open ports in the firewall for crashplan.";
|
||||
default = true;
|
||||
type = types.bool;
|
||||
};
|
||||
ports = mkOption {
|
||||
# https://support.code42.com/Administrator/6/Planning_and_installing/TCP_and_UDP_ports_used_by_the_Code42_platform
|
||||
# used ports can also be checked in the desktop app console using the command connection.info
|
||||
description = "which ports to open.";
|
||||
default = [ 4242 4243 4244 4247 ];
|
||||
type = types.listOf types.int;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [ crashplansb ];
|
||||
networking.firewall.allowedTCPPorts = mkIf cfg.openPorts cfg.ports;
|
||||
|
||||
systemd.services.crashplansb = {
|
||||
description = "CrashPlan Backup Engine";
|
||||
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" "local-fs.target" ];
|
||||
|
||||
preStart = ''
|
||||
install -d -m 755 ${crashplansb.vardir}
|
||||
install -d -m 700 ${crashplansb.vardir}/conf
|
||||
install -d -m 700 ${crashplansb.manifestdir}
|
||||
install -d -m 700 ${crashplansb.vardir}/cache
|
||||
install -d -m 700 ${crashplansb.vardir}/backupArchives
|
||||
install -d -m 777 ${crashplansb.vardir}/log
|
||||
cp -avn ${crashplansb}/conf.template/* ${crashplansb.vardir}/conf
|
||||
'';
|
||||
|
||||
serviceConfig = {
|
||||
Type = "forking";
|
||||
EnvironmentFile = "${crashplansb}/bin/run.conf";
|
||||
ExecStart = "${crashplansb}/bin/CrashPlanEngine start";
|
||||
ExecStop = "${crashplansb}/bin/CrashPlanEngine stop";
|
||||
PIDFile = "${crashplansb.vardir}/CrashPlanEngine.pid";
|
||||
WorkingDirectory = crashplansb;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.services.crashplan;
|
||||
crashplan = pkgs.crashplan;
|
||||
in
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
options = {
|
||||
services.crashplan = {
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Starts crashplan background service.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [ crashplan ];
|
||||
|
||||
systemd.services.crashplan = {
|
||||
description = "CrashPlan Backup Engine";
|
||||
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" "local-fs.target" ];
|
||||
|
||||
preStart = ''
|
||||
ensureDir() {
|
||||
dir=$1
|
||||
mode=$2
|
||||
|
||||
if ! test -e $dir; then
|
||||
${pkgs.coreutils}/bin/mkdir -m $mode -p $dir
|
||||
elif [ "$(${pkgs.coreutils}/bin/stat -c %a $dir)" != "$mode" ]; then
|
||||
${pkgs.coreutils}/bin/chmod $mode $dir
|
||||
fi
|
||||
}
|
||||
|
||||
ensureDir ${crashplan.vardir} 755
|
||||
ensureDir ${crashplan.vardir}/conf 700
|
||||
ensureDir ${crashplan.manifestdir} 700
|
||||
ensureDir ${crashplan.vardir}/cache 700
|
||||
ensureDir ${crashplan.vardir}/backupArchives 700
|
||||
ensureDir ${crashplan.vardir}/log 777
|
||||
cp -avn ${crashplan}/conf.template/* ${crashplan.vardir}/conf
|
||||
for x in app.asar bin install.vars lang lib libc42archive64.so libc52archive.so libjniwrap64.so libjniwrap.so libjtux64.so libjtux.so libleveldb64.so libleveldb.so libmd564.so libmd5.so share skin upgrade; do
|
||||
rm -f ${crashplan.vardir}/$x;
|
||||
ln -sf ${crashplan}/$x ${crashplan.vardir}/$x;
|
||||
done
|
||||
'';
|
||||
|
||||
serviceConfig = {
|
||||
Type = "forking";
|
||||
EnvironmentFile = "${crashplan}/bin/run.conf";
|
||||
ExecStart = "${crashplan}/bin/CrashPlanEngine start";
|
||||
ExecStop = "${crashplan}/bin/CrashPlanEngine stop";
|
||||
PIDFile = "${crashplan.vardir}/CrashPlanEngine.pid";
|
||||
WorkingDirectory = crashplan;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue