mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-12-03 03:10:22 +00:00
nixos/brave: system-wide brave module/options (#469315)
This commit is contained in:
@@ -32,6 +32,8 @@
|
||||
|
||||
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
||||
|
||||
- [Brave](https://brave.com), a Chromium-based web browser. Available as [programs.brave](#opt-programs.brave.enable). Note that if you were previously configuring Brave via [programs.chromium](#opt-programs.chromium.enable), you can only use one of the two modules; using `programs.brave` is recommended.
|
||||
|
||||
- Management of `$XDG_*_HOME` environment variables from [XDG Base Directory specification](https://specifications.freedesktop.org/basedir-spec/latest/). Available as [xdg.directories](#opt-xdg.directories.enable).
|
||||
|
||||
- Enable [Dux Calendar](#opt-programs.dux-calendar.enable):
|
||||
|
||||
@@ -185,6 +185,7 @@
|
||||
./programs/bazecor.nix
|
||||
./programs/bcc.nix
|
||||
./programs/benchexec.nix
|
||||
./programs/brave.nix
|
||||
./programs/browserpass.nix
|
||||
./programs/btrfs-heatmap.nix
|
||||
./programs/calls.nix
|
||||
|
||||
67
nixos/modules/programs/brave.nix
Normal file
67
nixos/modules/programs/brave.nix
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.programs.brave;
|
||||
|
||||
defaultProfile = lib.filterAttrs (_: v: v != null) {
|
||||
ExtensionInstallForcelist = cfg.extensions;
|
||||
};
|
||||
|
||||
braveEtcConfig = {
|
||||
# Managed (enterprise) policy files
|
||||
"brave/policies/managed/default.json" = lib.mkIf (defaultProfile != { }) {
|
||||
text = builtins.toJSON defaultProfile;
|
||||
};
|
||||
|
||||
"brave/policies/managed/extra.json" = lib.mkIf (cfg.policies != { }) {
|
||||
text = builtins.toJSON cfg.policies;
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
options.programs.brave = {
|
||||
enable = lib.mkEnableOption "the Brave web browser";
|
||||
|
||||
package = lib.mkPackageOption pkgs "brave" {
|
||||
default = [ "brave" ];
|
||||
};
|
||||
|
||||
extensions = lib.mkOption {
|
||||
type = with lib.types; nullOr (listOf str);
|
||||
default = null;
|
||||
description = ''
|
||||
List of Brave (Chromium-style) extensions to force-install.
|
||||
These work the same way as Chromium extensions: a Chrome Web Store ID,
|
||||
optionally followed by `;url-to-update-manifest.xml`.
|
||||
'';
|
||||
};
|
||||
|
||||
policies = lib.mkOption {
|
||||
type = lib.types.attrs;
|
||||
default = { };
|
||||
description = ''
|
||||
Additional Brave Enterprise policy settings.
|
||||
These follow the same format as Chromium policies:
|
||||
<https://support.brave.app/hc/en-us/articles/360039248271-Group-Policy>
|
||||
'';
|
||||
example = {
|
||||
SyncDisabled = true;
|
||||
MetricsReportingEnabled = false;
|
||||
BraveRewardsDisabled = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment = {
|
||||
etc = braveEtcConfig;
|
||||
systemPackages = [ cfg.package ];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user