fix borg-server
This commit is contained in:
parent
0f1eba14b6
commit
2f1b912aa3
@ -6,6 +6,7 @@
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
../../modules/services/nextcloud-instance.nix
|
||||
../../modules/services/borg-server.nix
|
||||
];
|
||||
|
||||
# Secret management
|
||||
@ -53,7 +54,7 @@
|
||||
services.nextcloud-instance.instanceFQDN = "nextcloud.jroeger.de";
|
||||
|
||||
services.borg-server.enable = true;
|
||||
services.borg-server.repositories.comfy-station.ssh_public_key = builtins.readFile (../../static/keys/ + "borg-jonas@comfy-station.pub");
|
||||
services.borg-server.repositories.comfy-station.ssh_public_key = builtins.readFile (../../static/keys + "/borg-jonas@comfy-station.pub");
|
||||
|
||||
# Allow unfree packages
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
@ -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;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user