ITADN

[Feature Request] Declarative flags for chromium based browsers

#9670OpenC10udburst 创建于 2026-07-17
feature request
C
C10udburstcommented
### Module Name chromium.nix ### Requested Feature An ability to specify chrome://flags inside nix configurations would be a useful addition since it is quite annoying to apply them on multiple devices by hand. ### Current Limitations Currently it is not possible to define flags from within home-manager or nix. adding cli flags like `--enable-features=` as some guides would suggest doesn't seem to work. ### Additional Context The way I do it [currently]((https://github.com/C10udburst/nixos/blob/master/modules/nixos/brave.nix)) involves using jq to modify `Local State` file, like so: ```nix ... flags = lib.mkOption { type = lib.types.listOf lib.types.str; default = [ "brave-dark-mode-block@2" "brave-history-embeddings@1" "brave-origin@1" "brave-tree-tab@1" "containers@1" "enable-parallel-downloading@1" "enable-quic@1" "middle-button-autoscroll@1" "smooth-scrolling@1" ]; description = "List of Brave flags (experiments) to enable declaratively"; }; ... systemd.user.services.brave-flags = { description = "Set Brave flags declaratively"; wantedBy = ["default.target"]; script = '' STATE_FILE="$HOME/.config/BraveSoftware/Brave-Browser/Local State" mkdir -p "$(dirname "$STATE_FILE")" if [ ! -f "$STATE_FILE" ]; then echo "{}" > "$STATE_FILE" fi ${pkgs.jq}/bin/jq '.browser.enabled_labs_experiments = $flags' \ --argjson flags '${builtins.toJSON cfg.flags}' \ "$STATE_FILE" > "$STATE_FILE.tmp" && mv "$STATE_FILE.tmp" "$STATE_FILE" ''; }; ``` but I doubt this is the cleanest solution to this problem.
0 条评论