blob: 424d9d72e5334087df7476ac9496f2cd3eb6a3d8 [file] [log] [blame]
Skyler Greyf08a6192024-06-01 23:55:20 +00001# SPDX-FileCopyrightText: 2024 Auxolotl Infrastructure Contributors
2# SPDX-FileCopyrightText: 2024 Clicks Codes
3#
4# SPDX-License-Identifier: GPL-3.0-only
5
6{
7 lib,
8 pkgs,
9 config,
10 ...
11}:
12let
13 cfg = config.clicks.security.doas;
14in
15{
16 options.clicks.security.doas = {
17 enable = lib.mkEnableOption "doas";
18 };
19
20 config = lib.mkIf cfg.enable {
21 security.sudo.enable = false;
22
23 security.doas = {
24 enable = true;
25 extraRules = [
26 {
27 users = config.clicks.users.deployers;
28 noPass = true;
29 keepEnv = true;
30 }
31 ];
32 };
33
34 environment.shellAliases = {
35 sudo = "${config.security.wrapperDir}/${config.security.wrappers.doas.program}";
36 };
37 };
38}