More progress

This commit is contained in:
Jan Bulthuis 2024-07-18 18:13:19 +02:00
parent 472731c514
commit dd327a977a
7 changed files with 93 additions and 13 deletions

View File

@ -255,6 +255,7 @@ in {
# # "Noto Color Emoji" # # "Noto Color Emoji"
# ]; # ];
# }; # };
fonts.fontconfig.localConf = '' fonts.fontconfig.localConf = ''
<alias> <alias>
<family>Dina</family> <family>Dina</family>

View File

@ -3,6 +3,7 @@
with lib; { with lib; {
imports = [ imports = [
# Import modules # Import modules
./fontconfig/default.nix
./greeter/greetd/default.nix ./greeter/greetd/default.nix
./greeter/greetd/tuigreet.nix ./greeter/greetd/tuigreet.nix
./locale/default.nix ./locale/default.nix
@ -16,8 +17,9 @@ with lib; {
config.modules = { config.modules = {
# Enable default modules # Enable default modules
fontconfig.enable = mkDefault true;
neovim.enable = mkDefault true; neovim.enable = mkDefault true;
tuigreet.enable = mkDefault true; tuigreet.enable = mkDefault true;
tailscale.enable = mkDefault true; tailscale.enable = mkDefault true;
}; };
} }

View File

@ -0,0 +1,21 @@
{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.modules.fontconfig;
in {
options.modules.fontconfig = {
enable = mkEnableOption "fontconfig";
};
config = {
fonts.fontconfig.enable = cfg.enable;
fonts.enableDefaultPackages = false;
fonts.fontconfig.defaultFonts = {
serif = mkDefault [];
sansSerif = mkDefault [];
monospace = mkDefault [];
emoji = mkDefault [];
};
};
}

View File

@ -24,8 +24,7 @@ in {
layoutOptions = "-outer-padding ${toString config.theming.layout.windowPadding} -view-padding ${toString config.theming.layout.windowPadding}"; layoutOptions = "-outer-padding ${toString config.theming.layout.windowPadding} -view-padding ${toString config.theming.layout.windowPadding}";
modes = ["normal" "locked"]; modes = ["normal" "locked"];
tags = [1 2 3 4 5 6 7 8 9]; tags = [1 2 3 4 5 6 7 8 9];
# TODO: Replace the base02 color with a named color waylockOptions = "-init-color 0x${colors.bg} -input-color 0x${colors.focused} -fail-color 0x${colors.bg}";
waylockOptions = "-init-color 0x${colors.bg} -input-color 0x${config.theming.schemeColors.base02} -fail-color 0x${colors.bg}";
colors = config.theming.colors; colors = config.theming.colors;
@ -52,7 +51,7 @@ in {
border-width = toString config.theming.layout.borderSize; border-width = toString config.theming.layout.borderSize;
background-color = "0x${colors.bg}"; background-color = "0x${colors.bg}";
border-color-focused = "0x${colors.fg}"; border-color-focused = "0x${colors.fg}";
border-color-unfocused = "0x${config.theming.schemeColors.base01}"; # TODO: Change to use named color; border-color-unfocused = "0x${colors.unfocused}"; # TODO: Change to use named color;
border-color-urgent = "0x${colors.fg}"; border-color-urgent = "0x${colors.fg}";
spawn = [ spawn = [

View File

@ -73,7 +73,7 @@ let
}) enabledFonts)); }) enabledFonts));
# Convert set of fonts to list of packages # Convert set of fonts to list of packages
fontPackageList = map (font: cfg.fonts.pkgs.${font.name}.package) (attrsToList (traceVal fontPackages)); fontPackageList = map (font: cfg.fonts.pkgs.${font.name}.package) (attrsToList fontPackages);
in { in {
imports = [ imports = [
# Import all themes # Import all themes
@ -118,6 +118,18 @@ in {
type = types.str; type = types.str;
default = colors.base05; default = colors.base05;
}; };
focused = mkOption {
type = types.str;
default = cfg.colors.fg;
};
unfocused = mkOption {
type = types.str;
default = colors.base02;
};
alert = mkOption {
type = types.str;
default = "ffffff"; # TODO: Derive color from theme
};
}; };
layout = { layout = {
@ -191,6 +203,10 @@ in {
enable = true; enable = true;
autoEnable = false; autoEnable = false;
targets = {
vscode.enable = config.modules.vscode.enable;
};
base16Scheme = cfg.colorScheme; base16Scheme = cfg.colorScheme;
polarity = if cfg.darkMode then "dark" else "light"; polarity = if cfg.darkMode then "dark" else "light";
@ -199,6 +215,13 @@ in {
sansSerif = getAttrs [ "name" "package" ] cfg.fonts.sansSerif; sansSerif = getAttrs [ "name" "package" ] cfg.fonts.sansSerif;
monospace = getAttrs [ "name" "package" ] cfg.fonts.monospace; monospace = getAttrs [ "name" "package" ] cfg.fonts.monospace;
emoji = getAttrs [ "name" "package" ] cfg.fonts.emoji; emoji = getAttrs [ "name" "package" ] cfg.fonts.emoji;
sizes = {
applications = mkDefault cfg.fonts.serif.recommendedSize;
desktop = mkDefault cfg.fonts.monospace.recommendedSize; # TODO: See below
popups = mkDefault cfg.fonts.monospace.recommendedSize; # TODO: Add dedicated UI font
terminal = mkDefault cfg.fonts.monospace.recommendedSize;
};
}; };
}; };
}; };

View File

@ -1,15 +1,48 @@
{config, lib, pkgs, ... }: {config, lib, pkgs, ... }:
with lib;
let let
cfg = config.modules.vscode; cfg = config.modules.vscode;
theme = config.theming;
in { in {
options.modules.vscode.enable = lib.mkEnableOption "vscode"; options.modules.vscode = {
enable = mkEnableOption "vscode";
codeFont = mkOption {
type = types.anything;
default = theme.fonts.pkgs."Fira Code";
};
};
config = lib.mkIf cfg.enable { config = mkIf cfg.enable {
modules.unfree.allowedPackages = [ "vscode" ]; modules.unfree.allowedPackages = [ "vscode" ];
home.packages = with pkgs; [ theming.fonts.extraFonts = [
vscode cfg.codeFont
]; ];
programs.vscode = {
enable = true;
extensions = with pkgs.vscode-extensions; [
eamodio.gitlens
# Language support
# TODO: Move to separate language modules
bbenoist.nix
rust-lang.rust-analyzer
];
userSettings = {
# Font setup
"editor.fontFamily" = mkForce cfg.codeFont.name;
"editor.fontSize" = cfg.codeFont.recommendedSize;
"editor.fontLigatures" = true;
"terminal.integrated.fontFamily" = mkForce cfg.codeFont.name;
"terminal.integrated.fontSize" = cfg.codeFont.recommendedSize;
# Autoformatting
"editor.formatOnSave" = true;
};
};
}; };
} }

View File

@ -31,6 +31,7 @@ in {
wtype wtype
# waylock # waylock
playerctl playerctl
nix-tree
# Fish plugin dependencies # Fish plugin dependencies
# grc # grc
@ -288,10 +289,10 @@ in {
enable = true; enable = true;
# Dark mode # Dark mode
theme = { #theme = {
name = "Adwaita-dark"; # name = "Adwaita-dark";
package = pkgs.gnome-themes-extra; # package = pkgs.gnome-themes-extra;
}; #};
# Disable CSD # Disable CSD
gtk3.extraCss = css; gtk3.extraCss = css;