Skip to content

gnome: use overlay.nix #1346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions modules/gnome/nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@
config,
...
}:

let
theme = pkgs.callPackage ./theme.nix {
inherit (config.lib.stylix) colors;
inherit (config.stylix) inputs;
};

in
{
options.stylix.targets.gnome.enable =
config.lib.stylix.mkEnableTarget "GNOME and GDM" true;
Expand All @@ -34,25 +26,6 @@ in
# which will then download the pack regardless of its exclusion below.
environment.gnome.excludePackages = [ pkgs.gnome-backgrounds ];

nixpkgs.overlays = [
(_: super: {
gnome-shell = super.gnome-shell.overrideAttrs (oldAttrs: {
# Themes are usually applied via an extension, but extensions are
# not available on the login screen. The only way to change the
# theme there is by replacing the default.
postFixup =
(oldAttrs.postFixup or "")
+ ''
cp ${theme}/share/gnome-shell/gnome-shell-theme.gresource \
$out/share/gnome-shell/gnome-shell-theme.gresource
'';
patches = (oldAttrs.patches or [ ]) ++ [
./shell_remove_dark_mode.patch
];
});
})
];

# Cursor settings are usually applied via Home Manager,
# but the login screen uses a separate database.
environment.systemPackages = lib.mkIf (config.stylix.cursor != null) [
Expand Down
37 changes: 37 additions & 0 deletions modules/gnome/overlay.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
lib,
config,
pkgs,
...
}:
{
overlay =
lib.mkIf (config.stylix.enable && config.stylix.targets.gnome.enable or false)
(
_final: prev: {
gnome-shell = prev.gnome-shell.overrideAttrs (
oldAttrs:
let
theme = pkgs.callPackage ./theme.nix {
inherit (config.lib.stylix) colors;
inherit (config.stylix) inputs;
};
in
{
# Themes are usually applied via an extension, but extensions are
# not available on the login screen. The only way to change the
# theme there is by replacing the default.
postFixup =
(oldAttrs.postFixup or "")
+ ''
cp ${theme}/share/gnome-shell/gnome-shell-theme.gresource \
$out/share/gnome-shell/gnome-shell-theme.gresource
'';
patches = (oldAttrs.patches or [ ]) ++ [
./shell_remove_dark_mode.patch
];
}
);
}
);
}
Loading