fix borg-server
This commit is contained in:
@@ -8,6 +8,12 @@
|
||||
in {
|
||||
options.services.borg-server = {
|
||||
enable = lib.mkEnableOption "Enable the borg server";
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = pkgs.borgbackup;
|
||||
example = "pkgs.borgbackup";
|
||||
description = "The borg package to use";
|
||||
};
|
||||
borg_user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
example = "borg";
|
||||
@@ -25,6 +31,7 @@ in {
|
||||
options = {
|
||||
name = lib.mkOption {
|
||||
type = lib.types.nullOr (lib.types.strMatching "^[a-zA-Z0-9._-]+$");
|
||||
default = null;
|
||||
example = "borg-repo";
|
||||
description = "The name of the borg repository. If null, use key of attrset";
|
||||
};
|
||||
@@ -45,11 +52,10 @@ in {
|
||||
home = cfg.repositories_path;
|
||||
createHome = true;
|
||||
extraGroups = ["borg"];
|
||||
openSSH.authorizedKeys.keys = builtins.attrValues (
|
||||
builtins.mapAttrs
|
||||
(key: repo: "command=\"${pkgs.borg}/bin/borg serve --restrict-to-path=${cfg.repositories_path}/${repo.name or key}\", restrict ${repo.ssh_public_key}")
|
||||
cfg.repositories
|
||||
);
|
||||
openssh.authorizedKeys.keys =
|
||||
lib.attrsets.mapAttrsToList
|
||||
(key: repo: "command=\"${cfg.package}/bin/borg serve --restrict-to-path=${cfg.repositories_path}/${lib.defaultTo key repo.name}\", restrict ${repo.ssh_public_key}")
|
||||
cfg.repositories;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user