blob: 66fc8ce85faa395437e5d5e9ded2f580d3271182 [file] [log] [blame]
Skyler Grey05e11c12024-06-15 00:02:15 +00001# SPDX-FileCopyrightText: 2024 Clicks Codes
2#
3# SPDX-License-Identifier: GPL-3.0-only
4
5{ lib, config, ... }: let
6 cfg = config.clicks.backups;
7in {
8 options = {
9 clicks.backups = {
10 key = lib.mkOption {
11 type = lib.types.str;
12 description = "The public key to use for backups";
13 };
14 enable = lib.mkOption {
15 type = lib.types.bool;
16 default = true;
17 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";
18 };
19 };
20 };
21
22 config = lib.mkIf cfg.enable {
23 clicks.users.backups = ["backups"];
24
25 users.users.backups = {
26 isNormalUser = true;
27 group = "backups";
28
29 extraGroups = ["wheel"];
30
31 openssh.authorizedKeys.keys = [
32 cfg.key
33 ];
34 };
35
36 users.groups.backups = { };
37 };
38}