From 1490e1035aec6f4e72a6478d204f18caae722ac0 Mon Sep 17 00:00:00 2001 From: Flameopathic Date: Sun, 9 Feb 2025 18:35:34 -0500 Subject: [PATCH 01/15] treewide: optionalize image --- docs/src/configuration.md | 84 +++++++++-------- modules/feh/hm.nix | 14 ++- modules/feh/nixos.nix | 14 ++- modules/gnome/hm.nix | 13 ++- modules/grub/nixos.nix | 187 ++++++++++++++++++++------------------ modules/hyprlock/hm.nix | 36 +++++--- modules/hyprpaper/hm.nix | 23 +++-- modules/kde/hm.nix | 6 +- modules/lightdm/nixos.nix | 12 ++- modules/regreet/nixos.nix | 18 ++-- modules/sway/hm.nix | 13 ++- modules/swaylock/hm.nix | 31 +++++-- modules/wpaperd/hm.nix | 60 ++++++------ stylix/palette.nix | 10 +- stylix/target.nix | 32 +++++-- stylix/testbed.nix | 24 +++-- 16 files changed, 330 insertions(+), 247 deletions(-) diff --git a/docs/src/configuration.md b/docs/src/configuration.md index 8ab7554db..aadb82dce 100644 --- a/docs/src/configuration.md +++ b/docs/src/configuration.md @@ -16,53 +16,12 @@ To enable the Stylix module, declare: > examples which don't include it. No other settings will take effect unless > `stylix.enable` is set to `true`. -## Wallpaper - -To start theming, you need to set a wallpaper image. - -```nix -{ - stylix.image = ./wallpaper.png; -} -``` - -The option accepts derivations as well as paths, so you can fetch an image -directly from the internet: - -```nix -{ - stylix.image = pkgs.fetchurl { - url = "https://www.pixelstalk.net/wp-content/uploads/2016/05/Epic-Anime-Awesome-Wallpapers.jpg"; - sha256 = "enQo3wqhgf0FEPHj2coOCvo7DuZv+x5rL/WIo4qPI50="; - }; -} -``` - ## Color scheme -### Generated schemes - -If you only set a wallpaper, Stylix will use a -[genetic algorithm](https://en.wikipedia.org/wiki/Genetic_algorithm) -to create a color scheme. The quality of these schemes can vary, but more -colorful images tend to have better results. - -You can force a light or dark scheme using the polarity option: - -```nix -{ - stylix.polarity = "dark"; -} -``` - -The current scheme can be previewed in a web browser at either -[`/etc/stylix/palette.html`](file:///etc/stylix/palette.html) for NixOS, or -`~/.config/stylix/palette.html` for Home Manager. - ### Handmade schemes -If you prefer a handmade color scheme, you can choose anything from -[the Tinted Theming repository](https://github.com/tinted-theming/schemes): +To set a [Tinted Theming](https://github.com/tinted-theming/schemes) color +scheme, declare: ```nix { @@ -116,6 +75,45 @@ For more complex configurations you may find it simpler to use See [base16.nix](https://github.com/SenchoPens/base16.nix) documentation for usage examples. +## Wallpaper + +To set a wallpaper, provide a path or an arbitrary derivation: + +- ```nix + { + stylix.image = ./wallpaper.png; + } + ``` + +- ```nix + { + stylix.image = pkgs.fetchurl { + url = "https://www.pixelstalk.net/wp-content/uploads/2016/05/Epic-Anime-Awesome-Wallpapers.jpg"; + sha256 = "enQo3wqhgf0FEPHj2coOCvo7DuZv+x5rL/WIo4qPI50="; + }; + } + ``` + +If `stylix.base16Scheme` is undeclared, Stylix generates a color scheme based +on the wallpaper using a [genetic algorithm](https://en.wikipedia.org/wiki/Genetic_algorithm). +Note that more colorful images tend to yield better results. The algorithm's +polarity can be schewed towards a dark or light theme with: + +- ```nix + { + stylix.polarity = "dark"; + } + ``` + +- ```nix + { + stylix.polarity = "light"; + } + ``` + +The generated color scheme can be viewed at `/etc/stylix/palette.html` on NixOS, +or at `~/.config/stylix/palette.html` on Home Manager. + ## Fonts The default combination of fonts is: diff --git a/modules/feh/hm.nix b/modules/feh/hm.nix index a10129943..65328143c 100644 --- a/modules/feh/hm.nix +++ b/modules/feh/hm.nix @@ -4,16 +4,20 @@ lib, ... }: - +let + cfg = config.stylix.targets.feh; +in { - options.stylix.targets.feh.enable = - config.lib.stylix.mkEnableTarget "the desktop background using Feh" true; + options.stylix.targets.feh = { + enable = config.lib.stylix.mkEnableTarget "the desktop background using Feh" true; + useWallpaper = config.lib.stylix.mkEnableWallpaper "Feh" true; + }; config.xsession.initExtra = lib.mkIf ( config.stylix.enable - && config.stylix.targets.feh.enable + && cfg.enable && ( with config.xsession.windowManager; bspwm.enable @@ -39,6 +43,6 @@ else "--bg-max"; in - "${pkgs.feh}/bin/feh --no-fehbg ${bg-arg} ${config.stylix.image}" + lib.optionalString cfg.useWallpaper "${pkgs.feh}/bin/feh --no-fehbg ${bg-arg} ${config.stylix.image}" ); } diff --git a/modules/feh/nixos.nix b/modules/feh/nixos.nix index 64469e0ad..4d638a2da 100644 --- a/modules/feh/nixos.nix +++ b/modules/feh/nixos.nix @@ -4,16 +4,20 @@ lib, ... }: - +let + cfg = config.stylix.targets.feh; +in { - options.stylix.targets.feh.enable = - config.lib.stylix.mkEnableTarget "the desktop background using Feh" true; + options.stylix.targets.feh = { + enable = config.lib.stylix.mkEnableTarget "the desktop background using Feh" true; + useWallpaper = config.lib.stylix.mkEnableWallpaper "Feh" true; + }; config.services.xserver.displayManager.sessionCommands = lib.mkIf ( config.stylix.enable - && config.stylix.targets.feh.enable + && cfg.enable && (with config.services.xserver.windowManager; xmonad.enable || i3.enable) ) ( @@ -32,6 +36,6 @@ else "--bg-max"; in - "${pkgs.feh}/bin/feh --no-fehbg ${bg-arg} ${config.stylix.image}" + lib.optionalString cfg.useWallpaper "${pkgs.feh}/bin/feh --no-fehbg ${bg-arg} ${config.stylix.image}" ); } diff --git a/modules/gnome/hm.nix b/modules/gnome/hm.nix index d57458ae0..660008efe 100644 --- a/modules/gnome/hm.nix +++ b/modules/gnome/hm.nix @@ -9,6 +9,7 @@ let inherit (config.stylix.fonts) sansSerif serif monospace; fontSize = toString config.stylix.fonts.sizes.applications; documentFontSize = toString (config.stylix.fonts.sizes.applications - 1); + cfg = config.stylix.targets.gnome; activator = pkgs.writeShellApplication { name = "stylix-activate-gnome"; @@ -42,10 +43,12 @@ let in { - options.stylix.targets.gnome.enable = - config.lib.stylix.mkEnableTarget "GNOME" true; + options.stylix.targets.gnome = { + enable = config.lib.stylix.mkEnableTarget "GNOME" true; + useWallpaper = config.lib.stylix.mkEnableWallpaper "GNOME" true; + }; - config = lib.mkIf (config.stylix.enable && config.stylix.targets.gnome.enable) { + config = lib.mkIf (config.stylix.enable && cfg.enable) { dconf.settings = { "org/gnome/desktop/background" = { color-shading-type = "solid"; @@ -64,8 +67,8 @@ in # Seemingly no tile support... :( else "zoom"; - picture-uri = "file://${config.stylix.image}"; - picture-uri-dark = "file://${config.stylix.image}"; + picture-uri = lib.mkIf cfg.useWallpaper "file://${config.stylix.image}"; + picture-uri-dark = lib.mkIf cfg.useWallpaper "file://${config.stylix.image}"; }; "org/gnome/desktop/interface" = { diff --git a/modules/grub/nixos.nix b/modules/grub/nixos.nix index d49cc1c49..e767516fc 100644 --- a/modules/grub/nixos.nix +++ b/modules/grub/nixos.nix @@ -10,6 +10,7 @@ with config.stylix.fonts; with config.lib.stylix.colors.withHashtag; let + cfg = config.stylix.targets.grub; # Grub requires fonts to be converted to "PFF2 format" # This function takes a font { name, package } and produces a .pf2 file mkGrubFont = @@ -44,97 +45,107 @@ let "crop"; in { + imports = [ + (lib.mkRenamedOptionModuleWith { + from = [ + "stylix" + "targets" + "grub" + "useImage" + ]; + sinceRelease = 2505; + to = [ + "stylix" + "targets" + "grub" + "useWallpaper" + ]; + }) + ]; options.stylix.targets.grub = { enable = config.lib.stylix.mkEnableTarget "GRUB" true; - - useImage = lib.mkOption { - description = "Whether to use your wallpaper image as the GRUB background."; - type = lib.types.bool; - default = false; - }; + useWallpaper = config.lib.stylix.mkEnableWallpaper "GRUB" false; }; - config.boot.loader.grub = - lib.mkIf (config.stylix.enable && config.stylix.targets.grub.enable) - { - backgroundColor = base00; - # Need to override the NixOS splash, this will match the background - splashImage = pixel "base00"; - - # This font will be used for the GRUB terminal - font = toString (mkGrubFont monospace); - - # TODO: Include OS icons - theme = - pkgs.runCommand "stylix-grub" - { - themeTxt = '' - desktop-image: "background.png" - desktop-image-scale-method: "${image-scale}" - desktop-color: "${base00}" - - title-text: "" - - terminal-left: "10%" - terminal-top: "20%" - terminal-width: "80%" - terminal-height: "60%" - - + progress_bar { - left = 25% - top = 80%+20 # 20 pixels below boot menu - width = 50% - height = 30 - - id = "__timeout__" - show_text = true - font = "${sansSerif.name}" - text = "@TIMEOUT_NOTIFICATION_MIDDLE@" - - border_color = "${base00}" - bg_color = "${base00}" - fg_color = "${base0B}" - text_color = "${base05}" - } - - + boot_menu { - left = 25% - top = 20% - width = 50% - height = 60% - menu_pixmap_style = "background_*.png" - - item_height = 40 - item_icon_space = 8 - item_spacing = 0 - item_padding = 0 - item_font = "${sansSerif.name}" - item_color = "${base05}" - - selected_item_color = "${base01}" - selected_item_pixmap_style = "selection_*.png" - } - ''; - passAsFile = [ "themeTxt" ]; + config.boot.loader.grub = lib.mkIf (config.stylix.enable && cfg.enable) { + backgroundColor = base00; + # Need to override the NixOS splash, this will match the background + splashImage = pixel "base00"; + + # This font will be used for the GRUB terminal + font = toString (mkGrubFont monospace); + + # TODO: Include OS icons + theme = + pkgs.runCommand "stylix-grub" + { + themeTxt = '' + desktop-image: "background.png" + desktop-image-scale-method: "${image-scale}" + desktop-color: "${base00}" + + title-text: "" + + terminal-left: "10%" + terminal-top: "20%" + terminal-width: "80%" + terminal-height: "60%" + + + progress_bar { + left = 25% + top = 80%+20 # 20 pixels below boot menu + width = 50% + height = 30 + + id = "__timeout__" + show_text = true + font = "${sansSerif.name}" + text = "@TIMEOUT_NOTIFICATION_MIDDLE@" + + border_color = "${base00}" + bg_color = "${base00}" + fg_color = "${base0B}" + text_color = "${base05}" } - '' - mkdir $out - cp $themeTxtPath $out/theme.txt - - ${ - if - config.stylix.targets.grub.useImage - # Make sure the background image is .png by asking to convert it - then - "${pkgs.imagemagick}/bin/convert ${config.stylix.image} png32:$out/background.png" - else - "cp ${pixel "base00"} $out/background.png" - } - - cp ${pixel "base01"} $out/background_c.png - cp ${pixel "base0B"} $out/selection_c.png - - cp ${mkGrubFont sansSerif} $out/sans_serif.pf2 - ''; - }; + + + boot_menu { + left = 25% + top = 20% + width = 50% + height = 60% + menu_pixmap_style = "background_*.png" + + item_height = 40 + item_icon_space = 8 + item_spacing = 0 + item_padding = 0 + item_font = "${sansSerif.name}" + item_color = "${base05}" + + selected_item_color = "${base01}" + selected_item_pixmap_style = "selection_*.png" + } + ''; + passAsFile = [ "themeTxt" ]; + } + '' + mkdir $out + cp $themeTxtPath $out/theme.txt + + ${ + if + cfg.useWallpaper + # Make sure the background image is .png by asking to convert it + then + "${pkgs.imagemagick}/bin/convert ${config.stylix.image} png32:$out/background.png" + else + "cp ${pixel "base00"} $out/background.png" + } + + cp ${pixel "base01"} $out/background_c.png + cp ${pixel "base0B"} $out/selection_c.png + + cp ${mkGrubFont sansSerif} $out/sans_serif.pf2 + ''; + }; } diff --git a/modules/hyprlock/hm.nix b/modules/hyprlock/hm.nix index e3acef98e..b0592f4eb 100644 --- a/modules/hyprlock/hm.nix +++ b/modules/hyprlock/hm.nix @@ -1,21 +1,29 @@ { config, lib, ... }: with config.lib.stylix; + +let + cfg = config.stylix.targets.hyprlock; +in { - options.stylix.targets.hyprlock.enable = mkEnableTarget "Hyprlock" true; + options.stylix.targets.hyprlock = { + enable = mkEnableTarget "Hyprlock" true; + useWallpaper = mkEnableWallpaper "Hyprlock" true; + }; - config = - lib.mkIf (config.stylix.enable && config.stylix.targets.hyprlock.enable) - { - programs.hyprlock.settings = { - background.path = "${config.stylix.image}"; - input-field = with colors; { - outer_color = "rgb(${base03})"; - inner_color = "rgb(${base00})"; - font_color = "rgb(${base05})"; - fail_color = "rgb(${base08})"; - check_color = "rgb(${base0A})"; - }; - }; + config = lib.mkIf (config.stylix.enable && cfg.enable) { + programs.hyprlock.settings = { + background = { + path = lib.mkIf cfg.useWallpaper config.stylix.image; + color = "rgb(${base00})"; + }; + input-field = with colors; { + outer_color = "rgb(${base03})"; + inner_color = "rgb(${base00})"; + font_color = "rgb(${base05})"; + fail_color = "rgb(${base08})"; + check_color = "rgb(${base0A})"; }; + }; + }; } diff --git a/modules/hyprpaper/hm.nix b/modules/hyprpaper/hm.nix index 325f05018..c37023f9c 100644 --- a/modules/hyprpaper/hm.nix +++ b/modules/hyprpaper/hm.nix @@ -1,14 +1,17 @@ { config, lib, ... }: +let + cfg = config.stylix.targets.hyprpaper; +in { - options.stylix.targets.hyprpaper.enable = - config.lib.stylix.mkEnableTarget "Hyprpaper" true; + options.stylix.targets.hyprpaper = { + enable = config.lib.stylix.mkEnableTarget "Hyprpaper" true; + useWallpaper = config.lib.stylix.mkEnableWallpaper "Hyprpaper" true; + }; - config = - lib.mkIf (config.stylix.enable && config.stylix.targets.hyprpaper.enable) - { - services.hyprpaper.settings = { - preload = [ "${config.stylix.image}" ]; - wallpaper = [ ",${config.stylix.image}" ]; - }; - }; + config = lib.mkIf (config.stylix.enable && cfg.enable) { + services.hyprpaper.settings = lib.mkIf cfg.useWallpaper { + preload = [ "${config.stylix.image}" ]; + wallpaper = [ ",${config.stylix.image}" ]; + }; + }; } diff --git a/modules/kde/hm.nix b/modules/kde/hm.nix index ebeeb3ec6..01c305d52 100644 --- a/modules/kde/hm.nix +++ b/modules/kde/hm.nix @@ -10,6 +10,7 @@ let inherit (config.lib.stylix) colors mkEnableTarget + mkEnableWallpaper ; inherit (config.stylix) image @@ -20,8 +21,7 @@ let let satisfies = check: (check default) && (check withImage); in - # TODO: when adding `wallpaper` option to this module, replace this with `image == null || !cfg.wallpaper` - if image == null then + if image == null || !cfg.useWallpaper then default else if satisfies lib.isString then default + withImage @@ -336,7 +336,7 @@ in { options.stylix.targets.kde = { enable = mkEnableTarget "KDE" true; - + useWallpaper = mkEnableWallpaper "KDE" true; decorations = lib.mkOption { type = lib.types.str; default = "org.kde.breeze"; diff --git a/modules/lightdm/nixos.nix b/modules/lightdm/nixos.nix index 36873584a..c52e60237 100644 --- a/modules/lightdm/nixos.nix +++ b/modules/lightdm/nixos.nix @@ -1,10 +1,14 @@ { config, lib, ... }: - +let + cfg = config.stylix.targets.lightdm; +in { - options.stylix.targets.lightdm.enable = - config.lib.stylix.mkEnableTarget "LightDM" true; + options.stylix.targets.lightdm = { + enable = config.lib.stylix.mkEnableTarget "LightDM" true; + useWallpaper = config.lib.stylix.mkEnableWallpaper "LightDM" true; + }; config.services.xserver.displayManager.lightdm.background = lib.mkIf ( - config.stylix.enable && config.stylix.targets.lightdm.enable + config.stylix.enable && cfg.enable && cfg.useWallpaper ) config.stylix.image; } diff --git a/modules/regreet/nixos.nix b/modules/regreet/nixos.nix index 2cc9d5701..e8476e891 100644 --- a/modules/regreet/nixos.nix +++ b/modules/regreet/nixos.nix @@ -4,18 +4,18 @@ lib, ... }: - +let + cfg = config.stylix.targets.regreet; +in { - options.stylix.targets.regreet.enable = - config.lib.stylix.mkEnableTarget "ReGreet" true; + options.stylix.targets.regreet = { + enable = config.lib.stylix.mkEnableTarget "ReGreet" true; + useWallpaper = config.lib.stylix.mkEnableWallpaper "ReGreet" true; + }; config = lib.mkIf - ( - config.stylix.enable - && config.stylix.targets.regreet.enable - && pkgs.stdenv.hostPlatform.isLinux - ) + (config.stylix.enable && cfg.enable && pkgs.stdenv.hostPlatform.isLinux) { warnings = let @@ -32,7 +32,7 @@ "stylix: regreet: custom services.greetd.settings.default_session.command value may not work: ${config.services.greetd.settings.default_session.command}"; programs.regreet = { settings.GTK.application_prefer_dark_theme = config.stylix.polarity == "dark"; - settings.background = { + settings.background = lib.mkIf cfg.useWallpaper { path = config.stylix.image; fit = let diff --git a/modules/sway/hm.nix b/modules/sway/hm.nix index 8bbaba3bb..c5c4d0424 100644 --- a/modules/sway/hm.nix +++ b/modules/sway/hm.nix @@ -3,6 +3,8 @@ with config.lib.stylix.colors.withHashtag; let + cfg = config.stylix.targets.sway; + text = base05; urgent = base08; focused = base0D; @@ -15,11 +17,13 @@ let in { - options.stylix.targets.sway.enable = - config.lib.stylix.mkEnableTarget "Sway" true; + options.stylix.targets.sway = { + enable = config.lib.stylix.mkEnableTarget "Sway" true; + useWallpaper = config.lib.stylix.mkEnableWallpaper "Sway" true; + }; config = lib.mkMerge [ - (lib.mkIf (config.stylix.enable && config.stylix.targets.sway.enable) { + (lib.mkIf (config.stylix.enable && cfg.enable) { wayland.windowManager.sway.config = { inherit fonts; @@ -57,7 +61,8 @@ in }; }; - output."*".bg = "${config.stylix.image} ${config.stylix.imageScalingMode}"; + output."*".bg = + lib.mkIf cfg.useWallpaper "${config.stylix.image} ${config.stylix.imageScalingMode}"; seat."*".xcursor_theme = ''"${config.stylix.cursor.name}" ${toString config.stylix.cursor.size}''; }; diff --git a/modules/swaylock/hm.nix b/modules/swaylock/hm.nix index 359447cd3..d03c0e9c0 100644 --- a/modules/swaylock/hm.nix +++ b/modules/swaylock/hm.nix @@ -1,6 +1,5 @@ { pkgs, - options, config, lib, ... @@ -9,6 +8,8 @@ with config.lib.stylix.colors; let + cfg = config.stylix.targets.swaylock; + inside = base01-hex; outside = base01-hex; ring = base05-hex; @@ -18,16 +19,26 @@ let in { + imports = [ + (lib.mkRenamedOptionModuleWith { + from = [ + "stylix" + "targets" + "swaylock" + "useImage" + ]; + sinceRelease = 2505; + to = [ + "stylix" + "targets" + "swaylock" + "useWallpaper" + ]; + }) + ]; options.stylix.targets.swaylock = { enable = config.lib.stylix.mkEnableTarget "Swaylock" true; - useImage = lib.mkOption { - description = '' - Whether to use your wallpaper image for the Swaylock background. - If this is disabled, a plain color will be used instead. - ''; - type = lib.types.bool; - default = true; - }; + useWallpaper = config.lib.stylix.mkEnableWallpaper "Swaylock" true; }; config = @@ -71,7 +82,7 @@ in text-ver-color = text; text-wrong-color = text; } - // lib.optionalAttrs config.stylix.targets.swaylock.useImage { + // lib.optionalAttrs cfg.useWallpaper { image = "${config.stylix.image}"; }; }; diff --git a/modules/wpaperd/hm.nix b/modules/wpaperd/hm.nix index 16a58d897..38ccbf7ed 100644 --- a/modules/wpaperd/hm.nix +++ b/modules/wpaperd/hm.nix @@ -1,35 +1,39 @@ { config, lib, ... }: - +let + cfg = config.stylix.targets.wpaperd; +in { - options.stylix.targets.wpaperd.enable = - config.lib.stylix.mkEnableTarget "wpaperd" true; + options.stylix.targets.wpaperd = { + enable = config.lib.stylix.mkEnableTarget "wpaperd" true; + useWallpaper = config.lib.stylix.mkEnableWallpaper "wpaperd" true; + }; - config = - lib.mkIf (config.stylix.enable && config.stylix.targets.wpaperd.enable) - ( - let - inherit (config.stylix) imageScalingMode; + config = lib.mkIf (config.stylix.enable && cfg.enable) ( + let + inherit (config.stylix) imageScalingMode; - # wpaperd doesn't have any mode close to the described behavior of center - modeMap = { - "stretch" = "stretch"; - # wpaperd's center mode is closest to the described behavior of fill - "fill" = "center"; - "fit" = "fit"; - "tile" = "tile"; - }; + # wpaperd doesn't have any mode close to the described behavior of center + modeMap = { + "stretch" = "stretch"; + # wpaperd's center mode is closest to the described behavior of fill + "fill" = "center"; + "fit" = "fit"; + "tile" = "tile"; + }; - modeAttrs = - if builtins.hasAttr imageScalingMode modeMap then - { mode = modeMap.${imageScalingMode}; } - else - lib.info "stylix: wpaperd: unsupported image scaling mode: ${imageScalingMode}" - { }; - in - { - programs.wpaperd.settings.any = { - path = "${config.stylix.image}"; - } // modeAttrs; + modeAttrs = + if builtins.hasAttr imageScalingMode modeMap then + { mode = modeMap.${imageScalingMode}; } + else + lib.info "stylix: wpaperd: unsupported image scaling mode: ${imageScalingMode}" + { }; + in + { + programs.wpaperd.settings.any = + lib.mkIf cfg.useWallpaper { + path = "${config.stylix.image}"; } - ); + // modeAttrs; + } + ); } diff --git a/stylix/palette.nix b/stylix/palette.nix index b59a66874..bf0dd0a04 100644 --- a/stylix/palette.nix +++ b/stylix/palette.nix @@ -29,13 +29,14 @@ in }; image = lib.mkOption { - type = with lib.types; coercedTo package toString path; + type = with lib.types; nullOr (coercedTo package toString path); description = '' Wallpaper image. This is set as the background of your desktop environment, if possible, and used to generate a colour scheme if you don't set one manually. ''; + default = null; }; imageScalingMode = lib.mkOption { @@ -158,6 +159,13 @@ in # https://github.com/SenchoPens/base16.nix/blob/b390e87cd404e65ab4d786666351f1292e89162a/README.md#theme-step-22 lib.stylix.colors = (cfg.base16.mkSchemeAttrs cfg.base16Scheme).override cfg.override; + assertions = [ + { + assertion = cfg.image != null || cfg.base16Scheme != null; + message = "One of `stylix.image` or `stylix.base16Scheme` must be set"; + } + ]; + stylix.generated.fileTree = { # The raw output of the palette generator. "stylix/generated.json" = { diff --git a/stylix/target.nix b/stylix/target.nix index ca3af6eba..bb2afeff5 100644 --- a/stylix/target.nix +++ b/stylix/target.nix @@ -31,17 +31,31 @@ }; }; - config.lib.stylix.mkEnableTarget = + config.lib.stylix = let cfg = config.stylix; in - humanName: autoEnable: - lib.mkEnableOption "theming for ${humanName}" - // { - default = cfg.enable && cfg.autoEnable && autoEnable; - example = !autoEnable; - } - // lib.optionalAttrs autoEnable { - defaultText = lib.literalMD "same as `stylix.autoEnable`"; + { + mkEnableTarget = + humanName: autoEnable: + lib.mkEnableOption "theming for ${humanName}" + // { + default = cfg.enable && cfg.autoEnable && autoEnable; + example = !autoEnable; + } + // lib.optionalAttrs autoEnable { + defaultText = lib.literalMD "same as `stylix.autoEnable`"; + }; + mkEnableWallpaper = + humanName: autoEnable: + lib.mkOption { + default = (config.stylix.image != null) && autoEnable; + example = config.stylix.image == null; + description = "Whether to set the wallpaper for ${humanName}."; + type = lib.types.bool; + } + // lib.optionalAttrs autoEnable { + defaultText = lib.literalMD "`stylix.image != null`"; + }; }; } diff --git a/stylix/testbed.nix b/stylix/testbed.nix index 0d20bd49a..9ea84d0a6 100644 --- a/stylix/testbed.nix +++ b/stylix/testbed.nix @@ -132,12 +132,14 @@ let makeTestbed = testbed: stylix: let - name = builtins.concatStringsSep testbedFieldSeparator [ - "testbed" - testbed.module - testbed.name - stylix.polarity - ]; + name = + builtins.concatStringsSep testbedFieldSeparator [ + "testbed" + testbed.module + testbed.name + stylix.polarity + ] + ++ lib.optional (stylix.image == null) "imageless"; system = lib.nixosSystem { inherit (pkgs) system; @@ -203,11 +205,15 @@ let base16Scheme = "${inputs.tinted-schemes}/base16/catppuccin-macchiato.yaml"; polarity = "dark"; } + { + enable = true; + image = null; + base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-macchiato.yaml"; + polarity = "dark"; + } ]; in # Testbeds are merged using lib.attrsets.unionOfDisjoint to throw an error if # testbed names collide. -builtins.foldl' lib.attrsets.unionOfDisjoint { } ( - lib.flatten (map makeTestbeds autoload) -) +builtins.foldl' lib.attrsets.unionOfDisjoint { } (lib.flatten (map makeTestbeds autoload)) From 41fdc0097cda20f2d7f12ae6e2b8596e07af1fb7 Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Tue, 11 Feb 2025 20:48:36 +0100 Subject: [PATCH 02/15] stylix: add schemeless testbed --- stylix/testbed.nix | 50 ++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/stylix/testbed.nix b/stylix/testbed.nix index 9ea84d0a6..a3c47c2d5 100644 --- a/stylix/testbed.nix +++ b/stylix/testbed.nix @@ -132,14 +132,14 @@ let makeTestbed = testbed: stylix: let - name = - builtins.concatStringsSep testbedFieldSeparator [ - "testbed" - testbed.module - testbed.name - stylix.polarity - ] - ++ lib.optional (stylix.image == null) "imageless"; + name = builtins.concatStringsSep testbedFieldSeparator [ + "testbed" + testbed.module + testbed.name + stylix.polarity + "image${lib.optionalString (stylix.image == null) "less"}" + "scheme${lib.optionalString (stylix.base16Scheme or false == null) "less"}" + ]; system = lib.nixosSystem { inherit (pkgs) system; @@ -183,32 +183,44 @@ let # This generates a copy of each testbed for each of the following themes. makeTestbeds = - testbed: - map (makeTestbed testbed) [ - { - enable = true; - image = pkgs.fetchurl { + let + images = { + dark = pkgs.fetchurl { + name = "mountains.jpg"; + url = "https://unsplash.com/photos/ZqLeQDjY6fY/download?ixid=M3wxMjA3fDB8MXxhbGx8fHx8fHx8fHwxNzE2MzY1NDY4fA&force=true"; + hash = "sha256-Dm/0nKiTFOzNtSiARnVg7zM0J1o+EuIdUQ3OAuasM58="; + }; + + light = pkgs.fetchurl { name = "three-bicycles.jpg"; url = "https://unsplash.com/photos/hwLAI5lRhdM/download?ixid=M3wxMjA3fDB8MXxhbGx8fHx8fHx8fHwxNzE2MzYxNDcwfA&force=true"; hash = "sha256-S0MumuBGJulUekoGI2oZfUa/50Jw0ZzkqDDu1nRkFUA="; }; + }; + in + testbed: + map (makeTestbed testbed) [ + { + enable = true; + image = images.light; base16Scheme = "${inputs.tinted-schemes}/base16/catppuccin-latte.yaml"; polarity = "light"; } { enable = true; - image = pkgs.fetchurl { - name = "mountains.jpg"; - url = "https://unsplash.com/photos/ZqLeQDjY6fY/download?ixid=M3wxMjA3fDB8MXxhbGx8fHx8fHx8fHwxNzE2MzY1NDY4fA&force=true"; - hash = "sha256-Dm/0nKiTFOzNtSiARnVg7zM0J1o+EuIdUQ3OAuasM58="; - }; + image = images.light; base16Scheme = "${inputs.tinted-schemes}/base16/catppuccin-macchiato.yaml"; polarity = "dark"; } { enable = true; image = null; - base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-macchiato.yaml"; + base16Scheme = "${inputs.tinted-schemes}/base16/catppuccin-macchiato.yaml"; + polarity = "dark"; + } + { + enable = true; + image = images.dark; polarity = "dark"; } ]; From d0306fd922e48384e12c9b69084a7a1d1de01e72 Mon Sep 17 00:00:00 2001 From: Flameopathic <64027365+Flameopathic@users.noreply.github.com> Date: Tue, 11 Feb 2025 15:50:47 -0500 Subject: [PATCH 03/15] Update docs/src/configuration.md Co-authored-by: NAHO <90870942+trueNAHO@users.noreply.github.com> --- docs/src/configuration.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/src/configuration.md b/docs/src/configuration.md index aadb82dce..7ce96f9e6 100644 --- a/docs/src/configuration.md +++ b/docs/src/configuration.md @@ -94,10 +94,11 @@ To set a wallpaper, provide a path or an arbitrary derivation: } ``` -If `stylix.base16Scheme` is undeclared, Stylix generates a color scheme based -on the wallpaper using a [genetic algorithm](https://en.wikipedia.org/wiki/Genetic_algorithm). -Note that more colorful images tend to yield better results. The algorithm's -polarity can be schewed towards a dark or light theme with: +If `stylix.base16Scheme` is undeclared, Stylix generates a color scheme based on +the wallpaper using a [genetic +algorithm](https://en.wikipedia.org/wiki/Genetic_algorithm). Note that more +colorful images tend to yield better results. The algorithm's polarity can be +schewed towards a dark or light theme with: - ```nix { From 1f22fba5b4e7a4e8ade0b46669db1c07a19c976f Mon Sep 17 00:00:00 2001 From: Flameopathic <64027365+Flameopathic@users.noreply.github.com> Date: Tue, 11 Feb 2025 20:51:54 -0500 Subject: [PATCH 04/15] Update stylix/palette.nix Co-authored-by: NAHO <90870942+trueNAHO@users.noreply.github.com> --- stylix/palette.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stylix/palette.nix b/stylix/palette.nix index bf0dd0a04..f57b94b8c 100644 --- a/stylix/palette.nix +++ b/stylix/palette.nix @@ -161,7 +161,7 @@ in assertions = [ { - assertion = cfg.image != null || cfg.base16Scheme != null; + assertion = !(cfg.image == null && cfg.base16Scheme == null); message = "One of `stylix.image` or `stylix.base16Scheme` must be set"; } ]; From 4059367f182c2c262de591b3ec9a39e2b1cc5dbc Mon Sep 17 00:00:00 2001 From: Flameopathic <64027365+Flameopathic@users.noreply.github.com> Date: Wed, 12 Feb 2025 11:20:46 -0500 Subject: [PATCH 05/15] Update stylix/testbed.nix Co-authored-by: NAHO <90870942+trueNAHO@users.noreply.github.com> --- stylix/testbed.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stylix/testbed.nix b/stylix/testbed.nix index a3c47c2d5..da18b21be 100644 --- a/stylix/testbed.nix +++ b/stylix/testbed.nix @@ -138,7 +138,7 @@ let testbed.name stylix.polarity "image${lib.optionalString (stylix.image == null) "less"}" - "scheme${lib.optionalString (stylix.base16Scheme or false == null) "less"}" + "scheme${lib.optionalString (stylix.base16Scheme or null == null) "less"}" ]; system = lib.nixosSystem { From 2329964c48e39e9718ceccb9c292f933fa9448bc Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sat, 15 Feb 2025 17:20:37 +0100 Subject: [PATCH 06/15] ci: allow IFD inside schemeless testbeds Link: https://github.com/danth/stylix/pull/855#issuecomment-2654636793 --- .github/workflows/check.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index a82c9614c..00e9a6426 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -77,7 +77,12 @@ jobs: - uses: DeterminateSystems/nix-installer-action@v16 with: extra-conf: |- - allow-import-from-derivation = false + allow-import-from-derivation = ${{ + startsWith(matrix.check.key, 'testbed-') && + contains(matrix.check.key, '-schemeless') ? + 'true' : + 'false' + }} - run: | nix build --no-update-lock-file --print-build-logs \ From 7de977f9558cf5fc8f6384199c842b7f44665e8d Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sat, 15 Feb 2025 17:30:32 +0100 Subject: [PATCH 07/15] ci: GitHub workflows do not support ternary operator --- .github/workflows/check.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 00e9a6426..ea8bad6ce 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -79,8 +79,8 @@ jobs: extra-conf: |- allow-import-from-derivation = ${{ startsWith(matrix.check.key, 'testbed-') && - contains(matrix.check.key, '-schemeless') ? - 'true' : + contains(matrix.check.key, '-schemeless') && + 'true' || 'false' }} From f8ed569649380f78f65d3b7dec72fe08ee68d6fd Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sat, 15 Feb 2025 17:55:51 +0100 Subject: [PATCH 08/15] stylix: testbed: match desired and image polarity --- stylix/testbed.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stylix/testbed.nix b/stylix/testbed.nix index da18b21be..da26e6642 100644 --- a/stylix/testbed.nix +++ b/stylix/testbed.nix @@ -208,7 +208,7 @@ let } { enable = true; - image = images.light; + image = images.dark; base16Scheme = "${inputs.tinted-schemes}/base16/catppuccin-macchiato.yaml"; polarity = "dark"; } From 431e99255f2ea373fc5dbee6adee593678f63823 Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sat, 15 Feb 2025 17:57:38 +0100 Subject: [PATCH 09/15] stylix: testbed: make null attributes optional --- stylix/testbed.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stylix/testbed.nix b/stylix/testbed.nix index da26e6642..e8f584cb1 100644 --- a/stylix/testbed.nix +++ b/stylix/testbed.nix @@ -137,7 +137,7 @@ let testbed.module testbed.name stylix.polarity - "image${lib.optionalString (stylix.image == null) "less"}" + "image${lib.optionalString (stylix.image or null == null) "less"}" "scheme${lib.optionalString (stylix.base16Scheme or null == null) "less"}" ]; @@ -214,7 +214,6 @@ let } { enable = true; - image = null; base16Scheme = "${inputs.tinted-schemes}/base16/catppuccin-macchiato.yaml"; polarity = "dark"; } From fcb8ad7113885c87d504dc39eaf9c004b77f585a Mon Sep 17 00:00:00 2001 From: Flameopathic Date: Sat, 15 Feb 2025 14:00:36 -0500 Subject: [PATCH 10/15] wayfire: add useWallpaper option --- modules/wayfire/hm.nix | 109 +++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 52 deletions(-) diff --git a/modules/wayfire/hm.nix b/modules/wayfire/hm.nix index 45fb00ed8..195591728 100644 --- a/modules/wayfire/hm.nix +++ b/modules/wayfire/hm.nix @@ -4,60 +4,65 @@ pkgs, ... }: +let + cfg = config.stylix.targets.wayfire; +in { - options.stylix.targets.wayfire.enable = - config.lib.stylix.mkEnableTarget "wayfire" true; - - config = - lib.mkIf (config.stylix.enable && config.stylix.targets.wayfire.enable) - ( - let - inherit (config.lib.stylix) colors; - rgba = rgb: a: "\\#${rgb}${a}"; - rgb = (lib.flip rgba) "ff"; - - wayfireConfig = config.wayland.windowManager.wayfire; - - wayfireBackground = pkgs.runCommand "wayfire-background.png" { } '' - ${lib.getExe' pkgs.imagemagick "convert"} ${config.stylix.image} $out - ''; - in - { - wayland.windowManager.wayfire.settings = lib.mkIf wayfireConfig.enable { - cube = { - background = rgb colors.base00; - cubemap_image = "${wayfireBackground}"; - skydome_texture = "${wayfireBackground}"; - }; - - expo.background = rgb colors.base00; - vswitch.background = rgb colors.base00; - vswipe.background = rgb colors.base00; - core.background_color = rgb colors.base00; - - decoration = { - font = "${config.stylix.fonts.monospace.name} ${builtins.toString config.stylix.fonts.sizes.desktop}"; - active_color = rgb colors.base0D; - inactive_color = rgb colors.base03; - }; - }; + options.stylix.targets.wayfire = { + enable = config.lib.stylix.mkEnableTarget "wayfire" true; + useWallpaper = config.lib.stylix.mkEnableWallpaper "wayfire" true; + }; + + config = lib.mkIf (config.stylix.enable && cfg.enable) ( + let + inherit (config.lib.stylix) colors; + rgba = rgb: a: "\\#${rgb}${a}"; + rgb = (lib.flip rgba) "ff"; - wayland.windowManager.wayfire.wf-shell.settings = - lib.mkIf wayfireConfig.wf-shell.enable - { - background.image = "${wayfireBackground}"; - background.fill_mode = - if config.stylix.imageScalingMode == "stretch" then - "stretch" - else if config.stylix.imageScalingMode == "fit" then - "preserve_aspect" - else - "fill_and_crop"; - - panel.background_color = rgb colors.base01; - panel.menu_icon = "${pkgs.nixos-icons}/share/icons/hicolor/256x256/apps/nix-snowflake.png"; - }; - } + wayfireConfig = config.wayland.windowManager.wayfire; + + wayfireBackground = lib.mkIf cfg.useWallpaper ( + pkgs.runCommand "wayfire-background.png" { } '' + ${lib.getExe' pkgs.imagemagick "convert"} ${config.stylix.image} $out + '' ); + in + { + wayland.windowManager.wayfire.settings = lib.mkIf wayfireConfig.enable { + cube = { + background = rgb colors.base00; + cubemap_image = lib.mkIf cfg.useWallpaper "${wayfireBackground}"; + skydome_texture = lib.mkIf cfg.useWallpaper "${wayfireBackground}"; + }; + + expo.background = rgb colors.base00; + vswitch.background = rgb colors.base00; + vswipe.background = rgb colors.base00; + core.background_color = rgb colors.base00; + + decoration = { + font = "${config.stylix.fonts.monospace.name} ${builtins.toString config.stylix.fonts.sizes.desktop}"; + active_color = rgb colors.base0D; + inactive_color = rgb colors.base03; + }; + }; + + wayland.windowManager.wayfire.wf-shell.settings = + lib.mkIf wayfireConfig.wf-shell.enable + { + background.image = lib.mkIf cfg.useWallpaper "${wayfireBackground}"; + background.fill_mode = + if config.stylix.imageScalingMode == "stretch" then + "stretch" + else if config.stylix.imageScalingMode == "fit" then + "preserve_aspect" + else + "fill_and_crop"; + + panel.background_color = rgb colors.base01; + panel.menu_icon = "${pkgs.nixos-icons}/share/icons/hicolor/256x256/apps/nix-snowflake.png"; + }; + } + ); } From 847168487827e16c2dbffb7a86d7450a92e88554 Mon Sep 17 00:00:00 2001 From: Flameopathic Date: Mon, 17 Feb 2025 11:45:51 -0500 Subject: [PATCH 11/15] testbed: format --- stylix/testbed.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stylix/testbed.nix b/stylix/testbed.nix index e8f584cb1..bbaeab29a 100644 --- a/stylix/testbed.nix +++ b/stylix/testbed.nix @@ -227,4 +227,6 @@ let in # Testbeds are merged using lib.attrsets.unionOfDisjoint to throw an error if # testbed names collide. -builtins.foldl' lib.attrsets.unionOfDisjoint { } (lib.flatten (map makeTestbeds autoload)) +builtins.foldl' lib.attrsets.unionOfDisjoint { } ( + lib.flatten (map makeTestbeds autoload) +) From 56f3212d26c62f3d91069f379a63cb0d03c956e6 Mon Sep 17 00:00:00 2001 From: Flameopathic Date: Thu, 20 Feb 2025 07:52:14 -0500 Subject: [PATCH 12/15] wallpaper modules: remove specific option for using image --- modules/feh/hm.nix | 7 ++++--- modules/feh/nixos.nix | 7 ++++--- modules/hyprpaper/hm.nix | 7 ++++--- modules/wpaperd/hm.nix | 13 ++++++------- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/modules/feh/hm.nix b/modules/feh/hm.nix index 65328143c..989c07790 100644 --- a/modules/feh/hm.nix +++ b/modules/feh/hm.nix @@ -9,8 +9,9 @@ let in { options.stylix.targets.feh = { - enable = config.lib.stylix.mkEnableTarget "the desktop background using Feh" true; - useWallpaper = config.lib.stylix.mkEnableWallpaper "Feh" true; + enable = config.lib.stylix.mkEnableTarget "the desktop background using Feh" ( + config.stylix.image != null + ); }; config.xsession.initExtra = @@ -43,6 +44,6 @@ in else "--bg-max"; in - lib.optionalString cfg.useWallpaper "${pkgs.feh}/bin/feh --no-fehbg ${bg-arg} ${config.stylix.image}" + "${pkgs.feh}/bin/feh --no-fehbg ${bg-arg} ${config.stylix.image}" ); } diff --git a/modules/feh/nixos.nix b/modules/feh/nixos.nix index 4d638a2da..ca527511b 100644 --- a/modules/feh/nixos.nix +++ b/modules/feh/nixos.nix @@ -9,8 +9,9 @@ let in { options.stylix.targets.feh = { - enable = config.lib.stylix.mkEnableTarget "the desktop background using Feh" true; - useWallpaper = config.lib.stylix.mkEnableWallpaper "Feh" true; + enable = config.lib.stylix.mkEnableTarget "the desktop background using Feh" ( + config.stylix.image != null + ); }; config.services.xserver.displayManager.sessionCommands = @@ -36,6 +37,6 @@ in else "--bg-max"; in - lib.optionalString cfg.useWallpaper "${pkgs.feh}/bin/feh --no-fehbg ${bg-arg} ${config.stylix.image}" + "${pkgs.feh}/bin/feh --no-fehbg ${bg-arg} ${config.stylix.image}" ); } diff --git a/modules/hyprpaper/hm.nix b/modules/hyprpaper/hm.nix index c37023f9c..1bf17a97a 100644 --- a/modules/hyprpaper/hm.nix +++ b/modules/hyprpaper/hm.nix @@ -4,12 +4,13 @@ let in { options.stylix.targets.hyprpaper = { - enable = config.lib.stylix.mkEnableTarget "Hyprpaper" true; - useWallpaper = config.lib.stylix.mkEnableWallpaper "Hyprpaper" true; + enable = config.lib.stylix.mkEnableTarget "Hyprpaper" ( + config.stylix.image != null + ); }; config = lib.mkIf (config.stylix.enable && cfg.enable) { - services.hyprpaper.settings = lib.mkIf cfg.useWallpaper { + services.hyprpaper.settings = { preload = [ "${config.stylix.image}" ]; wallpaper = [ ",${config.stylix.image}" ]; }; diff --git a/modules/wpaperd/hm.nix b/modules/wpaperd/hm.nix index 38ccbf7ed..e2bc31b9a 100644 --- a/modules/wpaperd/hm.nix +++ b/modules/wpaperd/hm.nix @@ -4,8 +4,9 @@ let in { options.stylix.targets.wpaperd = { - enable = config.lib.stylix.mkEnableTarget "wpaperd" true; - useWallpaper = config.lib.stylix.mkEnableWallpaper "wpaperd" true; + enable = config.lib.stylix.mkEnableTarget "wpaperd" ( + config.stylix.image != null + ); }; config = lib.mkIf (config.stylix.enable && cfg.enable) ( @@ -29,11 +30,9 @@ in { }; in { - programs.wpaperd.settings.any = - lib.mkIf cfg.useWallpaper { - path = "${config.stylix.image}"; - } - // modeAttrs; + programs.wpaperd.settings.any = { + path = "${config.stylix.image}"; + } // modeAttrs; } ); } From 3d2f9351b76f48701d9c8554c9370ca47894d11c Mon Sep 17 00:00:00 2001 From: Flameopathic Date: Fri, 21 Feb 2025 12:14:15 -0500 Subject: [PATCH 13/15] readd testbed.name and remove unnecessary parentheses --- stylix/target.nix | 2 +- stylix/testbed.nix | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/stylix/target.nix b/stylix/target.nix index bb2afeff5..12b8494b3 100644 --- a/stylix/target.nix +++ b/stylix/target.nix @@ -49,7 +49,7 @@ mkEnableWallpaper = humanName: autoEnable: lib.mkOption { - default = (config.stylix.image != null) && autoEnable; + default = config.stylix.image != null && autoEnable; example = config.stylix.image == null; description = "Whether to set the wallpaper for ${humanName}."; type = lib.types.bool; diff --git a/stylix/testbed.nix b/stylix/testbed.nix index bbaeab29a..e8f584cb1 100644 --- a/stylix/testbed.nix +++ b/stylix/testbed.nix @@ -227,6 +227,4 @@ let in # Testbeds are merged using lib.attrsets.unionOfDisjoint to throw an error if # testbed names collide. -builtins.foldl' lib.attrsets.unionOfDisjoint { } ( - lib.flatten (map makeTestbeds autoload) -) +builtins.foldl' lib.attrsets.unionOfDisjoint { } (lib.flatten (map makeTestbeds autoload)) From bf13e4e5e88db9953609b3b27c5212617c94d2a0 Mon Sep 17 00:00:00 2001 From: Flameopathic Date: Fri, 21 Feb 2025 12:40:40 -0500 Subject: [PATCH 14/15] fix stylix.targets.hyprland.hyprpaper.enable default --- modules/hyprland/hm.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/hyprland/hm.nix b/modules/hyprland/hm.nix index ad3e5c602..8ee1edef5 100644 --- a/modules/hyprland/hm.nix +++ b/modules/hyprland/hm.nix @@ -3,7 +3,9 @@ { options.stylix.targets.hyprland = { enable = config.lib.stylix.mkEnableTarget "Hyprland" true; - hyprpaper.enable = config.lib.stylix.mkEnableTarget "Hyprpaper" true; + hyprpaper.enable = config.lib.stylix.mkEnableTarget "Hyprpaper" ( + config.stylix.image != null + ); }; config = From 3696c3c1e6e266d230da68bbc03a2c7a5dd4bf64 Mon Sep 17 00:00:00 2001 From: Flameopathic Date: Sun, 23 Feb 2025 20:15:33 -0500 Subject: [PATCH 15/15] schemeless check: fix formatting --- .github/workflows/check.yml | 4 ++-- stylix/testbed.nix | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index ea8bad6ce..0859f4602 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -78,8 +78,8 @@ jobs: with: extra-conf: |- allow-import-from-derivation = ${{ - startsWith(matrix.check.key, 'testbed-') && - contains(matrix.check.key, '-schemeless') && + startsWith(matrix.check.key, 'testbed:') && + contains(matrix.check.key, ':schemeless') && 'true' || 'false' }} diff --git a/stylix/testbed.nix b/stylix/testbed.nix index e8f584cb1..bbaeab29a 100644 --- a/stylix/testbed.nix +++ b/stylix/testbed.nix @@ -227,4 +227,6 @@ let in # Testbeds are merged using lib.attrsets.unionOfDisjoint to throw an error if # testbed names collide. -builtins.foldl' lib.attrsets.unionOfDisjoint { } (lib.flatten (map makeTestbeds autoload)) +builtins.foldl' lib.attrsets.unionOfDisjoint { } ( + lib.flatten (map makeTestbeds autoload) +)