Fix infinite recursion when _module.args.lib depends on nixpkgs.overlays (#58)

This commit is contained in:
Luc Chabassier 2023-03-10 15:25:25 +01:00 committed by GitHub
parent efb734ff43
commit 679a806768
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,12 +1,19 @@
{ pkgs, config, lib, ... }: { pkgs, config, ... }:
with lib; let
# We use this imported lib instead of the one from the module arguments
{ # to avoid infinite loops if the lib in arguments depends on nixpkgs.overlays
lib = (builtins.getFlake "github:nix-community/nixpkgs.lib/c9d4f2476046c6a7a2ce3c2118c48455bf0272ea").lib;
in {
options.stylix.targets.gnome.enable = options.stylix.targets.gnome.enable =
config.lib.stylix.mkEnableTarget "GNOME" config.services.xserver.desktopManager.gnome.enable; lib.mkOption {
description = "Whether to style GNOME";
type = lib.types.bool;
default = config.stylix.autoEnable
&& config.services.xserver.desktopManager.gnome.enable;
};
config = mkIf config.stylix.targets.gnome.enable { config = lib.mkIf config.stylix.targets.gnome.enable {
# As Stylix is controlling the wallpaper, there is no need for this # As Stylix is controlling the wallpaper, there is no need for this
# pack of default wallpapers to be installed. # pack of default wallpapers to be installed.
# If you want to use one, you can set stylix.image to something like # If you want to use one, you can set stylix.image to something like
@ -18,7 +25,7 @@ with lib;
gnome = super.gnome.overrideScope' (gnomeSelf: gnomeSuper: { gnome = super.gnome.overrideScope' (gnomeSelf: gnomeSuper: {
gnome-shell = gnomeSuper.gnome-shell.overrideAttrs (oldAttrs: { gnome-shell = gnomeSuper.gnome-shell.overrideAttrs (oldAttrs: {
postFixup = postFixup =
let theme = import ./theme.nix { inherit pkgs config; }; let theme = import ./theme.nix { inherit config; pkgs = super; };
in '' in ''
cp ${theme}/share/gnome-shell/gnome-shell-theme.gresource \ cp ${theme}/share/gnome-shell/gnome-shell-theme.gresource \
$out/share/gnome-shell/gnome-shell-theme.gresource $out/share/gnome-shell/gnome-shell-theme.gresource