blob: 913858983922643d09605ce0420ba367b4087ae7 [file] [log] [blame]
# SPDX-FileCopyrightText: 2024 Clicks Codes
#
# SPDX-License-Identifier: GPL-3.0-only
{ lib, config, ... }: let
cfg = config.clicks.backups;
in {
options = {
clicks.backups = {
key = lib.mkOption {
type = lib.types.str;
description = "The public key to use for backups";
};
enable = lib.mkOption {
type = lib.types.bool;
default = config.clicks.defaults.enable;
description = "It is mandatory for any Clicks server to have the backups enabled, please only disable this if you are backing up in a different way";
};
};
};
config = lib.mkIf cfg.enable {
clicks.users.backups = ["backups"];
users.users.backups = {
isNormalUser = true;
group = "backups";
extraGroups = ["wheel"];
openssh.authorizedKeys.keys = [
cfg.key
];
};
users.groups.backups = { };
};
}