stylix/modules/gtk.nix

91 lines
2.4 KiB
Nix
Raw Normal View History

{ pkgs, config, lib, ... }:
2020-12-21 13:38:20 +00:00
let
materia = with pkgs; stdenvNoCC.mkDerivation {
name = "stylix-materia";
src = fetchFromGitHub {
owner = "nana-4";
repo = "materia-theme";
rev = "c63ca3285c4b5fcd652d1f054745251c60d4c32e";
sha256 = "Sje1j/k+g0MXP1wQi+KSVXIt1LQPeJ5KYJwfyxgmxPw=";
};
nativeBuildInputs = [ bc inkscape optipng sassc ];
2020-12-22 13:28:17 +00:00
postPatch = "patchShebangs .";
buildPhase = ''
export HOME="$NIX_BUILD_ROOT"
./change_color.sh -t $out/share/themes -o stylix $themePath
'';
# Colors
2020-12-21 13:38:20 +00:00
theme = with config.lib.stylix.colors; lib.generators.toKeyValue {} {
# Normal
BG = base00-hex;
FG = base05-hex;
# Accent
ACCENT_BG = base0F-hex;
ACCENT_FG = base00-hex;
# Buttons
2020-12-23 19:00:52 +00:00
BTN_BG = base01-hex;
BTN_FG = base05-hex;
2020-12-21 13:38:20 +00:00
# Header bar
2020-12-23 19:00:52 +00:00
HDR_BG = base01-hex;
2020-12-21 13:38:20 +00:00
HDR_FG = base05-hex;
# Header buttons
2020-12-23 19:00:52 +00:00
HDR_BTN_BG = base02-hex;
2020-12-21 13:38:20 +00:00
HDR_BTN_FG = base05-hex;
# Materia
MATERIA_SURFACE = base01-hex;
2020-12-23 19:00:52 +00:00
MATERIA_VIEW = base00-hex;
2020-12-21 13:38:20 +00:00
# Menu
MENU_BG = base01-hex;
MENU_FG = base05-hex;
# Selection
SEL_BG = base02-hex;
SEL_FG = base05-hex;
# Text
TXT_BG = base00-hex;
TXT_FG = base05-hex;
# Window manager border
WM_BORDER_FOCUS = base0A-hex;
WM_BORDER_UNFOCUS = base03-hex;
MATERIA_STYLE_COMPACT = "True";
UNITY_DEFAULT_LAUNCHER_STYLE = "False";
};
passAsFile = [ "theme" ];
2020-12-22 13:28:17 +00:00
# Fonts
2020-12-21 13:38:20 +00:00
FONTCONFIG_FILE = makeFontsConf {
fontDirectories = [ config.stylix.fonts.sansSerif.package ];
};
2020-12-22 13:28:17 +00:00
configurePhase = let font = config.stylix.fonts.sansSerif.name; in ''
sed 's/$font-family: .*;/$font-family: "${font}";/' \
-i src/gnome-shell/sass/_variables.scss
sed 's/$font-family-large: .*;/$font-family-large: "${font}";/' \
-i src/gnome-shell/sass/_variables.scss
2020-12-21 13:38:20 +00:00
'';
};
theme = {
package = materia;
name = "stylix";
};
# GTK will probably be unused without Xserver
in lib.mkIf config.services.xserver.enable {
2020-12-21 13:38:20 +00:00
# Required for Home Manager's GTK settings to work
services.dbus.packages = [ pkgs.gnome3.dconf ];
stylix.homeModule = {
gtk = {
enable = true;
inherit theme;
font = config.stylix.fonts.sansSerif;
};
};
services.xserver.displayManager.lightdm.greeters.gtk.theme = theme;
}