mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
nixos/services.duplicati: remove with lib;
This commit is contained in:
parent
ef50268985
commit
699a0f8601
1 changed files with 13 additions and 16 deletions
|
@ -1,27 +1,24 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
with lib;
|
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.services.duplicati;
|
cfg = config.services.duplicati;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
services.duplicati = {
|
services.duplicati = {
|
||||||
enable = mkEnableOption "Duplicati";
|
enable = lib.mkEnableOption "Duplicati";
|
||||||
|
|
||||||
package = mkPackageOption pkgs "duplicati" { };
|
package = lib.mkPackageOption pkgs "duplicati" { };
|
||||||
|
|
||||||
port = mkOption {
|
port = lib.mkOption {
|
||||||
default = 8200;
|
default = 8200;
|
||||||
type = types.port;
|
type = lib.types.port;
|
||||||
description = ''
|
description = ''
|
||||||
Port serving the web interface
|
Port serving the web interface
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
dataDir = mkOption {
|
dataDir = lib.mkOption {
|
||||||
type = types.str;
|
type = lib.types.str;
|
||||||
default = "/var/lib/duplicati";
|
default = "/var/lib/duplicati";
|
||||||
description = ''
|
description = ''
|
||||||
The directory where Duplicati stores its data files.
|
The directory where Duplicati stores its data files.
|
||||||
|
@ -34,18 +31,18 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
interface = mkOption {
|
interface = lib.mkOption {
|
||||||
default = "127.0.0.1";
|
default = "127.0.0.1";
|
||||||
type = types.str;
|
type = lib.types.str;
|
||||||
description = ''
|
description = ''
|
||||||
Listening interface for the web UI
|
Listening interface for the web UI
|
||||||
Set it to "any" to listen on all available interfaces
|
Set it to "any" to listen on all available interfaces
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
user = mkOption {
|
user = lib.mkOption {
|
||||||
default = "duplicati";
|
default = "duplicati";
|
||||||
type = types.str;
|
type = lib.types.str;
|
||||||
description = ''
|
description = ''
|
||||||
Duplicati runs as it's own user. It will only be able to backup world-readable files.
|
Duplicati runs as it's own user. It will only be able to backup world-readable files.
|
||||||
Run as root with special care.
|
Run as root with special care.
|
||||||
|
@ -54,21 +51,21 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
environment.systemPackages = [ cfg.package ];
|
environment.systemPackages = [ cfg.package ];
|
||||||
|
|
||||||
systemd.services.duplicati = {
|
systemd.services.duplicati = {
|
||||||
description = "Duplicati backup";
|
description = "Duplicati backup";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig = mkMerge [
|
serviceConfig = lib.mkMerge [
|
||||||
{
|
{
|
||||||
User = cfg.user;
|
User = cfg.user;
|
||||||
Group = "duplicati";
|
Group = "duplicati";
|
||||||
ExecStart = "${cfg.package}/bin/duplicati-server --webservice-interface=${cfg.interface} --webservice-port=${toString cfg.port} --server-datafolder=${cfg.dataDir}";
|
ExecStart = "${cfg.package}/bin/duplicati-server --webservice-interface=${cfg.interface} --webservice-port=${toString cfg.port} --server-datafolder=${cfg.dataDir}";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
}
|
}
|
||||||
(mkIf (cfg.dataDir == "/var/lib/duplicati") {
|
(lib.mkIf (cfg.dataDir == "/var/lib/duplicati") {
|
||||||
StateDirectory = "duplicati";
|
StateDirectory = "duplicati";
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue