11.stylix/modules/gnome/default.nix
2023-01-19 18:17:15 +00:00

56 lines
2.1 KiB
Nix

{ pkgs, config, lib, ... }:
with lib;
{
options.stylix.targets.gnome.enable =
config.lib.stylix.mkEnableTarget "GNOME" config.services.xserver.desktopManager.gnome.enable;
config = mkIf config.stylix.targets.gnome.enable {
home-manager.sharedModules = [({ lib, ... }: {
dconf.settings = {
"org/gnome/desktop/background" = {
color-shading-type = "solid";
picture-options = "zoom";
picture-uri = "file://${config.stylix.image}";
picture-uri-dark = "file://${config.stylix.image}";
};
# We show the same colours regardless of this setting, and the quick
# settings tile is removed. The value is still used by Epiphany to
# request dark mode for websites which support it.
"org/gnome/desktop/interface".color-scheme =
if config.stylix.polarity == "dark"
then "prefer-dark"
else "default";
};
})];
# As Stylix is controlling the wallpaper, there is no need for this
# pack of default wallpapers to be installed.
# If you want to use one, you can set stylix.image to something like
# "${pkgs.gnome.gnome-backgrounds}/path/to/your/preferred/background"
# which will then download the pack regardless of its exclusion below.
environment.gnome.excludePackages = [ pkgs.gnome.gnome-backgrounds ];
nixpkgs.overlays = [(self: super: {
gnome = super.gnome.overrideScope' (gnomeSelf: gnomeSuper: {
gnome-shell = gnomeSuper.gnome-shell.overrideAttrs (oldAttrs: {
postPatch = let
colors = config.lib.stylix.colors {
template = builtins.readFile ./colors.mustache;
extension = "scss";
};
in (oldAttrs.postPatch or "") + ''
rm data/theme/gnome-shell-sass/{_colors.scss,_palette.scss}
cp ${colors} data/theme/gnome-shell-sass/_colors.scss
'';
patches = (oldAttrs.patches or []) ++ [
./shell_colors.patch
./shell_remove_dark_mode.patch
];
});
});
})];
};
}