feat: add stylix and switch font to (very similar) JetBrainsMono for italic support

This commit is contained in:
oddlama 2023-09-21 17:08:44 +02:00
parent e65dac849a
commit 75e943cd1e
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
8 changed files with 229 additions and 61 deletions

76
flake.lock generated
View file

@ -60,6 +60,24 @@
"type": "github"
}
},
"base16": {
"inputs": {
"fromYaml": "fromYaml"
},
"locked": {
"lastModified": 1689633990,
"narHash": "sha256-iwvQg2Vx0IIDWZaKo8Xmzxlv1YPHg+Kp/QSv8dRv0RY=",
"owner": "SenchoPens",
"repo": "base16.nix",
"rev": "dddf2e1c04845d43c89a8e9e37d574519649a404",
"type": "github"
},
"original": {
"owner": "SenchoPens",
"repo": "base16.nix",
"type": "github"
}
},
"colmena": {
"inputs": {
"flake-compat": "flake-compat",
@ -296,6 +314,22 @@
"type": "github"
}
},
"flake-compat_6": {
"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": [
@ -390,6 +424,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": [
@ -834,6 +884,7 @@
"nixpkgs-wayland": "nixpkgs-wayland",
"nixseparatedebuginfod": "nixseparatedebuginfod",
"pre-commit-hooks": "pre-commit-hooks_2",
"stylix": "stylix",
"templates": "templates"
}
},
@ -880,6 +931,31 @@
"type": "github"
}
},
"stylix": {
"inputs": {
"base16": "base16",
"flake-compat": "flake-compat_6",
"home-manager": [
"home-manager"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1694375893,
"narHash": "sha256-oJGESNjJ/6o6tfuUavBZ7go4Oun7g9YKv7OqaQaY/80=",
"owner": "danth",
"repo": "stylix",
"rev": "c3c9f4784b4f08f6676340126858d936edbce1fa",
"type": "github"
},
"original": {
"owner": "danth",
"repo": "stylix",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,

View file

@ -2,6 +2,17 @@
description = " oddlama's nix config and dotfiles";
inputs = {
agenix = {
url = "github:ryantm/agenix";
inputs.home-manager.follows = "home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
agenix-rekey = {
url = "github:oddlama/agenix-rekey";
inputs.nixpkgs.follows = "nixpkgs";
};
colmena = {
url = "github:oddlama/colmena";
inputs.nixpkgs.follows = "nixpkgs";
@ -23,6 +34,8 @@
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
@ -77,18 +90,13 @@
inputs.flake-utils.follows = "flake-utils";
};
agenix = {
url = "github:ryantm/agenix";
stylix = {
url = "github:danth/stylix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
agenix-rekey = {
url = "github:oddlama/agenix-rekey";
inputs.nixpkgs.follows = "nixpkgs";
};
templates.url = "github:NixOS/templates";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {

View file

@ -33,4 +33,11 @@
gpg-connect-agent /bye
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
'';
stylix.fonts.sizes = {
#desktop = 20;
#applications = 20;
terminal = 20;
#popups = 20;
};
}

View file

@ -1,4 +1,9 @@
{lib, ...}: let
{
config,
inputs,
lib,
...
}: let
inherit
(lib)
mkOption
@ -6,10 +11,12 @@
;
in {
imports = [
inputs.stylix.nixosModules.stylix
./fonts.nix
./steam.nix
./wayland.nix
./xserver.nix
./steam.nix
];
options.graphical.gaming.enable = mkOption {
@ -21,5 +28,29 @@ in {
config = {
# Needed for gtk
programs.dconf.enable = true;
stylix = {
# I want to choose what to style myself.
autoEnable = false;
polarity = "dark";
image = config.lib.stylix.pixel "base00";
base16Scheme = {
base00 = "282c34";
base01 = "353b45";
base02 = "3e4451";
base03 = "545862";
base04 = "565c64";
base05 = "abb2bf";
base06 = "b6bdca";
base07 = "c8ccd4";
base08 = "e06c75";
base09 = "d19a66";
base0A = "e5c07b";
base0B = "98c379";
base0C = "56b6c2";
base0D = "61afef";
base0E = "c678dd";
base0F = "be5046";
};
};
};
}

View file

@ -1,52 +1,62 @@
{
lib,
pkgs,
...
}: {
{pkgs, ...}: {
fonts = {
fontconfig = {
# Always prefer emojis even if the original font would provide a glyph
localConf = ''
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<alias binding="weak">
<family>monospace</family>
<prefer>
<family>emoji</family>
</prefer>
</alias>
<alias binding="weak">
<family>sans-serif</family>
<prefer>
<family>emoji</family>
</prefer>
</alias>
<alias binding="weak">
<family>serif</family>
<prefer>
<family>emoji</family>
</prefer>
</alias>
</fontconfig>
'';
defaultFonts = {
emoji = ["Segoe UI Emoji" "Noto Fonts Emoji"];
monospace = ["FiraCode Nerd Font"];
sansSerif = lib.mkBefore ["Segoe UI"];
serif = ["Source Serif Pro"];
};
};
# Always prefer emojis even if the original font would provide a glyph
fontconfig.localConf = ''
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<alias binding="weak">
<family>monospace</family>
<prefer>
<family>emoji</family>
</prefer>
</alias>
<alias binding="weak">
<family>sans-serif</family>
<prefer>
<family>emoji</family>
</prefer>
</alias>
<alias binding="weak">
<family>serif</family>
<prefer>
<family>emoji</family>
</prefer>
</alias>
</fontconfig>
'';
packages = with pkgs; [
(nerdfonts.override {fonts = ["FiraCode" "FiraMono" "SourceCodePro" "JetBrainsMono"];})
dejavu_fonts
(pkgs.nerdfonts.override {fonts = ["NerdFontsSymbolsOnly"];})
noto-fonts
noto-fonts-cjk-sans
noto-fonts-cjk-serif
noto-fonts-emoji
noto-fonts-extra
segoe-ui-ttf
];
};
stylix.fonts = {
serif = {
package = pkgs.dejavu_fonts;
name = "IBM Plex Serif";
};
sansSerif = {
package = pkgs.segoe-ui-ttf;
name = "Segoe UI";
};
monospace = {
# No need for patched nerd fonts, kitty can pick up on them automatically,
# and ideally every program should do that: https://sw.kovidgoyal.net/kitty/faq/#kitty-is-not-able-to-use-my-favorite-font
package = pkgs.jetbrains-mono;
name = "JetBrains Mono";
};
emoji = {
package = pkgs.segoe-ui-ttf;
name = "Segoe UI Emoji";
};
};
}

View file

@ -10,4 +10,6 @@
./config/shell
./config/utils.nix
];
xdg.configFile."nixpkgs/config.nix".text = "{ allowUnfree = true; }";
}

View file

@ -1,12 +1,19 @@
{pkgs, ...}: {
{
config,
lib,
pkgs,
...
}: {
home.sessionVariables = {
TERMINFO_DIRS = "${pkgs.kitty.terminfo.outPath}/share/terminfo";
};
stylix.targets.kitty.enable = true;
programs.kitty = {
enable = true;
settings = {
font_family = "FiraCode Nerd Font";
font_size = 20;
bold_font = "${config.programs.kitty.font.name} Bold";
italic_font = "${config.programs.kitty.font.name} Italic";
bold_italic_font = "${config.programs.kitty.font.name} Bold Italic";
# Do not wait for inherited child processes.
close_on_child_death = "yes";
@ -63,7 +70,10 @@
"ctrl+shift+." = "change_font_size all -2.0";
"ctrl+shift+," = "change_font_size all +2.0";
};
extraConfig = ''
# XXX: mkForce to prevent stylix from appending theme.
# Fix this by making a correct theme that can be used.
# TODO aaaaaaaaaa
extraConfig = lib.mkForce ''
# Use nvim as scrollback pager
scrollback_pager nvim -u NONE -c "set nonumber nolist showtabline=0 foldcolumn=0 laststatus=0" -c "autocmd TermOpen * normal G" -c "silent write! /tmp/kitty_scrollback_buffer | te head -c-1 /tmp/kitty_scrollback_buffer; rm /tmp/kitty_scrollback_buffer; cat"
'';

View file

@ -1,4 +1,8 @@
{pkgs, ...}: {
{
lib,
pkgs,
...
}: {
home.pointerCursor = {
gtk.enable = true;
x11.enable = true;
@ -29,17 +33,14 @@
};
in {
enable = true;
font = {
package = pkgs.segoe-ui-ttf;
name = "Segoe UI";
};
iconTheme = {
name = "WhiteSur-dark";
package = pkgs.whitesur-icon-theme;
};
theme = {
# TODO test other themes
theme = lib.mkForce {
name = "WhiteSur-Dark-solid";
package = pkgs.whitesur-gtk-theme;
};
@ -55,4 +56,27 @@
enable = true;
platformTheme = "gtk";
};
stylix = {
polarity = "dark";
base16Scheme = {
base00 = "282c34";
base01 = "353b45";
base02 = "3e4451";
base03 = "545862";
base04 = "565c64";
base05 = "abb2bf";
base06 = "b6bdca";
base07 = "c8ccd4";
base08 = "e06c75";
base09 = "d19a66";
base0A = "e5c07b";
base0B = "98c379";
base0C = "56b6c2";
base0D = "61afef";
base0E = "c678dd";
base0F = "be5046";
};
targets.gtk.enable = true;
};
}