1 { config, lib, pkgs, ... }:
6 cfg = config.security.please;
7 ini = pkgs.formats.ini { };
10 options.security.please = {
11 enable = mkEnableOption ''
12 please, a Sudo clone which allows a users to execute a command or edit a
16 package = mkPackageOption pkgs "please" { };
18 wheelNeedsPassword = mkOption {
22 Whether users of the `wheel` group must provide a password to run
23 commands or edit files with {command}`please` and
24 {command}`pleaseedit` respectively.
32 jim_run_any_as_root = {
39 jim_edit_etc_hosts_as_root = {
49 Please configuration. Refer to
50 <https://github.com/edneville/please/blob/master/please.ini.md> for
56 config = mkIf cfg.enable {
65 source = "${cfg.package}/bin/please";
66 inherit owner group setuid;
69 source = "${cfg.package}/bin/pleaseedit";
70 inherit owner group setuid;
74 security.please.settings = rec {
75 # The "wheel" group is allowed to do anything by default but this can be
83 require_pass = cfg.wheelNeedsPassword;
85 wheel_edit_as_any = wheel_run_as_any // { type = "edit"; };
86 wheel_list_as_any = wheel_run_as_any // { type = "list"; };
90 systemPackages = [ cfg.package ];
92 etc."please.ini".source = ini.generate "please.ini"
93 (cfg.settings // (rec {
94 # The "root" user is allowed to do anything by default and this cannot
101 require_pass = false;
103 root_edit_as_any = root_run_as_any // { type = "edit"; };
104 root_list_as_any = root_run_as_any // { type = "list"; };
108 security.pam.services.please = {
113 meta.maintainers = with maintainers; [ azahi ];