extract stylix to separate module, add nixos module with auto-import
This commit is contained in:
parent
35f880b563
commit
7eaa50327f
5 changed files with 90 additions and 49 deletions
|
|
@ -7,40 +7,6 @@ self:
|
|||
}:
|
||||
let
|
||||
cfg = config.programs.nova-shell;
|
||||
|
||||
stylixAvailable = config ? lib && config.lib ? stylix;
|
||||
|
||||
stylixTheme =
|
||||
let
|
||||
c = config.lib.stylix.colors.withHashtag;
|
||||
f = config.stylix.fonts;
|
||||
in
|
||||
{
|
||||
colors = {
|
||||
inherit (c)
|
||||
base00
|
||||
base01
|
||||
base02
|
||||
base03
|
||||
base04
|
||||
base05
|
||||
base06
|
||||
base07
|
||||
base08
|
||||
base09
|
||||
base0A
|
||||
base0B
|
||||
base0C
|
||||
base0D
|
||||
base0E
|
||||
base0F
|
||||
;
|
||||
};
|
||||
fontFamily = f.sansSerif.name;
|
||||
fontSize = f.sizes.desktop;
|
||||
barOpacity = 1.0 - config.stylix.opacity.desktop;
|
||||
iconFontFamily = "Symbols Nerd Font";
|
||||
};
|
||||
in
|
||||
{
|
||||
options.programs.nova-shell = {
|
||||
|
|
@ -295,7 +261,7 @@ in
|
|||
Keys: colors (base00-base0F), fontFamily, iconFontFamily, fontSize,
|
||||
barOpacity, barHeight, barPadding, groupSpacing, groupPadding, moduleSpacing,
|
||||
radius, screenRadius, reducedMotion.
|
||||
Automatically populated from stylix when it is available.
|
||||
Populated from stylix when homeModules.stylix is imported.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
@ -327,11 +293,8 @@ in
|
|||
cfg.modules;
|
||||
|
||||
xdg.configFile."nova-shell/theme.json".source =
|
||||
let
|
||||
stylixDefaults = if stylixAvailable then stylixTheme else { };
|
||||
finalTheme = lib.recursiveUpdate stylixDefaults cfg.theme;
|
||||
in
|
||||
(pkgs.formats.json { }).generate "nova-shell-theme.json" finalTheme;
|
||||
(pkgs.formats.json { }).generate "nova-shell-theme.json"
|
||||
cfg.theme;
|
||||
|
||||
# Niri layer rules for backdrop placement (requires niri-flake hm module)
|
||||
programs.niri.settings.layer-rules = lib.mkIf (config ? programs && config.programs ? niri) [
|
||||
|
|
|
|||
22
nix/nixos-module.nix
Normal file
22
nix/nixos-module.nix
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
self:
|
||||
{
|
||||
config,
|
||||
options,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.programs.nova-shell;
|
||||
in
|
||||
{
|
||||
options.programs.nova-shell.enable = lib.mkEnableOption "nova-shell Quickshell bar";
|
||||
|
||||
config = lib.mkIf cfg.enable (
|
||||
lib.optionalAttrs (options ? home-manager) {
|
||||
home-manager.sharedModules = [
|
||||
self.homeModules.default
|
||||
]
|
||||
++ lib.optionals (options ? stylix) [ self.homeModules.stylix ];
|
||||
}
|
||||
);
|
||||
}
|
||||
40
nix/stylix.nix
Normal file
40
nix/stylix.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
_:
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkDefault mkIf;
|
||||
c = config.lib.stylix.colors.withHashtag;
|
||||
f = config.stylix.fonts;
|
||||
in
|
||||
{
|
||||
options.stylix.targets.nova-shell.enable = config.lib.stylix.mkEnableTarget "nova-shell" true;
|
||||
|
||||
config = mkIf (config.stylix.enable && config.stylix.targets.nova-shell.enable) {
|
||||
programs.nova-shell.theme = {
|
||||
colors = {
|
||||
base00 = mkDefault c.base00;
|
||||
base01 = mkDefault c.base01;
|
||||
base02 = mkDefault c.base02;
|
||||
base03 = mkDefault c.base03;
|
||||
base04 = mkDefault c.base04;
|
||||
base05 = mkDefault c.base05;
|
||||
base06 = mkDefault c.base06;
|
||||
base07 = mkDefault c.base07;
|
||||
base08 = mkDefault c.base08;
|
||||
base09 = mkDefault c.base09;
|
||||
base0A = mkDefault c.base0A;
|
||||
base0B = mkDefault c.base0B;
|
||||
base0C = mkDefault c.base0C;
|
||||
base0D = mkDefault c.base0D;
|
||||
base0E = mkDefault c.base0E;
|
||||
base0F = mkDefault c.base0F;
|
||||
};
|
||||
fontFamily = mkDefault f.sansSerif.name;
|
||||
fontSize = mkDefault f.sizes.desktop;
|
||||
barOpacity = mkDefault (1.0 - config.stylix.opacity.desktop);
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue