Generic progress
This commit is contained in:
parent
dd327a977a
commit
4f49ea8383
|
@ -0,0 +1,11 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
# Import modules
|
||||
./modules/default.nix
|
||||
|
||||
# Import custom packages
|
||||
./pkgs/default.nix
|
||||
];
|
||||
}
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
{
|
||||
imports = [
|
||||
# Import modules
|
||||
../modules/default.nix
|
||||
# Import environment
|
||||
../default.nix
|
||||
|
||||
# TODO: Remove later
|
||||
../merged.nix
|
||||
|
|
26
merged.nix
26
merged.nix
|
@ -256,19 +256,19 @@ in {
|
|||
# ];
|
||||
# };
|
||||
|
||||
fonts.fontconfig.localConf = ''
|
||||
<alias>
|
||||
<family>Dina</family>
|
||||
<prefer>
|
||||
<family>Dina</family>
|
||||
<family>Cozette</family>
|
||||
<family>CozetteVector</family>
|
||||
<family>Fixed</family>
|
||||
<family>Symbols Nerd Font Mono</family>
|
||||
<family>WenQuanYi Bitmap Song</family>
|
||||
</prefer>
|
||||
</alias>
|
||||
'';
|
||||
# fonts.fontconfig.localConf = ''
|
||||
# <alias>
|
||||
# <family>Dina</family>
|
||||
# <prefer>
|
||||
# <family>Dina</family>
|
||||
# <family>Cozette</family>
|
||||
# <family>Cozette Vector</family>
|
||||
# <family>Fixed</family>
|
||||
# <family>Symbols Nerd Font Mono</family>
|
||||
# <family>WenQuanYi Bitmap Song</family>
|
||||
# </prefer>
|
||||
# </alias>
|
||||
# '';
|
||||
|
||||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
|
|
|
@ -3,6 +3,19 @@
|
|||
with lib;
|
||||
let
|
||||
cfg = config.modules.fontconfig;
|
||||
|
||||
aliasConfig = font: ''
|
||||
<alias>
|
||||
<family>${font.name}</family>
|
||||
|
||||
<prefer>
|
||||
<family>${font.name}</family>
|
||||
${concatStrings (map (font: " <family>${font}</family>\n") font.fallbackFonts)}
|
||||
</prefer>
|
||||
</alias>
|
||||
'';
|
||||
|
||||
configContent = concatStrings (map (font: aliasConfig config.theming.fonts.pkgs.${font}) config.theming.fonts.installed);
|
||||
in {
|
||||
options.modules.fontconfig = {
|
||||
enable = mkEnableOption "fontconfig";
|
||||
|
@ -27,5 +40,18 @@ in {
|
|||
];
|
||||
};
|
||||
};
|
||||
|
||||
home.file.".config/fontconfig/conf.d/20-family-fallbacks.conf" = {
|
||||
enable = true;
|
||||
|
||||
text = ''
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
|
||||
<fontconfig>
|
||||
|
||||
${configContent}
|
||||
</fontconfig>
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -73,7 +73,8 @@ let
|
|||
}) enabledFonts));
|
||||
|
||||
# Convert set of fonts to list of packages
|
||||
fontPackageList = map (font: cfg.fonts.pkgs.${font.name}.package) (attrsToList fontPackages);
|
||||
fontNameList = map (font: font.name) (attrsToList fontPackages);
|
||||
fontPackageList = map (font: cfg.fonts.pkgs.${font}.package) fontNameList;
|
||||
in {
|
||||
imports = [
|
||||
# Import all themes
|
||||
|
@ -81,12 +82,6 @@ in {
|
|||
./themes/catppuccin.nix
|
||||
];
|
||||
|
||||
options.testing.test = mkOption {
|
||||
type = types.anything;
|
||||
default = traced;
|
||||
description = "Wowzah";
|
||||
};
|
||||
|
||||
options.modules.theming.enable = mkEnableOption "theming";
|
||||
|
||||
options.theming = let colors = config.theming.schemeColors; in {
|
||||
|
@ -162,6 +157,12 @@ in {
|
|||
description = "All available font modules.";
|
||||
};
|
||||
|
||||
installed = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = fontNameList;
|
||||
description = "List of installed fonts.";
|
||||
};
|
||||
|
||||
serif = mkOption {
|
||||
type = fontModule;
|
||||
description = "Default serif font";
|
||||
|
|
|
@ -6,5 +6,6 @@
|
|||
recommendedSize = 9;
|
||||
fallbackFonts = [
|
||||
"Cozette"
|
||||
"Symbols Nerd Font Mono"
|
||||
];
|
||||
}
|
|
@ -4,5 +4,7 @@
|
|||
name = "Fira Code";
|
||||
package = pkgs.fira-code;
|
||||
recommendedSize = 12;
|
||||
fallbackFonts = [];
|
||||
fallbackFonts = [
|
||||
"Symbols Nerd Font Mono"
|
||||
];
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
name = "WenQuanYi Zen Hei";
|
||||
recommendedSize = 12;
|
||||
fallbackFonts = [];
|
||||
}
|
|
@ -11,6 +11,10 @@ in {
|
|||
type = types.anything;
|
||||
default = theme.fonts.pkgs."Fira Code";
|
||||
};
|
||||
fallbackFont = mkOption {
|
||||
type = types.anything;
|
||||
default = theme.fonts.pkgs."Symbols Nerd Font Mono";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
@ -34,11 +38,12 @@ in {
|
|||
|
||||
userSettings = {
|
||||
# Font setup
|
||||
"editor.fontFamily" = mkForce cfg.codeFont.name;
|
||||
"editor.fontSize" = cfg.codeFont.recommendedSize;
|
||||
# TODO: Move the conversion factor to theme settings
|
||||
"editor.fontFamily" = mkForce "'${cfg.codeFont.name}', '${cfg.fallbackFont.name}'";
|
||||
"editor.fontSize" = mkForce (cfg.codeFont.recommendedSize); # Convert pt to px
|
||||
"editor.fontLigatures" = true;
|
||||
"terminal.integrated.fontFamily" = mkForce cfg.codeFont.name;
|
||||
"terminal.integrated.fontSize" = cfg.codeFont.recommendedSize;
|
||||
"terminal.integrated.fontFamily" = mkForce "'${cfg.codeFont.name}', '${cfg.fallbackFont.name}'";
|
||||
"terminal.integrated.fontSize" = mkForce (cfg.codeFont.recommendedSize); # Convert pt to px
|
||||
|
||||
# Autoformatting
|
||||
"editor.formatOnSave" = true;
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
mkPackage = path: (mkOption {
|
||||
type = types.package;
|
||||
default = (pkgs.callPackage path) {};
|
||||
description = (mkPackage path).default.name;
|
||||
});
|
||||
in {
|
||||
options.pkgs = {
|
||||
# Add all custom packages
|
||||
wqy-zenhei = mkPackage ./fonts/wqy-zenhei.nix;
|
||||
wqy-microhei = mkPackage ./fonts/wqy-microhei.nix;
|
||||
wqy-bitmapsong = mkPackage ./fonts/wqy-bitmapsong.nix;
|
||||
};
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
pname = "wqy-bitmapsong-pcf";
|
||||
version = "1.0.0-RC1";
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "mirror://sourceforge/wqy/${pname}-${version}.tar.gz";
|
||||
#hash = "sha256-r2Vf7ftJCqu7jOc2AqCKaoR/r8eNw2P/OQGqbDOEyl0=";
|
||||
hash = "sha256-0uvwkRUbvJ0remTnlP8dElRjaBVd6iukNYBTE/CTO7s=";
|
||||
};
|
||||
|
||||
buildInputs = [ pkgs.fontforge ];
|
||||
buildPhase = ''
|
||||
newName() {
|
||||
test "''${1:5:1}" = i && _it=Italic || _it=
|
||||
case ''${1:6:3} in
|
||||
400) test -z $it && _weight=Medium ;;
|
||||
700) _weight=Bold ;;
|
||||
esac
|
||||
_pt=''${1%.pcf}
|
||||
_pt=''${_pt#*-}
|
||||
echo "WenQuanYi_Bitmap_Song$_weight$_it$_pt"
|
||||
}
|
||||
|
||||
for i in *.pcf; do
|
||||
fontforge -lang=ff -c "Open(\"$i\"); Generate(\"$(newName $i).otb\")"
|
||||
done
|
||||
'';
|
||||
installPhase = ''
|
||||
install -Dm644 *.otb -t $out/share/fonts/
|
||||
'';
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
pname = "wqy-microhei";
|
||||
version = "0.2.0-beta";
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "mirror://sourceforge/wqy/${pname}-${version}.tar.gz";
|
||||
hash = "sha256-KAKsgCOqNqZupudEWFTjoHjTd///QhaTQb0jeHH3IT4=";
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install -Dm644 *.ttc -t $out/share/fonts/
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
pname = "wqy-zenhei";
|
||||
version = "0.9.45";
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "mirror://sourceforge/wqy/${pname}-${version}.tar.gz";
|
||||
hash = "sha256-5LfjBkdb+UJ9F1dXjw5FKJMMhMROqj8WfUxC8RDuddY=";
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install -Dm644 *.ttc -t $out/share/fonts/
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
# TODO: Remove later
|
||||
imports = [
|
||||
./janMerged.nix
|
||||
];
|
||||
|
|
|
@ -289,10 +289,10 @@ in {
|
|||
enable = true;
|
||||
|
||||
# Dark mode
|
||||
#theme = {
|
||||
# name = "Adwaita-dark";
|
||||
# package = pkgs.gnome-themes-extra;
|
||||
#};
|
||||
theme = {
|
||||
name = "Adwaita-dark";
|
||||
package = pkgs.gnome-themes-extra;
|
||||
};
|
||||
|
||||
# Disable CSD
|
||||
gtk3.extraCss = css;
|
||||
|
|
Loading…
Reference in New Issue