mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-07-09 22:22:40 +02:00
feat: replace i3blocks/rofi's config with polybar-themes - i3
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
_: (self: super: {
|
||||
icomoon-feather-icon-font = super.callPackage ./icomoon-feather-icon-font.nix {};
|
||||
})
|
||||
@@ -1,42 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
fetchgit,
|
||||
}:
|
||||
stdenvNoCC.mkDerivation rec {
|
||||
pname = "icomoon-feather-icon-font";
|
||||
version = "2023-05-06";
|
||||
|
||||
# 参考 https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=ttf-icomoon-feather
|
||||
src = fetchgit {
|
||||
url = "https://github.com/adi1090x/polybar-themes.git";
|
||||
rev = "47b66337a92a1afd2240ed7094ffcb039cc686cf"; # git commit id
|
||||
sparseCheckout = ["fonts/feather.ttf"]; # only fetch the feather.ttf file
|
||||
|
||||
# the sha256 is used to verify the integrity of the downloaded source, and alse cache the build result.
|
||||
# so if you copy other package src's sha256, you will get a cached build result of that package, and all configs in this file will be ignored.
|
||||
# specify sha256 to empty and build it, then an error will indicate the correct sha256
|
||||
sha256 = "sha256-R+UpUFkXDrxKcX7ljLara+1B1rOMdKGZiLQq1/ojgP4=";
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install -Dm644 fonts/feather.ttf -t $out/share/fonts/truetype/
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/feathericons/feather";
|
||||
description = "Icomoon feather font";
|
||||
inherit version;
|
||||
longDescription = ''
|
||||
Feather is a collection of simply beautiful open source icons.
|
||||
Each icon is designed on a 24x24 grid with an emphasis on simplicity, consistency, and flexibility.
|
||||
'';
|
||||
license = licenses.mit;
|
||||
maintainers = [maintainers.ryan4yin];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{polybar-themes, ...} : (_: super: {
|
||||
polybar-themes-simple = super.callPackage ./package.nix { inherit polybar-themes;};
|
||||
})
|
||||
@@ -0,0 +1,60 @@
|
||||
{
|
||||
pkgs,
|
||||
polybar-themes,
|
||||
...
|
||||
}:
|
||||
|
||||
# use the themes provided by:
|
||||
# https://github.com/adi1090x/polybar-themes
|
||||
pkgs.nuenv.mkDerivation {
|
||||
name = "polybar-themes-simple";
|
||||
src = polybar-themes;
|
||||
debug = true;
|
||||
packages = [pkgs.coreutils];
|
||||
build = ''
|
||||
let out_fonts = $"($env.out)/fonts"
|
||||
mkdir $out_fonts
|
||||
cp -rf fonts/* $out_fonts
|
||||
|
||||
let out_themes = $"($env.out)/themes"
|
||||
mkdir $out_themes
|
||||
cp -rf simple/* $out_themes
|
||||
|
||||
# adjust the font size
|
||||
ls "simple/**/config.ini" | each { |it|
|
||||
let tmp_it = $"tmp/($it.name)"
|
||||
# prepare the output directory
|
||||
$tmp_it | path dirname | mkdir $in
|
||||
echo $"cusomizing ($it.name) and saving to ($tmp_it)"
|
||||
|
||||
open $it.name
|
||||
# remova all font settings
|
||||
| str replace --all --multiline -r "font-[0-4].*=.+|height.*=.+" ""
|
||||
# add hidpi font settings
|
||||
| append "
|
||||
height = 64
|
||||
; Text Fonts
|
||||
font-0 = Iosevka Nerd Font:style=Medium:size=15;4
|
||||
|
||||
; Icons Fonts
|
||||
font-1 = feather:style=Medium:size=24;3
|
||||
|
||||
; Powerline Glyphs
|
||||
font-2 = Iosevka Nerd Font:style=Medium:size=32;3
|
||||
|
||||
; Larger font size for bar fill icons
|
||||
font-3 = Iosevka Nerd Font:style=Medium:size=24;4
|
||||
|
||||
; Smaller font size for shorter spaces
|
||||
font-4 = Iosevka Nerd Font:style=Medium:size=12;4
|
||||
"
|
||||
| save -f $tmp_it
|
||||
}
|
||||
|
||||
echo "all the themes:"
|
||||
let log = ls tmp/**/*
|
||||
echo $log
|
||||
echo "copying the tmp themes to ($out_themes)"
|
||||
cp -rf tmp/simple/* $out_themes
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user