From e11db09e2454d69fd1127eff73dd24699a0cd5c7 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Wed, 30 Oct 2024 21:38:05 -0700 Subject: [PATCH] feat: switch to stylix for theming --- flake.lock | 292 ++++++++++++++++++++++- flake.nix | 2 + hosts/adrastea/default.nix | 78 +++--- modules/linux/fonts/default.nix | 20 +- modules/linux/stylix/default.nix | 32 +++ users/youwen/common/core.nix | 2 +- users/youwen/linux/home.nix | 4 +- users/youwen/linux/programs/default.nix | 5 +- users/youwen/linux/spicetify/default.nix | 4 +- users/youwen/linux/theming/default.nix | 30 +-- users/youwen/linux/theming/stylix.nix | 9 + 11 files changed, 396 insertions(+), 82 deletions(-) create mode 100644 modules/linux/stylix/default.nix create mode 100644 users/youwen/linux/theming/stylix.nix diff --git a/flake.lock b/flake.lock index f444daa..307eb3a 100755 --- a/flake.lock +++ b/flake.lock @@ -38,6 +38,72 @@ "type": "github" } }, + "base16": { + "inputs": { + "fromYaml": "fromYaml" + }, + "locked": { + "lastModified": 1708890466, + "narHash": "sha256-LlrC09LoPi8OPYOGPXegD72v+//VapgAqhbOFS3i8sc=", + "owner": "SenchoPens", + "repo": "base16.nix", + "rev": "665b3c6748534eb766c777298721cece9453fdae", + "type": "github" + }, + "original": { + "owner": "SenchoPens", + "repo": "base16.nix", + "type": "github" + } + }, + "base16-fish": { + "flake": false, + "locked": { + "lastModified": 1622559957, + "narHash": "sha256-PebymhVYbL8trDVVXxCvZgc0S5VxI7I1Hv4RMSquTpA=", + "owner": "tomyun", + "repo": "base16-fish", + "rev": "2f6dd973a9075dabccd26f1cded09508180bf5fe", + "type": "github" + }, + "original": { + "owner": "tomyun", + "repo": "base16-fish", + "type": "github" + } + }, + "base16-helix": { + "flake": false, + "locked": { + "lastModified": 1725860795, + "narHash": "sha256-Z2o8VBPW3I+KKTSfe25kskz0EUj7MpUh8u355Z1nVsU=", + "owner": "tinted-theming", + "repo": "base16-helix", + "rev": "7f795bf75d38e0eea9fed287264067ca187b88a9", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-helix", + "type": "github" + } + }, + "base16-vim": { + "flake": false, + "locked": { + "lastModified": 1716150083, + "narHash": "sha256-ZMhnNmw34ogE5rJZrjRv5MtG3WaqKd60ds2VXvT6hEc=", + "owner": "tinted-theming", + "repo": "base16-vim", + "rev": "6e955d704d046b0dc3e5c2d68a2a6eeffd2b5d3d", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-vim", + "type": "github" + } + }, "blink-cmp": { "inputs": { "fenix": "fenix", @@ -184,6 +250,22 @@ "type": "github" } }, + "flake-compat_4": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" @@ -297,7 +379,28 @@ }, "flake-utils_4": { "inputs": { - "systems": "systems_4" + "systems": [ + "stylix", + "systems" + ] + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_5": { + "inputs": { + "systems": "systems_5" }, "locked": { "lastModified": 1710146030, @@ -328,6 +431,22 @@ "type": "github" } }, + "fromYaml": { + "flake": false, + "locked": { + "lastModified": 1689549921, + "narHash": "sha256-iX0pk/uB019TdBGlaJEWvBCfydT6sRq+eDcGPifVsCM=", + "owner": "SenchoPens", + "repo": "fromYaml", + "rev": "11fbbbfb32e3289d3c631e0134a23854e7865c84", + "type": "github" + }, + "original": { + "owner": "SenchoPens", + "repo": "fromYaml", + "type": "github" + } + }, "gitignore": { "inputs": { "nixpkgs": [ @@ -350,6 +469,23 @@ "type": "github" } }, + "gnome-shell": { + "flake": false, + "locked": { + "lastModified": 1713702291, + "narHash": "sha256-zYP1ehjtcV8fo+c+JFfkAqktZ384Y+y779fzmR9lQAU=", + "owner": "GNOME", + "repo": "gnome-shell", + "rev": "0d0aadf013f78a7f7f1dc984d0d812971864b934", + "type": "github" + }, + "original": { + "owner": "GNOME", + "ref": "46.1", + "repo": "gnome-shell", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -370,6 +506,27 @@ "type": "github" } }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "stylix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1724435763, + "narHash": "sha256-UNky3lJNGQtUEXT2OY8gMxejakSWPTfWKvpFkpFlAfM=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "c2cd2a52e02f1dfa1c88f95abeb89298d46023be", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "homebrew-cask": { "flake": false, "locked": { @@ -432,15 +589,15 @@ "lix": { "flake": false, "locked": { - "lastModified": 1720626042, - "narHash": "sha256-f8k+BezKdJfmE+k7zgBJiohtS3VkkriycdXYsKOm3sc=", - "rev": "2a4376be20d70feaa2b0e640c5041fb66ddc67ed", + "lastModified": 1729298361, + "narHash": "sha256-hiGtfzxFkDc9TSYsb96Whg0vnqBVV7CUxyscZNhed0U=", + "rev": "ad9d06f7838a25beec425ff406fe68721fef73be", "type": "tarball", - "url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/2a4376be20d70feaa2b0e640c5041fb66ddc67ed.tar.gz" + "url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/ad9d06f7838a25beec425ff406fe68721fef73be.tar.gz" }, "original": { "type": "tarball", - "url": "https://git.lix.systems/lix-project/lix/archive/2.90.0.tar.gz" + "url": "https://git.lix.systems/lix-project/lix/archive/2.91.1.tar.gz" } }, "lix-module": { @@ -453,15 +610,15 @@ ] }, "locked": { - "lastModified": 1720641669, - "narHash": "sha256-yEO2cGNgzm9x/XxiDQI+WckSWnZX63R8aJLBRSXtYNE=", - "rev": "5c48c833c15bb80d127a398a8c2484d42fdd8257", + "lastModified": 1729360442, + "narHash": "sha256-6U0CyPycIBc04hbYy2hBINnVso58n/ZyywY2BD3hu+s=", + "rev": "9098ac95768f7006d7e070b88bae76939f6034e6", "type": "tarball", - "url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/5c48c833c15bb80d127a398a8c2484d42fdd8257.tar.gz" + "url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/9098ac95768f7006d7e070b88bae76939f6034e6.tar.gz" }, "original": { "type": "tarball", - "url": "https://git.lix.systems/lix-project/nixos-module/archive/2.90.0.tar.gz" + "url": "https://git.lix.systems/lix-project/nixos-module/archive/2.91.1-1.tar.gz" } }, "nix-darwin": { @@ -609,6 +766,22 @@ "type": "github" } }, + "nixpkgs_3": { + "locked": { + "lastModified": 1725194671, + "narHash": "sha256-tLGCFEFTB5TaOKkpfw3iYT9dnk4awTP/q4w+ROpMfuw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b833ff01a0d694b910daca6e2ff4a3f26dee478c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "plugins-lsp-progress": { "flake": false, "locked": { @@ -683,6 +856,7 @@ "nix-homebrew": "nix-homebrew", "nixpkgs": "nixpkgs_2", "spicetify": "spicetify", + "stylix": "stylix", "vesktop-bin": "vesktop-bin", "viminal": "viminal", "wallpapers": "wallpapers", @@ -768,6 +942,36 @@ "type": "github" } }, + "stylix": { + "inputs": { + "base16": "base16", + "base16-fish": "base16-fish", + "base16-helix": "base16-helix", + "base16-vim": "base16-vim", + "flake-compat": "flake-compat_4", + "flake-utils": "flake-utils_4", + "gnome-shell": "gnome-shell", + "home-manager": "home-manager_2", + "nixpkgs": "nixpkgs_3", + "systems": "systems_4", + "tinted-foot": "tinted-foot", + "tinted-kitty": "tinted-kitty", + "tinted-tmux": "tinted-tmux" + }, + "locked": { + "lastModified": 1729963473, + "narHash": "sha256-uGjTjvvlGQfQ0yypVP+at0NizI2nrb6kz4wGAqzRGbY=", + "owner": "danth", + "repo": "stylix", + "rev": "04afcfc0684d9bbb24bb1dc77afda7c1843ec93b", + "type": "github" + }, + "original": { + "owner": "danth", + "repo": "stylix", + "type": "github" + } + }, "systems": { "locked": { "lastModified": 1681028828, @@ -828,9 +1032,73 @@ "type": "github" } }, + "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "tinted-foot": { + "flake": false, + "locked": { + "lastModified": 1696725948, + "narHash": "sha256-65bz2bUL/yzZ1c8/GQASnoiGwaF8DczlxJtzik1c0AU=", + "owner": "tinted-theming", + "repo": "tinted-foot", + "rev": "eedbcfa30de0a4baa03e99f5e3ceb5535c2755ce", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "tinted-foot", + "type": "github" + } + }, + "tinted-kitty": { + "flake": false, + "locked": { + "lastModified": 1716423189, + "narHash": "sha256-2xF3sH7UIwegn+2gKzMpFi3pk5DlIlM18+vj17Uf82U=", + "owner": "tinted-theming", + "repo": "tinted-kitty", + "rev": "eb39e141db14baef052893285df9f266df041ff8", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "tinted-kitty", + "rev": "eb39e141db14baef052893285df9f266df041ff8", + "type": "github" + } + }, + "tinted-tmux": { + "flake": false, + "locked": { + "lastModified": 1696725902, + "narHash": "sha256-wDPg5elZPcQpu7Df0lI5O8Jv4A3T6jUQIVg63KDU+3Q=", + "owner": "tinted-theming", + "repo": "tinted-tmux", + "rev": "c02050bebb60dbb20cb433cd4d8ce668ecc11ba7", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "tinted-tmux", + "type": "github" + } + }, "vesktop-bin": { "inputs": { - "flake-utils": "flake-utils_4", + "flake-utils": "flake-utils_5", "nixpkgs": [ "nixpkgs" ] diff --git a/flake.nix b/flake.nix index 003d65c..d11518f 100755 --- a/flake.nix +++ b/flake.nix @@ -73,6 +73,8 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + stylix.url = "github:danth/stylix"; + wallpapers = { url = "git+https://code.youwen.dev/youwen5/wallpapers"; flake = false; diff --git a/hosts/adrastea/default.nix b/hosts/adrastea/default.nix index 2af240e..01e018e 100644 --- a/hosts/adrastea/default.nix +++ b/hosts/adrastea/default.nix @@ -1,45 +1,45 @@ { inputs, - system, ... }: { - imports = with inputs; [ - ./configuration.nix - ../../modules/linux/gaming - ../../modules/linux/audio - ../../modules/linux/networking - ../../modules/linux/fonts - ../../modules/linux/greeter - ../../modules/linux/core - ../../modules/linux/desktop-portal - ../../modules/linux/desktop-portal - ../../modules/linux/audio-prod - ../../modules/linux/wine - ../../overlays - - catppuccin.nixosModules.catppuccin - lix-module.nixosModules.default - home-manager.nixosModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.backupFileExtension = "backup"; - home-manager.extraSpecialArgs = { - inherit inputs; - }; - home-manager.users.youwen = { - imports = [ - ./home-manager-extras - ../../users/youwen/linux/laptop - ../../users/youwen/linux/packages/x86_64 - ../../users/youwen/linux/programs - ../../users/youwen/common - ../../users/youwen/linux/spicetify - ../../users/youwen/common/fastfetch - catppuccin.homeManagerModules.catppuccin - ]; - }; - } - ]; + imports = + [ + ./configuration.nix + ../../modules/linux/gaming + ../../modules/linux/audio + ../../modules/linux/networking + ../../modules/linux/fonts + ../../modules/linux/greeter + ../../modules/linux/core + ../../modules/linux/desktop-portal + ../../modules/linux/desktop-portal + ../../modules/linux/audio-prod + ../../modules/linux/wine + ../../modules/linux/stylix + ../../overlays + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.backupFileExtension = "backup"; + home-manager.extraSpecialArgs = { + inherit inputs; + }; + home-manager.users.youwen = { + imports = [ + ./home-manager-extras + ../../users/youwen/linux/laptop + ../../users/youwen/linux/packages/x86_64 + ../../users/youwen/linux/programs + ../../users/youwen/common + ../../users/youwen/linux/spicetify + ../../users/youwen/common/fastfetch + ]; + }; + } + ] + ++ (with inputs; [ + lix-module.nixosModules.default + home-manager.nixosModules.home-manager + ]); } diff --git a/modules/linux/fonts/default.nix b/modules/linux/fonts/default.nix index 061b303..d8543d0 100755 --- a/modules/linux/fonts/default.nix +++ b/modules/linux/fonts/default.nix @@ -2,17 +2,17 @@ { fonts = { enableDefaultPackages = true; - fontconfig = { - defaultFonts = { - serif = [ "Noto Serif" ]; - sansSerif = [ "Noto Sans" ]; - }; - }; + # fontconfig = { + # defaultFonts = { + # serif = [ "Noto Serif" ]; + # sansSerif = [ "Noto Sans" ]; + # }; + # }; packages = with pkgs; [ - noto-fonts - noto-fonts-cjk-sans - noto-fonts-emoji - (nerdfonts.override { fonts = [ "CascadiaCode" ]; }) + # noto-fonts + # noto-fonts-cjk-sans + # noto-fonts-emoji + # (nerdfonts.override { fonts = [ "CascadiaCode" ]; }) (google-fonts.override { fonts = [ "Lora" ]; }) ]; }; diff --git a/modules/linux/stylix/default.nix b/modules/linux/stylix/default.nix new file mode 100644 index 0000000..64ae8fd --- /dev/null +++ b/modules/linux/stylix/default.nix @@ -0,0 +1,32 @@ +{ inputs, pkgs, ... }: +{ + imports = [ + inputs.stylix.nixosModules.stylix + ]; + + stylix = { + enable = true; + image = "${inputs.wallpapers}/aesthetic/afterglow_city_skyline_at_night.png"; + base16Scheme = "${pkgs.base16-schemes}/share/themes/rose-pine.yaml"; + polarity = "dark"; + + fonts = { + serif = { + name = "Noto Serif"; + package = pkgs.noto-fonts; + }; + sansSerif = { + name = "Noto Sans"; + package = pkgs.noto-fonts; + }; + emoji = { + name = "Noto Color Emoji"; + package = pkgs.noto-fonts-emoji; + }; + monospace = { + name = "CaskaydiaCove Nerd Font"; + package = (pkgs.nerdfonts.override { fonts = [ "CascadiaCode" ]; }); + }; + }; + }; +} diff --git a/users/youwen/common/core.nix b/users/youwen/common/core.nix index b046db6..8351c53 100755 --- a/users/youwen/common/core.nix +++ b/users/youwen/common/core.nix @@ -161,7 +161,7 @@ in programs.btop = { enable = true; settings = { - color_theme = "tokyo-night"; + # color_theme = "tokyo-night"; vim_keys = true; theme_background = false; }; diff --git a/users/youwen/linux/home.nix b/users/youwen/linux/home.nix index 86c998b..4e8b743 100755 --- a/users/youwen/linux/home.nix +++ b/users/youwen/linux/home.nix @@ -54,7 +54,7 @@ # Notification daemon services.dunst = { enable = true; - catppuccin.enable = true; + # catppuccin.enable = true; iconTheme = { name = "Papirus-Dark"; package = pkgs.papirus-icon-theme; @@ -67,7 +67,7 @@ programs.rofi = { enable = true; package = pkgs.rofi-wayland; - theme = "gruvbox-dark"; + # theme = "gruvbox-dark"; }; # Let home Manager install and manage itself. diff --git a/users/youwen/linux/programs/default.nix b/users/youwen/linux/programs/default.nix index caff096..9d2fcc4 100644 --- a/users/youwen/linux/programs/default.nix +++ b/users/youwen/linux/programs/default.nix @@ -1,7 +1,8 @@ +{ pkgs, ... }: { programs.kitty = { enable = true; - themeFile = "rose-pine"; + # themeFile = "rose-pine"; font.name = "CaskaydiaCove Nerd Font"; shellIntegration.enableFishIntegration = true; shellIntegration.enableBashIntegration = true; @@ -10,7 +11,7 @@ window_padding_width = "8 8 0"; confirm_os_window_close = -1; enable_audio_bell = "no"; - background_opacity = "0.8"; + background_opacity = pkgs.lib.mkForce "0.8"; allow_remote_control = "socket-only"; listen_on = "unix:/tmp/kitty"; scrollback_pager = ''nvim --noplugin -c "set signcolumn=no showtabline=0" -c "silent write! /tmp/kitty_scrollback_buffer | te cat /tmp/kitty_scrollback_buffer - "''; diff --git a/users/youwen/linux/spicetify/default.nix b/users/youwen/linux/spicetify/default.nix index d6cfeb5..05c4a76 100644 --- a/users/youwen/linux/spicetify/default.nix +++ b/users/youwen/linux/spicetify/default.nix @@ -13,8 +13,8 @@ in programs.spicetify = { enable = true; - theme = spicepkgs.themes.dribbblish; - colorScheme = "rosepine"; + # theme = spicepkgs.themes.dribbblish; + # colorScheme = "rosepine"; enabledExtensions = with spicepkgs.extensions; [ lastfm fullAppDisplayMod diff --git a/users/youwen/linux/theming/default.nix b/users/youwen/linux/theming/default.nix index 4dbcb2f..5b1a9ef 100644 --- a/users/youwen/linux/theming/default.nix +++ b/users/youwen/linux/theming/default.nix @@ -1,6 +1,8 @@ { pkgs, ... }: { - imports = [ ./catppuccin.nix ]; + # imports = [ ./catppuccin.nix ]; + # + imports = [ ./stylix.nix ]; gtk = { enable = true; @@ -11,20 +13,20 @@ iconTheme = { name = "Papirus-Dark"; }; - theme = { - name = "rose-pine"; - package = pkgs.rose-pine-gtk-theme; - }; + # theme = { + # name = "rose-pine"; + # package = pkgs.rose-pine-gtk-theme; + # }; }; - qt = { - enable = true; - platformTheme.name = "gtk"; - style.name = "gtk2"; - }; + # qt = { + # enable = true; + # platformTheme.name = "gtk"; + # style.name = "gtk2"; + # }; - home.file.".config/kdeglobals".text = '' - [Colors:View] - BackgroundNormal=#191724 - ''; + # home.file.".config/kdeglobals".text = '' + # [Colors:View] + # BackgroundNormal=#191724 + # ''; } diff --git a/users/youwen/linux/theming/stylix.nix b/users/youwen/linux/theming/stylix.nix new file mode 100644 index 0000000..51dca8d --- /dev/null +++ b/users/youwen/linux/theming/stylix.nix @@ -0,0 +1,9 @@ +{ + stylix.targets = { + waybar.enable = false; + hyprland.enable = false; + kitty.variant256Colors = true; + neovim.enable = false; + kde.enable = true; + }; +}