iosevka-nerd + new zsh prompt

This commit is contained in:
alina 🌸 2024-03-03 21:39:15 +03:00
parent 8d2806d5bc
commit 3f9ef8fed3
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI
9 changed files with 185 additions and 35 deletions

2
.gitignore vendored
View file

@ -1 +1,3 @@
result
.DS_Store
/test.nix

1
assets/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
built

12
assets/build Executable file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -eau
_name=$(basename $1)
name=${_name%.*}
echo "Building $name"
nix build --file $1 -vL --show-trace
echo "Copying $name to ./built/$name.tgz"
tar -czf "built/$name.tgz" result/*

45
assets/iosevka-nerd.nix Normal file
View file

@ -0,0 +1,45 @@
let
pkgs = import <nixpkgs> {};
nerdify = { font, args ? "--complete" }:
pkgs.stdenvNoCC.mkDerivation {
name = "${font.name}-nerd";
src = pkgs.fetchzip {
url = "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/FontPatcher.zip";
hash = "sha256-H2dPUs6HVKJcjxy5xtz9nL3SSPXKQF3w30/0l7A0PeY=";
stripRoot = false;
};
buildInputs = with pkgs; [
argparse
fontforge
(python3.withPackages (ps: with ps; [ setuptools fontforge ]))
];
buildPhase = ''
font_regexp='.*\.\(ttf\|ttc\|otf\|dfont\)'
find -L ${font} -regex "$font_regexp" -type f -print0 | while IFS= read -rd "" f_; do
f=$(basename "$f_")
echo "nerdifying $f"
mkdir -p $out/$f
fontforge -script $src/font-patcher "$f_" ${args} -out $out/$f -q
done
'';
installPhase = ''
set -eaux
# fontforge tends to spit out a lot of files with the same name
# so we need to move them to a unique location
for f in $out/*; do
if [ -d "$f" ]; then
for g in $f/*; do
mv "$g" "$out/$(basename "$f")-$(basename "$g")"
done
rm -r "$f"
fi
done
'';
};
in nerdify {
font = pkgs.fetchzip {
url = "https://github.com/be5invis/Iosevka/releases/download/v28.1.0/PkgTTC-IosevkaSS05-28.1.0.zip";
hash = "sha256-IOk0+Ha/FG29jIBr2+7Rx89TbnvK9ngx7gAFr5VfBpU=";
stripRoot = false;
};
}

View file

@ -25,17 +25,15 @@
programs.zsh.enable = true;
users.users.teidesu = {
home = "/Users/teidesu";
};
home-manager.users.teidesu = { pkgs, ... }: {
imports = [
(abs "users/teidesu/darwin.nix")
./arc-setup.nix
];
};
imports = [
(import (abs "users/teidesu/darwin.nix") {
home = {
imports = [
./arc-setup.nix
];
};
})
];
system.stateVersion = 4;
}

View file

@ -7,12 +7,19 @@ the config is pretty much a mess and the code sucks.
## impure dependencies
note to self on what needs to be installed on the host manually:
### common
- `/etc/ssh/agenix_key` (darwin: `~/.ssh/agenix_key`) - private key for secret decryption
### koi:
- ~~`/etc/iso/win11.iso` - iso containing windows 11 installer (e.g. this: [magnet](magnet:?xt=urn:btih:56197d53136ffcecbae5225f0ac761121eacdac6&dn=Win11_22H2_English_x64v1.iso&tr=udp%3a%2f%2ftracker.torrent.eu.org%3a451%2fannounce&tr=udp%3a%2f%2ftracker.tiny-vps.com%3a6969%2fannounce&tr=udp%3a%2f%2fopen.stealth.si%3a80%2fannounce))~~ currently unused
- `/etc/vms/haos.img` - qcow2 image for haos vm (can be downloaded from the official website, the KVM/Proxmox image).
- `/etc/ssh/agenix_key` - private key for secret decryption
- `/etc/secureboot/keys` - secure boot keys, generated with `sudo nix-shell -p sbctl --run "sbctl create-keys"`
- to enroll fde onto tpm: `sudo systemd-cryptenroll /dev/nvme0n1p2 --tpm2-device=auto --tpm2-pcrs=0+2+7`
### teidesu-osx
`cp /var/run/current-system/Library/Fonts/* /Library/Fonts` - copy nix-managed fonts to system fonts (waiting for [this PR](https://github.com/LnL7/nix-darwin/pull/754))
nginx may not start the first time, its fine, just run `sudo systemctl restart nginx` and it should work.
its likely due to docker containers not resolving yet.

View file

@ -1,19 +1,32 @@
{ abs, pkgs, lib, inputs, ... }:
{ home ? {}, ... }:
{
imports = [
./common.nix
./fonts.nix
];
home.packages = with pkgs; [
scc
ripgrep
fnm
aria2
ffmpeg
hyfetch
wget
watch
curl
];
users.users.teidesu = {
home = "/Users/teidesu";
};
home-manager.users.teidesu = { pkgs, ... }: {
imports = [
./common.nix
home
];
home.packages = with pkgs; [
scc
ripgrep
fnm
aria2
ffmpeg
hyfetch
wget
watch
curl
android-tools
];
};
}

11
users/teidesu/fonts.nix Normal file
View file

@ -0,0 +1,11 @@
{ pkgs, lib, ... }:
{
fonts.fonts = [
(pkgs.fetchzip {
name = "iosevka-nerd";
url = "https://s3.tei.su/iosevka-nerd.tgz";
hash = "sha256-WrtCS1nwsGtYG7W7EiaaC4LVq1bGod4ygFC7VpSuDx0=";
})
];
}

View file

@ -1,16 +1,73 @@
{ pkgs, lib, ... }:
{
let
starshipConfig = {
# based on https://starship.rs/presets/pastel-powerline.html
format =
"$character" +
"$hostname" +
"[](fg:#be15dc bg:#FCA17D)" +
"$git_branch" +
"$git_status" +
"[](fg:#FCA17D bg:#86BBD8)" +
"$nodejs" +
"[](fg:#86BBD8 bg:#33658A)" +
"$directory" +
"[ ](fg:#33658A)" +
"";
add_newline = false;
character = {
success_symbol = "[](#be15dc)[ алина 🌸 ](bg:#be15dc)";
error_symbol = "[](#dc156b)[ алина 🌸 ](bg:#be15dc)";
format = "$symbol";
};
hostname = {
style = ''bg:#be15dc'';
format = "[$hostname ]($style)";
ssh_only = true;
};
directory = {
style = "bg:#33658A";
format = "[ $path ]($style)";
truncation_length = 3;
truncation_symbol = "/";
};
git_branch = {
symbol = "";
style = "bg:#FCA17D fg:black";
format = "[ $symbol $branch ]($style)";
};
git_status = {
style = "bg:#FCA17D fg:black";
format = "[$all_status$ahead_behind ]($style)";
};
nodejs = {
symbol = "";
style = "bg:#86BBD8 fg:black";
version_format = "$major.$minor";
format = "[ $symbol ($version) ]($style)";
};
env_var._HOST_COLOR = {
format = "$env_value";
};
};
in {
programs.zsh = {
enable = true;
oh-my-zsh = {
enable = true;
theme = "agnoster";
extraConfig = ''
zstyle ':bracketed-paste-magic' active-widgets '.self-*'
'';
};
# oh-my-zsh = {
# enable = true;
# theme = "agnoster";
# extraConfig = ''
# zstyle ':bracketed-paste-magic' active-widgets '.self-*'
# '';
# };
syntaxHighlighting.enable = true;
enableAutosuggestions = true;
@ -24,8 +81,12 @@
initExtra = ''
unsetopt correct_all
zstyle ':bracketed-paste-magic' active-widgets '.self-*'
export _HOST_COLOR="#$(([##16]`hostname | cksum | cut -f 1 -d ' '` % 16777215))"
export STARSHIP_CONFIG=${(pkgs.formats.toml {}).generate "starship.toml" starshipConfig}
eval "$(${pkgs.starship}/bin/starship init zsh)"
CURRENT_BG="$(( `hostname | cksum | cut -f 1 -d ' '` % 255 ))"
CASE_SENSITIVE="false"
HYPHEN_INSENSITIVE="true"
ENABLE_CORRECTION="true"