nix-community / home-manager

Manage a user environment using Nix [maintainer=@rycee]
https://nix-community.github.io/home-manager/
MIT License
7.08k stars 1.83k forks source link

bug: config.lib.nixGL.wrap overrides programs.chromium.commandLineArgs #6016

Open DamienCassou opened 2 weeks ago

DamienCassou commented 2 weeks ago

Are you following the right branch?

Is there an existing issue for this?

Issue description

In #5355, @Smona, @vigress8, @rycee, @exzombie and a few others collaborated to add the nixGL modules. This is great as it simplifies my configuration. Thank you very much.

Nevertheless, the support for Chromium seems problematic.

Here is an example configuration:

{
  programs.chromium = {
    enable = true;
    package = config.lib.nixGL.wrap pkgs.ungoogled-chromium;
    commandLineArgs = [
      "--extension-mime-request-handling=always-prompt-for-install"
      "--enable-features=ClearDataOnExit"
      "--no-default-browser-check"
      "--incognito"
    ];
  };
}

This generates a chromium executable script which doesn't contain my commandLineArgs anymore.

Workaround: remove config.lib.nixGL.wrap from programs.chromium.package to get the command line arguments back.

Maintainer CC

@Smona

System information

- system: `"x86_64-linux"`
 - host os: `Linux 6.11.4-201.fc40.x86_64, Fedora Linux, 40 (Workstation Edition), nobuild`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.24.9`
 - channels(root): `"nixpkgs"`
 - channels(temp): `"home-manager, nixpxkgs"`
 - channels(cassou): `"home-manager-22.11.tar.gz, nixpkgs"`
 - nixpkgs: `/home/cassou/Documents/projects/nix-system/nixpkgs`
Smona commented 2 weeks ago

Looks like this would happen because the commandLineArgs are added in the buildCommand of chromium, which is overridden by the nixGL wrapper. We may need to try and extend the buildCommand instead of replacing it to fix this in all cases, but we'll have to see if that triggers a bunch of long package builds. Hopefully we won't have to implement a special case for wrapper packages like this one.

Smona commented 2 weeks ago

I wonder if we could override override on the wrapper derivation returned by nixGL.wrap, so that it basically maps (nixGL.wrap pkg).override { args } to (nixGL.wrap (pkg.override { args })).