Skip to content
Merged
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
41 changes: 19 additions & 22 deletions modules/bemenu/hm.nix
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
{
mkTarget,
lib,
config,
...
}:
{ mkTarget, lib, ... }:
mkTarget {
name = "bemenu";
humanName = "bemenu";

extraOptions = {
fontSize = lib.mkOption {
description = ''
Font size used for bemenu.
'';
type = with lib.types; nullOr int;
default = config.stylix.fonts.sizes.popups;
defaultText = lib.literalExpression "config.stylix.fonts.sizes.popups";
}; # optional argument
extraOptions =
{ fonts }:
{
fontSize = lib.mkOption {
description = ''
Font size used for bemenu.
'';
type = with lib.types; nullOr int;
default = fonts.sizes.popups;
Comment thread
0xda157 marked this conversation as resolved.
defaultText = lib.literalExpression "config.stylix.fonts.sizes.popups";
}; # optional argument

alternate = lib.mkOption {
description = ''
Whether to use alternating colours.
'';
type = lib.types.bool;
default = false;
alternate = lib.mkOption {
description = ''
Whether to use alternating colours.
'';
type = lib.types.bool;
default = false;
};
};
};

configElements = [
(
Expand Down
15 changes: 10 additions & 5 deletions modules/hyprland/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@
mkTarget {
name = "hyprland";
humanName = "Hyprland";
extraOptions.hyprpaper.enable = config.lib.stylix.mkEnableTargetWith {
name = "Hyprpaper";
autoEnable = config.stylix.image != null;
autoEnableExpr = "config.stylix.image != null";
};
extraOptions =
{ image }:
{
hyprpaper.enable = config.lib.stylix.mkEnableTargetWith {
name = "Hyprpaper";
autoEnable = image != null;
autoEnableExpr = "config.stylix.image != null";
};
};

configElements = [
(
{ colors }:
Expand Down
14 changes: 13 additions & 1 deletion stylix/autoload.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,19 @@ builtins.concatLists (
{
key = file;
_file = file;
imports = [ (module (args // extraArgs // { inherit mkTarget; })) ];
imports = [
(module (
args
// extraArgs
// {
inherit mkTarget;
config = lib.recursiveUpdate config {
stylix = throw "stylix: unguareded `config.stylix` accessed while using mkTarget";
lib.stylix.colors = throw "stylix: unguareded `config.lib.stylix.colors` accessed while using mkTarget";
};
}
))
];
}
else
file
Expand Down
9 changes: 4 additions & 5 deletions stylix/mk-target.nix
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,9 @@ let
c;
in
{
inherit imports;
imports = imports ++ [
{ options.stylix.targets.${name} = mkConfig (lib.toFunction extraOptions); }
];

options.stylix.targets.${name}.enable =
let
Expand All @@ -267,8 +269,5 @@ let
};
in
{
imports = [
{ options.stylix.targets.${name} = extraOptions; }
module
];
imports = [ module ];
Comment thread
0xda157 marked this conversation as resolved.
}