1 { config, lib, pkgs, ... }:
6 cfg = config.security.please;
7 ini = pkgs.formats.ini { };
10 options.security.please = {
11 enable = mkEnableOption (mdDoc ''
12 please, a Sudo clone which allows a users to execute a command or edit a
18 default = pkgs.please;
19 defaultText = literalExpression "pkgs.please";
20 description = mdDoc ''
21 Which package to use for {command}`please`.
25 wheelNeedsPassword = mkOption {
28 description = lib.mdDoc ''
29 Whether users of the `wheel` group must provide a password to run
30 commands or edit files with {command}`please` and
31 {command}`pleaseedit` respectively.
39 jim_run_any_as_root = {
46 jim_edit_etc_hosts_as_root = {
55 description = mdDoc ''
56 Please configuration. Refer to
57 <https://github.com/edneville/please/blob/master/please.ini.md> for
63 config = mkIf cfg.enable {
72 source = "${cfg.package}/bin/please";
73 inherit owner group setuid;
76 source = "${cfg.package}/bin/pleaseedit";
77 inherit owner group setuid;
81 security.please.settings = rec {
82 # The "wheel" group is allowed to do anything by default but this can be
90 require_pass = cfg.wheelNeedsPassword;
92 wheel_edit_as_any = wheel_run_as_any // { type = "edit"; };
93 wheel_list_as_any = wheel_run_as_any // { type = "list"; };
97 systemPackages = [ cfg.package ];
99 etc."please.ini".source = ini.generate "please.ini"
100 (cfg.settings // (rec {
101 # The "root" user is allowed to do anything by default and this cannot
108 require_pass = false;
110 root_edit_as_any = root_run_as_any // { type = "edit"; };
111 root_list_as_any = root_run_as_any // { type = "list"; };
115 security.pam.services.please = {
120 meta.maintainers = with maintainers; [ azahi ];