From 6fc63520e9b42f150f8253d9ebe9b59477c28157 Mon Sep 17 00:00:00 2001 From: unexplrd Date: Thu, 3 Apr 2025 17:57:49 +0300 Subject: [PATCH] steal stylix from MaxMur Signed-off-by: unexplrd --- hosts/dunamis/configuration.nix | 5 +- hosts/dunamis/stylix-light.nix | 50 --------- hosts/dunamis/stylix.nix | 50 --------- hosts/eldrid/configuration.nix | 5 + hosts/eldrid/stylix-light.nix | 50 --------- hosts/eldrid/stylix.nix | 50 --------- hosts/sarien/configuration.nix | 5 + hosts/sarien/stylix-light.nix | 50 --------- hosts/sarien/stylix.nix | 50 --------- modules/home/desktop/niri/default.nix | 2 +- modules/nixos/system/misc/default.nix | 3 +- modules/nixos/system/misc/stylix.nix | 139 ++++++++++++++++++++++++++ 12 files changed, 156 insertions(+), 303 deletions(-) delete mode 100644 hosts/dunamis/stylix-light.nix delete mode 100644 hosts/dunamis/stylix.nix delete mode 100644 hosts/eldrid/stylix-light.nix delete mode 100644 hosts/eldrid/stylix.nix delete mode 100644 hosts/sarien/stylix-light.nix delete mode 100644 hosts/sarien/stylix.nix create mode 100644 modules/nixos/system/misc/stylix.nix diff --git a/hosts/dunamis/configuration.nix b/hosts/dunamis/configuration.nix index 169671d..b825895 100644 --- a/hosts/dunamis/configuration.nix +++ b/hosts/dunamis/configuration.nix @@ -10,13 +10,16 @@ ./programs.nix ./services.nix ./sops.nix - ./stylix.nix ./users.nix ]; desktop.niri.enable = true; environment.memoryAllocator.provider = "mimalloc"; locale.ukrainian.enable = true; + module.stylix = { + enable = true; + theme = "nord"; + }; opentabletdriver.enable = false; qmk-vial.enable = true; security.basic.enable = true; diff --git a/hosts/dunamis/stylix-light.nix b/hosts/dunamis/stylix-light.nix deleted file mode 100644 index d547ba0..0000000 --- a/hosts/dunamis/stylix-light.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ - pkgs, - inputs, - config, - ... -}: { - imports = with inputs; [ - stylix.nixosModules.stylix - ]; - environment.systemPackages = with pkgs; [ - nerd-fonts.iosevka - ]; - stylix = { - enable = true; - base16Scheme = "${pkgs.base16-schemes}/share/themes/nord-light.yaml"; - polarity = "light"; - cursor = { - package = pkgs.nordzy-cursor-theme; - name = "Nordzy-cursors-white"; - size = 32; - }; - image = builtins.fetchurl { - url = "https://w.wallhaven.cc/full/l8/wallhaven-l8l9gq.png"; - name = "wallhaven-l8l9gq.png"; - sha256 = "0ypr44sg0fn55m1b52dgr1nnscpi2p6rfkjsm7vvrdqw7bafbx2z"; - }; - opacity.terminal = 0.9; - fonts = { - sizes = { - applications = 13; - desktop = 14; - popups = 13; - terminal = 15; - }; - serif = { - package = pkgs.nerd-fonts.iosevka; - name = "Iosevka Nerd Font Propo"; - }; - sansSerif = config.stylix.fonts.serif; - monospace = { - package = pkgs.nerd-fonts.iosevka-term; - name = "IosevkaTerm Nerd Font Mono"; - }; - emoji = { - package = pkgs.noto-fonts-emoji; - name = "Noto Color Emoji"; - }; - }; - }; -} diff --git a/hosts/dunamis/stylix.nix b/hosts/dunamis/stylix.nix deleted file mode 100644 index 73bc361..0000000 --- a/hosts/dunamis/stylix.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ - pkgs, - inputs, - config, - ... -}: { - imports = with inputs; [ - stylix.nixosModules.stylix - ]; - environment.systemPackages = with pkgs; [ - nerd-fonts.iosevka - ]; - stylix = { - enable = true; - base16Scheme = "${pkgs.base16-schemes}/share/themes/nord.yaml"; - polarity = "dark"; - cursor = { - package = pkgs.nordzy-cursor-theme; - name = "Nordzy-cursors"; - size = 32; - }; - image = builtins.fetchurl { - url = "https://w.wallhaven.cc/full/l8/wallhaven-l8l9gq.png"; - name = "wallhaven-l8l9gq.png"; - sha256 = "0ypr44sg0fn55m1b52dgr1nnscpi2p6rfkjsm7vvrdqw7bafbx2z"; - }; - opacity.terminal = 0.9; - fonts = { - sizes = { - applications = 13; - desktop = 14; - popups = 13; - terminal = 15; - }; - serif = { - package = pkgs.nerd-fonts.iosevka; - name = "Iosevka Nerd Font Propo"; - }; - sansSerif = config.stylix.fonts.serif; - monospace = { - package = pkgs.nerd-fonts.iosevka-term; - name = "IosevkaTerm Nerd Font Mono"; - }; - emoji = { - package = pkgs.noto-fonts-emoji; - name = "Noto Color Emoji"; - }; - }; - }; -} diff --git a/hosts/eldrid/configuration.nix b/hosts/eldrid/configuration.nix index 4799740..7172151 100644 --- a/hosts/eldrid/configuration.nix +++ b/hosts/eldrid/configuration.nix @@ -19,6 +19,11 @@ locale.ukrainian.enable = true; + module.stylix = { + enable = true; + theme = "nord"; + }; + opentabletdriver.enable = false; qmk-vial.enable = true; diff --git a/hosts/eldrid/stylix-light.nix b/hosts/eldrid/stylix-light.nix deleted file mode 100644 index d547ba0..0000000 --- a/hosts/eldrid/stylix-light.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ - pkgs, - inputs, - config, - ... -}: { - imports = with inputs; [ - stylix.nixosModules.stylix - ]; - environment.systemPackages = with pkgs; [ - nerd-fonts.iosevka - ]; - stylix = { - enable = true; - base16Scheme = "${pkgs.base16-schemes}/share/themes/nord-light.yaml"; - polarity = "light"; - cursor = { - package = pkgs.nordzy-cursor-theme; - name = "Nordzy-cursors-white"; - size = 32; - }; - image = builtins.fetchurl { - url = "https://w.wallhaven.cc/full/l8/wallhaven-l8l9gq.png"; - name = "wallhaven-l8l9gq.png"; - sha256 = "0ypr44sg0fn55m1b52dgr1nnscpi2p6rfkjsm7vvrdqw7bafbx2z"; - }; - opacity.terminal = 0.9; - fonts = { - sizes = { - applications = 13; - desktop = 14; - popups = 13; - terminal = 15; - }; - serif = { - package = pkgs.nerd-fonts.iosevka; - name = "Iosevka Nerd Font Propo"; - }; - sansSerif = config.stylix.fonts.serif; - monospace = { - package = pkgs.nerd-fonts.iosevka-term; - name = "IosevkaTerm Nerd Font Mono"; - }; - emoji = { - package = pkgs.noto-fonts-emoji; - name = "Noto Color Emoji"; - }; - }; - }; -} diff --git a/hosts/eldrid/stylix.nix b/hosts/eldrid/stylix.nix deleted file mode 100644 index 73bc361..0000000 --- a/hosts/eldrid/stylix.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ - pkgs, - inputs, - config, - ... -}: { - imports = with inputs; [ - stylix.nixosModules.stylix - ]; - environment.systemPackages = with pkgs; [ - nerd-fonts.iosevka - ]; - stylix = { - enable = true; - base16Scheme = "${pkgs.base16-schemes}/share/themes/nord.yaml"; - polarity = "dark"; - cursor = { - package = pkgs.nordzy-cursor-theme; - name = "Nordzy-cursors"; - size = 32; - }; - image = builtins.fetchurl { - url = "https://w.wallhaven.cc/full/l8/wallhaven-l8l9gq.png"; - name = "wallhaven-l8l9gq.png"; - sha256 = "0ypr44sg0fn55m1b52dgr1nnscpi2p6rfkjsm7vvrdqw7bafbx2z"; - }; - opacity.terminal = 0.9; - fonts = { - sizes = { - applications = 13; - desktop = 14; - popups = 13; - terminal = 15; - }; - serif = { - package = pkgs.nerd-fonts.iosevka; - name = "Iosevka Nerd Font Propo"; - }; - sansSerif = config.stylix.fonts.serif; - monospace = { - package = pkgs.nerd-fonts.iosevka-term; - name = "IosevkaTerm Nerd Font Mono"; - }; - emoji = { - package = pkgs.noto-fonts-emoji; - name = "Noto Color Emoji"; - }; - }; - }; -} diff --git a/hosts/sarien/configuration.nix b/hosts/sarien/configuration.nix index ac5f58f..1b5681b 100644 --- a/hosts/sarien/configuration.nix +++ b/hosts/sarien/configuration.nix @@ -19,6 +19,11 @@ locale.ukrainian.enable = true; + module.stylix = { + enable = true; + theme = "nord"; + }; + opentabletdriver.enable = false; qmk-vial.enable = true; diff --git a/hosts/sarien/stylix-light.nix b/hosts/sarien/stylix-light.nix deleted file mode 100644 index d547ba0..0000000 --- a/hosts/sarien/stylix-light.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ - pkgs, - inputs, - config, - ... -}: { - imports = with inputs; [ - stylix.nixosModules.stylix - ]; - environment.systemPackages = with pkgs; [ - nerd-fonts.iosevka - ]; - stylix = { - enable = true; - base16Scheme = "${pkgs.base16-schemes}/share/themes/nord-light.yaml"; - polarity = "light"; - cursor = { - package = pkgs.nordzy-cursor-theme; - name = "Nordzy-cursors-white"; - size = 32; - }; - image = builtins.fetchurl { - url = "https://w.wallhaven.cc/full/l8/wallhaven-l8l9gq.png"; - name = "wallhaven-l8l9gq.png"; - sha256 = "0ypr44sg0fn55m1b52dgr1nnscpi2p6rfkjsm7vvrdqw7bafbx2z"; - }; - opacity.terminal = 0.9; - fonts = { - sizes = { - applications = 13; - desktop = 14; - popups = 13; - terminal = 15; - }; - serif = { - package = pkgs.nerd-fonts.iosevka; - name = "Iosevka Nerd Font Propo"; - }; - sansSerif = config.stylix.fonts.serif; - monospace = { - package = pkgs.nerd-fonts.iosevka-term; - name = "IosevkaTerm Nerd Font Mono"; - }; - emoji = { - package = pkgs.noto-fonts-emoji; - name = "Noto Color Emoji"; - }; - }; - }; -} diff --git a/hosts/sarien/stylix.nix b/hosts/sarien/stylix.nix deleted file mode 100644 index 73bc361..0000000 --- a/hosts/sarien/stylix.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ - pkgs, - inputs, - config, - ... -}: { - imports = with inputs; [ - stylix.nixosModules.stylix - ]; - environment.systemPackages = with pkgs; [ - nerd-fonts.iosevka - ]; - stylix = { - enable = true; - base16Scheme = "${pkgs.base16-schemes}/share/themes/nord.yaml"; - polarity = "dark"; - cursor = { - package = pkgs.nordzy-cursor-theme; - name = "Nordzy-cursors"; - size = 32; - }; - image = builtins.fetchurl { - url = "https://w.wallhaven.cc/full/l8/wallhaven-l8l9gq.png"; - name = "wallhaven-l8l9gq.png"; - sha256 = "0ypr44sg0fn55m1b52dgr1nnscpi2p6rfkjsm7vvrdqw7bafbx2z"; - }; - opacity.terminal = 0.9; - fonts = { - sizes = { - applications = 13; - desktop = 14; - popups = 13; - terminal = 15; - }; - serif = { - package = pkgs.nerd-fonts.iosevka; - name = "Iosevka Nerd Font Propo"; - }; - sansSerif = config.stylix.fonts.serif; - monospace = { - package = pkgs.nerd-fonts.iosevka-term; - name = "IosevkaTerm Nerd Font Mono"; - }; - emoji = { - package = pkgs.noto-fonts-emoji; - name = "Noto Color Emoji"; - }; - }; - }; -} diff --git a/modules/home/desktop/niri/default.nix b/modules/home/desktop/niri/default.nix index 87b039b..34e677c 100644 --- a/modules/home/desktop/niri/default.nix +++ b/modules/home/desktop/niri/default.nix @@ -7,7 +7,7 @@ }: let inherit (lib) mkIf mkEnableOption mkDefault mkForce getExe; inherit (osConfig.networking) hostId; - inherit (config.stylix) colors; + inherit (config.lib.stylix) colors; cfg = config.desktop.niri; cursorSize = config.stylix.cursor.size; cursorName = config.stylix.cursor.name; diff --git a/modules/nixos/system/misc/default.nix b/modules/nixos/system/misc/default.nix index 4c4bc47..e30d259 100644 --- a/modules/nixos/system/misc/default.nix +++ b/modules/nixos/system/misc/default.nix @@ -1,7 +1,8 @@ { imports = [ + ./locale.nix ./opentabletdriver.nix ./qmk-vial.nix - ./locale.nix + ./stylix.nix ]; } diff --git a/modules/nixos/system/misc/stylix.nix b/modules/nixos/system/misc/stylix.nix new file mode 100644 index 0000000..e07f46d --- /dev/null +++ b/modules/nixos/system/misc/stylix.nix @@ -0,0 +1,139 @@ +{ + config, + inputs, + lib, + pkgs, + ... +}: let + inherit (lib) mkEnableOption mkOption mkIf; + inherit (lib) optionalAttrs; + inherit (lib.types) bool str; + inherit (config.system) stateVersion; + + cfg = config.module.stylix; + + cursorSize = 32; + + iosevkaPackage = + if stateVersion == "24.11" + then pkgs.nerdfonts.override {fonts = ["Iosevka"];} + else pkgs.nerd-fonts.iosevka; + iosevkaTermPackage = + if stateVersion == "24.11" + then pkgs.nerdfonts.override {fonts = ["Iosevka Term"];} + else pkgs.nerd-fonts.iosevka-term; + + themes = { + nord = { + polarity = "dark"; + scheme = "${pkgs.base16-schemes}/share/themes/nord.yaml"; + wallpaper = builtins.fetchurl { + url = "https://w.wallhaven.cc/full/l8/wallhaven-l8l9gq.png"; + name = "wallhaven-l8l9gq.png"; + sha256 = "0ypr44sg0fn55m1b52dgr1nnscpi2p6rfkjsm7vvrdqw7bafbx2z"; + }; + + serif = { + package = iosevkaPackage; + name = "Iosevka Nerd Font Propo"; + }; + + monospace = { + package = iosevkaTermPackage; + name = "IosevkaTerm Nerd Font Mono"; + }; + + cursor = { + package = pkgs.nordzy-cursor-theme; + name = "Nordzy-cursors"; + }; + }; + + nord-light = { + polarity = "light"; + scheme = "${pkgs.base16-schemes}/share/themes/nord-light.yaml"; + wallpaper = builtins.fetchurl { + url = "https://w.wallhaven.cc/full/l8/wallhaven-l8l9gq.png"; + name = "wallhaven-l8l9gq.png"; + sha256 = "0ypr44sg0fn55m1b52dgr1nnscpi2p6rfkjsm7vvrdqw7bafbx2z"; + }; + + serif = { + package = iosevkaPackage; + name = "Iosevka Nerd Font Propo"; + }; + + monospace = { + package = iosevkaTermPackage; + name = "IosevkaTerm Nerd Font Mono"; + }; + + cursor = { + package = pkgs.nordzy-cursor-theme; + name = "Nordzy-cursors-white"; + }; + }; + }; +in { + imports = with inputs; [ + stylix.nixosModules.stylix + ]; + + options = { + module.stylix = { + enable = mkEnableOption "enable stylix"; + + useCursor = mkOption { + type = bool; + default = true; + description = "enable cursor settings"; + }; + theme = mkOption { + type = str; + default = "nord"; + }; + }; + }; + + config = mkIf cfg.enable { + stylix = + { + enable = true; + image = themes.${cfg.theme}.wallpaper; + autoEnable = true; + polarity = themes.${cfg.theme}.polarity; + base16Scheme = themes.${cfg.theme}.scheme; + + opacity = { + applications = 1.0; + terminal = 1.0; + popups = 1.0; + desktop = 1.0; + }; + + fonts = { + sizes = { + applications = 13; + terminal = 13; + popups = 14; + desktop = 13; + }; + + serif = { + inherit (themes.${cfg.theme}.serif) package name; + }; + sansSerif = config.stylix.fonts.serif; + monospace = { + inherit (themes.${cfg.theme}.monospace) package name; + }; + emoji = config.stylix.fonts.serif; + }; + } + // optionalAttrs cfg.useCursor { + cursor = { + inherit (themes.${cfg.theme}.cursor) package name; + size = cursorSize; + }; + }; + }; +}