1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7let
8 cfg = config.security.chromiumSuidSandbox;
9 sandbox = pkgs.chromium.sandbox;
10in
11{
12 imports = [
13 (lib.mkRenamedOptionModule
14 [ "programs" "unity3d" "enable" ]
15 [ "security" "chromiumSuidSandbox" "enable" ]
16 )
17 ];
18
19 options.security.chromiumSuidSandbox.enable = lib.mkOption {
20 type = lib.types.bool;
21 default = false;
22 description = ''
23 Whether to install the Chromium SUID sandbox which is an executable that
24 Chromium may use in order to achieve sandboxing.
25
26 If you get the error "The SUID sandbox helper binary was found, but is not
27 configured correctly.", turning this on might help.
28
29 Also, if the URL chrome://sandbox tells you that "You are not adequately
30 sandboxed!", turning this on might resolve the issue.
31 '';
32 };
33
34 config = lib.mkIf cfg.enable {
35 environment.systemPackages = [ sandbox ];
36 security.wrappers.${sandbox.passthru.sandboxExecutableName} = {
37 setuid = true;
38 owner = "root";
39 group = "root";
40 source = "${sandbox}/bin/${sandbox.passthru.sandboxExecutableName}";
41 };
42 };
43}