stylix icon indicating copy to clipboard operation
stylix copied to clipboard

stylix: incompatible with `home-manager.useGlobalPkgs`

Open blackxored opened this issue 4 months ago • 3 comments

I assert that this issue is relevant for Stylix

  • [x] I assert that this is a bug and not a user error or support request.
  • [x] I assert that this is not a duplicate of an existing issue.

Description

You get this warning if you have home-manager.useGlobalPkgs in your config:

You have set either `nixpkgs.config` or `nixpkgs.overlays` while using `home-manager.useGlobalPkgs`.
This will soon not be possible. Please remove all `nixpkgs` options when using `home-manager.useGlobalPkgs`.

Very brief inspection points to the stylix/overlays target.

flake.lock

flake.lock

github:nix-community/stylix/63bb34a66ad7d1af2e95ee20dd675896b2074c32?narHash=sha256-OpC9/PBIuL2WEJUkcuD/wVxI8r%2B3o6f5RylSIefjHo4%3D' (2025-08-07)

Installation Method

nix-darwin

System Information

  • host os: Darwin 25.0.0, macOS 26.0
  • multi-user?: yes
  • sandbox: no
  • version: nix-env (Nix) 2.28.4
  • nixpkgs: /nix/store/4danq4f7rxpsax7bx18709c533v9krii-source

Notify maintainers

No response

blackxored avatar Aug 08 '25 20:08 blackxored

this should be handled by https://github.com/nix-community/stylix/blob/master/stylix/home-manager-integration.nix#L221-L223, but you can manual fix this by setting stylix.overlays.enable to false in your home-manager config.

0xda157 avatar Aug 08 '25 21:08 0xda157

It might be because I'm using a set of modules and evaluation weirdness? I wasn't able to use stylix options in my home manager modules so I had to include both the nix-darwin module and the home module. Something to this effect:

nix-darwin.lib.darwinSystem {
    modules = [
      self.darwinModules.mine
      home-manager.darwinModules.home-manager
      {
        home-manager.useGlobalPkgs = true;
        home-manager.useUserPackages = true;
        home-manager.users.xored = ./home.nix;
        home-manager.extraSpecialArgs = {inherit inputs;};
      }
      stylix.darwinModules.stylix
    ];
}

home.nix includes my flake's home modules:

imports = [
  self.homeManagerModules.mine
];

and then my stylix module was forced to pull HM module otherwise it didn't recognize the stylix option

imports = [
  inputs.stylix.homeModules.stylix
]
config = {
  stylix = {...}
}

Nevertheless, I look at that code and that seems to indeed account for this issue, so I'm not sure why it happens.

blackxored avatar Aug 08 '25 21:08 blackxored

Nevertheless, I look at that code and that seems to indeed account for this issue, so I'm not sure why it happens.

AFAIK that code only takes effect when Stylix's Home Manager module is being automatically loaded by our NixOS/Darwin module, not when it's imported manually.

danth avatar Aug 26 '25 11:08 danth