Skyler Grey | 05e11c1 | 2024-06-15 00:02:15 +0000 | [diff] [blame] | 1 | # SPDX-FileCopyrightText: 2024 Clicks Codes |
| 2 | # |
| 3 | # SPDX-License-Identifier: GPL-3.0-only |
| 4 | |
| 5 | { lib, config, ... }: let |
| 6 | cfg = config.clicks.backups; |
| 7 | in { |
| 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; |
Skyler Grey | 4bf2de5 | 2024-07-29 17:55:05 +0000 | [diff] [blame^] | 16 | default = config.clicks.defaults.enable; |
Skyler Grey | 05e11c1 | 2024-06-15 00:02:15 +0000 | [diff] [blame] | 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 | } |