initial commit

This commit is contained in:
tx0 2025-03-02 16:53:58 +05:00
commit 58ff0046c6
54 changed files with 6798 additions and 0 deletions

4303
flake.lock Normal file

File diff suppressed because it is too large Load diff

104
flake.nix Normal file
View file

@ -0,0 +1,104 @@
{
description = ''
$$\
\__|
$$\ $$\ $$$$$$$\ $$\ $$\ $$\ $$$$$$\ $$$$$$\ $$$$$$$\ $$$$$$\
$$ | $$ |$$ __$$\ $$ |\$$\ $$ |$$ __$$\ $$ __$$\ $$ _____|$$ __$$\
$$ | $$ |$$ | $$ |$$ | \$$\$$ / $$$$$$$$ |$$ | \__|\$$$$$$\ $$$$$$$$ |
$$ | $$ |$$ | $$ |$$ | \$$$ / $$ ____|$$ | \____$$\ $$ ____|
\$$$$$$ |$$ | $$ |$$ | \$ / \$$$$$$$\ $$ | $$$$$$$ |\$$$$$$$\
\______/ \__| \__|\__| \_/ \_______|\__| \_______/ \_______|
'';
outputs = {
self,
stylix,
nixpkgs,
nixpkgs-master,
nix-index-database,
flake-parts,
nypkgs,
home-manager,
nvf,
lix-module,
...
} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
flake = let
system = "x86_64-linux";
in {
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs;};
modules = [
stylix.nixosModules.stylix
lix-module.nixosModules.default
./hosts/nixos
];
};
homeConfigurations.tx0 = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [];
};
extraSpecialArgs = {inherit inputs;};
modules = [
stylix.homeManagerModules.stylix
nix-index-database.hmModules.nix-index
nvf.homeManagerModules.default
./home
];
};
};
systems = ["x86_64-linux"];
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/release-24.11";
nixpkgs-master.url = "github:nixos/nixpkgs/master";
nur.url = "github:nix-community/NUR";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-parts.url = "github:hercules-ci/flake-parts";
stylix.url = "github:danth/stylix";
zen-browser.url = "github:0xc000022070/zen-browser-flake";
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
programsdb = {
url = "github:wamserma/flake-programs-sqlite";
inputs.nixpkgs.follows = "nixpkgs";
};
nypkgs = {
url = "github:yunfachi/nypkgs";
inputs.nixpkgs.follows = "nixpkgs";
};
anyrun = {
url = "github:anyrun-org/anyrun";
inputs.nixpkgs.follows = "nixpkgs";
};
nvf.url = "github:notashelf/nvf";
hyprland = {
url = "github:hyprwm/Hyprland/v0.46.2";
};
lix-module = {
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.92.0.tar.gz";
inputs.nixpkgs.follows = "nixpkgs";
};
};
}

View file

@ -0,0 +1,43 @@
{
lib,
config,
...
}: let
cfg = config.universe.alacritty;
in {
options.universe.alacritty = {
enable = lib.mkEnableOption "alacritty terminal";
};
config = lib.mkIf cfg.enable {
programs.alacritty = {
enable = true;
settings = {
general = {live_config_reload = true;};
# font = {
# normal = { family = "JetBrainsMono Nerd Font Mono"; style = "Regular"; };
# bold = { family = "JetBrainsMono Nerd Font Mono"; style = "Bold"; };
# italic = { family = "JetBrainsMono Nerd Font Mono"; style = "Italic"; };
# size = 14;
# };
font.glyph_offset = {
x = 0;
y = 0;
};
window = {
padding = {
x = 10;
y = 10;
};
dynamic_padding = true;
};
terminal.shell = {
program = "tmux";
args = ["new"];
};
};
};
};
}

32
home/anyrun/default.nix Normal file
View file

@ -0,0 +1,32 @@
{
pkgs,
inputs,
config,
...
}: {
imports = [inputs.anyrun.homeManagerModules.default];
programs.anyrun = {
enable = true;
config = {
plugins = [
inputs.anyrun.packages.${pkgs.system}.applications
];
x = {fraction = 0.5;};
y = {absolute = 20;};
width = {absolute = 600;};
showResultsImmediately = false;
closeOnClick = false;
hidePluginInfo = true;
hideIcons = false;
layer = "top";
maxEntries = null;
};
extraCss = ''
window {
background-color: transparent;
}
'';
};
}

16
home/default.nix Normal file
View file

@ -0,0 +1,16 @@
{inputs, ...}: {
imports = inputs.nypkgs.legacyPackages."x86_64-linux".lib.umport {
path = ./.;
include = [
./packages/default.nix
./waybar/default.nix
];
exclude = [
./default.nix
./packages
./waybar
];
};
}

17
home/foot/default.nix Normal file
View file

@ -0,0 +1,17 @@
{pkgs, ...}: {
programs.foot = {
enable = true;
server.enable = true;
settings = {
main = {
term = "xterm-256color";
shell = "tmux new";
pad = "10x10";
};
mouse = {
hide-when-typing = "yes";
};
};
};
}

17
home/ghostty/default.nix Normal file
View file

@ -0,0 +1,17 @@
{pkgs, ...}: {
programs.ghostty = {
enable = true;
enableFishIntegration = true;
installBatSyntax = true;
installVimSyntax = false;
clearDefaultKeybinds = true;
settings = {
window-padding-x = 10;
window-padding-y = 10;
window-vsync = true;
window-decoration = "none";
command = "tmux new";
confirm-close-surface = false;
};
};
}

74
home/hyprland/binds.nix Normal file
View file

@ -0,0 +1,74 @@
let
terminal = "foot";
fileManager = "nautilus -w";
discord = "vesktop";
telegram = "telegram-desktop";
browser = "zen";
menu = "anyrun";
in {
wayland.windowManager.hyprland.settings = {
bind = [
# Software
"SUPER, RETURN, exec, ${terminal}"
"SUPER, E, exec, ${fileManager}"
"SUPER, D, exec, ${discord}"
"SUPER, T, exec, ${telegram}"
"SUPER, B, exec, ${browser}"
# Controls
"SUPER, Q, killactive, "
"SUPER, M, exit, "
"SUPER, C, togglefloating, "
"SUPER, SPACE, exec, ${menu}"
"SUPER, Z, pseudo"
"SUPER, V, layoutmsg, swapsplit"
"SUPER, X, togglesplit"
"SUPER, Home, exec, hyprshot -m region"
"SUPER, Prior, exec, hyprshot -m window"
"SUPER, Next, exec, hyprshot -m output"
"SUPER Ctrl, Q, exec, $locker"
# Media
", XF86AudioPlay, exec, playerctl play-pause"
", XF86AudioNext, exec, playerctl next"
", XF86AudioPrev, exec, playerctl previous"
", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
", XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%+"
", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-"
# Focus
"SUPER, left, movefocus, l "
"SUPER, right, movefocus, r "
"SUPER, up, movefocus, u "
"SUPER, down, movefocus, d "
# Workspaces
"SUPER, 1, workspace, 1 "
"SUPER, 2, workspace, 2 "
"SUPER, 3, workspace, 3 "
"SUPER, 4, workspace, 4 "
"SUPER, 5, workspace, 5 "
"SUPER, 6, workspace, 6 "
"SUPER, 7, workspace, 7"
"SUPER, 8, workspace, 8"
"SUPER, 9, workspace, 9"
"SUPER, 0, workspace, 10"
"SUPER SHIFT, 1, movetoworkspace, 1"
"SUPER SHIFT, 2, movetoworkspace, 2"
"SUPER SHIFT, 3, movetoworkspace, 3"
"SUPER SHIFT, 4, movetoworkspace, 4"
"SUPER SHIFT, 5, movetoworkspace, 5"
"SUPER SHIFT, 6, movetoworkspace, 6"
"SUPER SHIFT, 7, movetoworkspace, 7"
"SUPER SHIFT, 8, movetoworkspace, 8"
"SUPER SHIFT, 9, movetoworkspace, 9"
"SUPER SHIFT, 0, movetoworkspace, 10"
"SUPER, mouse_down, workspace, e+1"
"SUPER, mouse_up, workspace, e-1"
];
bindm = [
"SUPER, mouse:272, movewindow"
"SUPER, mouse:273, resizewindow"
];
};
}

143
home/hyprland/default.nix Normal file
View file

@ -0,0 +1,143 @@
{
pkgs,
inputs,
...
}: {
wayland.windowManager.hyprland = {
enable = true;
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
portalPackage = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
systemd.variables = ["--all"];
settings = {
monitor = [
"DP-1, 3440x1440@100, 1920x0, 1"
"HDMI-A-1, 1920x1200@60, 0x0, 1"
];
general = {
gaps_in = 15;
gaps_out = 40;
border_size = 3;
resize_on_border = false;
allow_tearing = false;
layout = "dwindle";
};
decoration = {
rounding = 10;
active_opacity = 1.0;
inactive_opacity = 1.0;
dim_inactive = false;
dim_strength = 0.2;
blur = {
enabled = true;
size = 3;
passes = 4;
noise = 0.07;
xray = true;
brightness = 0.4;
popups = false;
};
};
dwindle = {
pseudotile = false;
preserve_split = true;
smart_split = false;
smart_resizing = false;
};
misc = {
disable_hyprland_logo = true;
};
layerrule = [
"blur, notifications"
"ignorezero, notifications"
"blur, rofi"
"ignorezero, rofi"
"animation fade, selection"
"animation slide top, anyrun"
];
windowrulev2 = [
"suppressevent maximize, class:.*"
"float, class:^(com.saivert.pwvucontrol)$"
"size 696 570, class:^(com.saivert.pwvucontrol)$"
"move 1654 807, class:^(com.saivert.pwvucontrol)$"
"monitor DP-1, class:^(com.saivert.pwvucontrol)$"
"opacity 0.9, class:^(com.saivert.pwvucontrol)$"
"maximize, class:^(org.telegram.desktop)$,title:^(Media viewer)$"
"float, class:^(org.telegram.desktop)$,title:^(Media viewer)$"
"float, class:^(nemo)$,title:^.*(Properties)$"
"float, class:^(zen-alpha)$,title:^(Library)$"
"opacity 0.9, class:^(zen-alpha)$,title:^(Library)$"
"opacity 0.9, class:^(Spotify)$"
"noblur, class:^()$,title:^()$"
"plugin:chromakey,fullscreen:0"
"opacity 0.999,fullscreen:0"
];
animations = {
enabled = true;
# bezier = [
# "myBezier, 0.05, 1, 0.1, 1"
# ];
# animation = [
# "windows, 1, 7, myBezier, slide"
# "fade, 1, 7, myBezier"
# "workspaces, 1, 6, myBezier"
# "layers, 1, 6, myBezier, slide bottom"
# ];
bezier = [
"easeOutQuint,0.23,1,0.32,1"
"aseInOutCubic,0.65,0.05,0.36,1"
"linear,0,0,1,1"
"almostLinear,0.5,0.5,0.75,1.0"
"quick,0.15,0,0.1,1"
];
animation = [
"global, 1, 10, default"
"border, 1, 5.39, easeOutQuint"
"windows, 1, 4.79, easeOutQuint"
"windowsIn, 1, 4.1, easeOutQuint, popin 87%"
"windowsOut, 1, 1.49, linear, popin 87%"
"fadeIn, 1, 1.73, almostLinear"
"fadeOut, 1, 1.46, almostLinear"
"fade, 1, 3.03, quick"
"layers, 1, 3.81, easeOutQuint"
"layersIn, 1, 4, easeOutQuint, fade"
"layersOut, 1, 1.5, linear, fade"
"fadeLayersIn, 1, 1.79, almostLinear"
"fadeLayersOut, 1, 1.39, almostLinear"
"workspaces, 1, 1.94, aseInOutCubic"
"workspacesIn, 1, 1.21, aseInOutCubic"
"workspacesOut, 1, 1.94, aseInOutCubic"
];
};
input = {
kb_layout = "us,ru";
kb_options = "grp:caps_toggle";
follow_mouse = 1;
sensitivity = 0;
};
exec-once = [
"hyprctl setcursor Bibata-Modern-Classic 24"
"waybar"
"telegram-desktop -startintray"
"vesktop"
"nm-applet"
"${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"
"hyprpaper"
];
};
};
}

13
home/mako/default.nix Normal file
View file

@ -0,0 +1,13 @@
{config, ...}: {
services.mako = {
enable = true;
anchor = "bottom-right";
output = "DP-1";
borderSize = 3;
width = 300;
height = 110;
defaultTimeout = 5000;
ignoreTimeout = true;
borderRadius = 3;
};
}

33
home/nix/default.nix Normal file
View file

@ -0,0 +1,33 @@
{
inputs,
pkgs,
...
}: {
nix = {
package = pkgs.lix;
nixPath = ["nixpkgs=${inputs.nixpkgs}"];
settings = {
extra-substituters = [
"https://cache.garnix.io"
"https://nix-community.cachix.org"
"https://cache.nixos.org/"
"https://hyprland.cachix.org"
];
extra-trusted-public-keys = [
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
];
builders-use-substitutes = true;
auto-optimise-store = true;
trusted-users = [
"tx0"
"root"
"@wheel"
];
warn-dirty = false;
extra-experimental-features = ["nix-command" "flakes"];
};
};
}

9
home/nixpkgs/default.nix Normal file
View file

@ -0,0 +1,9 @@
{...}: {
nixpkgs.config = {
allowUnfree = true;
allowBroken = true;
allowAliases = true;
allowInsecure = true;
allowUnfreePredicate = _: true;
};
}

80
home/packages/default.nix Normal file
View file

@ -0,0 +1,80 @@
{
pkgs,
inputs,
...
}: {
home.packages = with pkgs; [
# flakes
inputs.zen-browser.packages.${system}.default
(callPackage ./derivations/bunnyfetch {})
#fonts
(google-fonts.override {fonts = ["Poppins" "Inter" "Roboto Mono"];})
material-symbols
nerd-fonts.jetbrains-mono
nerd-fonts.caskaydia-cove
dejavu_fonts
font-awesome
cantarell-fonts
# code
git
go
poetry
# vscode
python313
# utilites
wl-clipboard
xclip
ufetch
eza
bat
distrobox
android-tools
zip
unzip
nix-output-monitor
#net
amneziawg-go
amneziawg-tools
# other
playerctl
gtk3
gtk4
adwaita-qt
adwaita-qt6
qadwaitadecorations
qadwaitadecorations-qt6
libsForQt5.qt5ct
kdePackages.qt6ct
hicolor-icon-theme
rpm
p7zip
#ueberzugpp
# gui
deluge-gtk
bottles
hyprpaper
virt-viewer
libreoffice
font-manager
networkmanagerapplet
nautilus
waybar
mako
hyprpicker
hyprshot
playerctl
pwvucontrol
viewnior
mate.engrampa
telegram-desktop
inputs.nixpkgs-stable.legacyPackages.${system}.vesktop
prismlauncher
inkscape
];
}

View file

@ -0,0 +1,61 @@
set +o nounset
# shellcheck source=/dev/null
source /etc/os-release
username="$(whoami)"
hostname="$(cat /etc/hostname)"
kernel="$(uname -r)"
shell="$(basename "$SHELL")"
ui='unknown'
uitype='UI'
if [ -n "${DE}" ]; then
ui="${DE}"
uitype='DE'
elif [ -n "${WM}" ]; then
ui="${WM}"
uitype='WM'
elif [ -n "${XDG_CURRENT_DESKTOP}" ]; then
ui="${XDG_CURRENT_DESKTOP}"
uitype='DE'
elif [ -n "${DESKTOP_SESSION}" ]; then
ui="${DESKTOP_SESSION}"
uitype='DE'
elif [ -n "${rcwm}" ]; then
ui="${rcwm}"
uitype='WM'
elif [ -n "${XDG_SESSION_TYPE}" ]; then
ui="${XDG_SESSION_TYPE}"
fi
ui="$(basename "${ui}")"
# shellcheck disable=SC2034
black='\033[0;30m'
# shellcheck disable=SC2034
red='\033[0;31m'
# shellcheck disable=SC2034
green='\033[0;32m'
# shellcheck disable=SC2034
yellow='\033[0;33m'
# shellcheck disable=SC2034
blue='\033[0;34m'
# shellcheck disable=SC2034
magenta='\033[0;35m'
# shellcheck disable=SC2034
cyan='\033[0;36m'
# shellcheck disable=SC2034
white='\033[0;37m'
# shellcheck disable=SC2034
b='\e[1m'
r='\e[0m'
# shellcheck disable=SC2059
printf "
${red}${username}@${hostname}${r}
(\ /) ${blue}OS${r} ${NAME}
( . .) ${yellow}Kernel${r} ${kernel}
c(\")(\") ${green}Shell${r} ${shell}
${magenta}${uitype}${r} ${ui}
"

View file

@ -0,0 +1,13 @@
{
lib,
coreutils,
writeShellApplication,
}: let
in
writeShellApplication {
name = "bunnyfetch";
runtimeInputs = [
coreutils
];
text = builtins.readFile ./bunnyfetch.sh;
}

40
home/profile/default.nix Normal file
View file

@ -0,0 +1,40 @@
{
pkgs,
config,
...
}: {
home = {
username = "tx0";
homeDirectory = "/home/tx0/";
stateVersion = "24.11";
sessionVariables = {
EDITOR = "${config.home.homeDirectory}/.nix-profile/bin/nvim";
HYPRSHOT_DIR = "$HOME/Pictures/Screenshots/";
FLAKE = "/home/tx0/nixos/";
NIXOS_OZONE_WL = 1;
ELECTRON_OZONE_PLATFORM_HINT = 1;
MOZ_ENABLE_WAYLAND = 1;
fish_greeting = "";
};
sessionPath = ["$HOME/.local/bin"];
};
gtk.gtk3.bookmarks = [
"file:///mnt/data/"
"file:///home/tx0/Downloads/"
"file:///home/tx0/Documents/"
"file:///home/tx0/Pictures/Screenshots"
];
services.udiskie = {
enable = false;
settings = {
program_options = {
file_manager = "${pkgs.nautilus}/bin/nautilus";
};
};
};
universe.alacritty.enable = true;
}

112
home/stylix/default.nix Normal file
View file

@ -0,0 +1,112 @@
{
pkgs,
config,
...
}: let
enableLutgen = false;
in {
dconf.settings = {
"org/gnome/desktop/wm/preferences" = {
button-layout = ":";
};
"org.gnome.desktop.interface" = {
gtk-color-scheme = "prefer-dark";
color-scheme = "prefer-dark";
};
};
home.pointerCursor = {
gtk.enable = true;
x11.enable = true;
};
gtk = {
enable = true;
iconTheme = {
package = pkgs.papirus-icon-theme;
name = "Papirus-Dark";
};
};
qt = {
# platformTheme.name = lib.mkForce "gtk3";
enable = true;
};
stylix = {
enable = true;
base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-material-dark-medium.yaml";
image =
if enableLutgen
then let
input = ./wallpapers.jpg;
level = 10;
lum = 1.0;
preserve = false;
in
pkgs.runCommand "output.png" {} ''
${pkgs.lutgen}/bin/lutgen apply ${input} -l ${builtins.toString level} -L ${builtins.toString lum} ${
if preserve == true
then "-P"
else ""
} -o $out -- ${
builtins.concatStringsSep " " (with config.lib.stylix.colors; [
base00
base01
base02
base03
base04
base05
base06
base07
base08
base09
base0A
base0B
base0C
base0D
base0E
base0F
])
}
''
else ./wallpapers.jpg;
polarity = "dark";
cursor = {
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Classic";
size = 24;
};
fonts = {
serif = {
name = "Cantarell";
package = pkgs.cantarell-fonts;
};
monospace = {
name = "CaskaydiaCove Nerd Font Mono";
package = pkgs.nerd-fonts.jetbrains-mono;
};
sansSerif = config.stylix.fonts.serif;
emoji = config.stylix.fonts.serif;
sizes = {
desktop = 12;
applications = 12;
popups = 12;
terminal = 16;
};
};
opacity = {terminal = 0.65;};
targets = {
kde.enable = false;
waybar.enable = false;
vesktop.enable = true;
};
};
}

BIN
home/stylix/wallpapers.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

41
home/symlinks/default.nix Normal file
View file

@ -0,0 +1,41 @@
{config, ...}: {
home.file = {
# Create symbolic links for directories
Documents = {
source = config.lib.file.mkOutOfStoreSymlink "/mnt/data_home/Documents";
target = "${config.home.homeDirectory}/Documents";
};
Desktop = {
source = config.lib.file.mkOutOfStoreSymlink "/mnt/data_home/Desktop";
target = "${config.home.homeDirectory}/Desktop";
};
Downloads = {
source = config.lib.file.mkOutOfStoreSymlink "/mnt/data_home/Downloads";
target = "${config.home.homeDirectory}/Downloads";
};
Music = {
source = config.lib.file.mkOutOfStoreSymlink "/mnt/data_home/Music";
target = "${config.home.homeDirectory}/Music";
};
Pictures = {
source = config.lib.file.mkOutOfStoreSymlink "/mnt/data_home/Pictures";
target = "${config.home.homeDirectory}/Pictures";
};
Templates = {
source = config.lib.file.mkOutOfStoreSymlink "/mnt/data_home/Templates";
target = "${config.home.homeDirectory}/Templates";
};
Videos = {
source = config.lib.file.mkOutOfStoreSymlink "/mnt/data_home/Videos";
target = "${config.home.homeDirectory}/Videos";
};
ssh = {
source = config.lib.file.mkOutOfStoreSymlink "/mnt/data_home/.ssh";
target = "${config.home.homeDirectory}/.ssh";
};
zen = {
source = config.lib.file.mkOutOfStoreSymlink "/mnt/data_home/ZenBrowser";
target = "${config.home.homeDirectory}/.zen";
};
};
}

5
home/terminal/bat.nix Normal file
View file

@ -0,0 +1,5 @@
{
programs.bat = {
enable = true;
};
}

View file

@ -0,0 +1,5 @@
{
programs.bat = {
enable = true;
};
}

60
home/terminal/fish.nix Normal file
View file

@ -0,0 +1,60 @@
{
pkgs,
config,
...
}: {
programs.fish = {
enable = true;
functions = {
_fetch = ''
bunnyfetch
printf "\n"
'';
filesize = ''
for file in $argv
if [ -f "$file" ]
echo "$file: $(stat -c %s "$file" | numfmt --to=iec)"
else
echo "$file: not found"
end
end
'';
y = ''
set tmp (mktemp -t "yazi-cwd.XXXXXX")
yazi $argv --cwd-file="$tmp"
if set cwd (command cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
builtin cd -- "$cwd"
end
rm -f -- "$tmp"
'';
arm64cc-env = ''
set -gx ARCH arm64
set -gx hardeningDisable all
set -gx CROSS_COMPILE aarch64-linux-gnu-
'';
};
shellAliases = {
ls = "eza";
cat = "bat";
v = "nvim";
V = "sudoedit";
":q" = "exit";
cdt = "cd (mktemp -d)";
};
interactiveShellInit = ''
${pkgs.any-nix-shell}/bin/any-nix-shell fish --info-right | source
bind \cl 'clear; _fetch; commandline -f repaint'
bind \cb ${pkgs.btop}/bin/btop
bind \cf 'fzf; commandline -f repaint'
bind \cs 'cdi; commandline -f repaint'
_fetch
'';
};
}

View file

@ -0,0 +1,60 @@
{
pkgs,
config,
...
}: {
programs.fish = {
enable = true;
functions = {
_fetch = ''
bunnyfetch
printf "\n"
'';
filesize = ''
for file in $argv
if [ -f "$file" ]
echo "$file: $(stat -c %s "$file" | numfmt --to=iec)"
else
echo "$file: not found"
end
end
'';
y = ''
set tmp (mktemp -t "yazi-cwd.XXXXXX")
yazi $argv --cwd-file="$tmp"
if set cwd (command cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
builtin cd -- "$cwd"
end
rm -f -- "$tmp"
'';
arm64cc-env = ''
set -gx ARCH arm64
set -gx hardeningDisable all
set -gx CROSS_COMPILE aarch64-linux-gnu-
'';
};
shellAliases = {
ls = "eza";
cat = "bat";
v = "nvim";
V = "sudoedit";
":q" = "exit";
cdt = "cd (mktemp -d)";
};
interactiveShellInit = ''
${pkgs.any-nix-shell}/bin/any-nix-shell fish --info-right | source
bind \cl 'clear; _fetch; commandline -f repaint'
bind \cb ${pkgs.btop}/bin/btop
bind \cf 'fzf; commandline -f repaint'
bind \cs 'cdi; commandline -f repaint'
_fetch
'';
};
}

6
home/terminal/fzf.nix Normal file
View file

@ -0,0 +1,6 @@
{
programs.fzf = {
enable = true;
enableFishIntegration = true;
};
}

View file

@ -0,0 +1,6 @@
{
programs.fzf = {
enable = true;
enableFishIntegration = true;
};
}

7
home/terminal/git.nix Normal file
View file

@ -0,0 +1,7 @@
{
programs.git = {
enable = true;
userEmail = "me@tx0.su";
userName = "tx0";
};
}

View file

@ -0,0 +1,7 @@
{
programs.git = {
enable = true;
userEmail = "me@tx0.su";
userName = "tx0";
};
}

141
home/terminal/nvf.nix Normal file
View file

@ -0,0 +1,141 @@
{
pkgs,
config,
lib,
...
}: let
inherit (config.lib.stylix) colors;
in {
programs.nvf = {
enable = true;
settings.vim = {
useSystemClipboard = true;
viAlias = true;
vimAlias = true;
theme = {
enable = true;
name = "base16";
style = "dark";
base16-colors = {
inherit (colors) base00 base01 base02 base03 base04 base05 base06 base07;
inherit (colors) base08 base09 base0A base0B base0C base0D base0E base0F;
};
transparent = true;
};
options = {
tabstop = 2;
expandtab = true;
softtabstop = 2;
shiftwidth = 2;
};
lsp = {
formatOnSave = true;
};
visuals = {
nvim-scrollbar.enable = true;
nvim-web-devicons.enable = true;
nvim-cursorline.enable = true;
fidget-nvim.enable = true;
};
statusline.lualine.enable = true;
autopairs.nvim-autopairs.enable = true;
autocomplete.nvim-cmp.enable = true;
tabline = {
nvimBufferline = {
enable = true;
mappings = {
cycleNext = "<tab>";
};
setupOpts.options = {
numbers = {
_type = "lua-inline";
expr = ''
function(opts)
return string.format('%s', opts.id)
end
'';
};
};
};
};
ui = {
borders.enable = true;
colorizer.enable = true;
};
binds.whichKey.enable = true;
treesitter.context.enable = false;
dashboard = {
dashboard-nvim.enable = true;
};
languages = {
enableLSP = true;
enableTreesitter = true;
enableFormat = true;
nix.enable = true;
python = {
enable = true;
# lsp.server = "pyright";
};
go.enable = true;
bash.enable = true;
css.enable = true;
html.enable = true;
lua.enable = true;
};
lazy.plugins = {
"vim-tmux-navigator" = {
package = pkgs.vimPlugins.vim-tmux-navigator;
setupModule = "vim-tmux-navigator";
cmd = [
"TmuxNavigateLeft"
"TmuxNavigateDown"
"TmuxNavigateUp"
"TmuxNavigateRight"
"TmuxNavigatePrevious"
"TmuxNavigatorProcessList"
];
keys = [
{
key = "<c-h>";
mode = "n";
action = "<cmd><C-U>TmuxNavigateLeft<cr>";
}
{
key = "<c-j>";
mode = "n";
action = "<cmd><C-U>TmuxNavigateDown<cr>";
}
{
key = "<c-k>";
mode = "n";
action = "<cmd><C-U>TmuxNavigateUp<cr>";
}
{
key = "<c-l>";
mode = "n";
action = "<cmd><C-U>TmuxNavigateRight<cr>";
}
{
key = "<c-\\>";
mode = "n";
action = "<cmd><C-U>TmuxNavigatePrevious<cr>";
}
];
};
};
};
};
}

View file

@ -0,0 +1,141 @@
{
pkgs,
config,
lib,
...
}: let
inherit (config.lib.stylix) colors;
in {
programs.nvf = {
enable = true;
settings.vim = {
useSystemClipboard = true;
viAlias = true;
vimAlias = true;
theme = {
enable = true;
name = "base16";
style = "dark";
base16-colors = {
inherit (colors) base00 base01 base02 base03 base04 base05 base06 base07;
inherit (colors) base08 base09 base0A base0B base0C base0D base0E base0F;
};
transparent = true;
};
options = {
tabstop = 2;
expandtab = true;
softtabstop = 2;
shiftwidth = 2;
};
lsp = {
formatOnSave = true;
};
visuals = {
nvim-scrollbar.enable = true;
nvim-web-devicons.enable = true;
nvim-cursorline.enable = true;
fidget-nvim.enable = true;
};
statusline.lualine.enable = true;
autopairs.nvim-autopairs.enable = true;
autocomplete.nvim-cmp.enable = true;
tabline = {
nvimBufferline = {
enable = true;
mappings = {
cycleNext = "<tab>";
};
setupOpts.options = {
numbers = {
_type = "lua-inline";
expr = ''
function(opts)
return string.format('%s', opts.id)
end
'';
};
};
};
};
ui = {
borders.enable = true;
colorizer.enable = true;
};
binds.whichKey.enable = true;
treesitter.context.enable = false;
dashboard = {
dashboard-nvim.enable = true;
};
languages = {
enableLSP = true;
enableTreesitter = true;
enableFormat = true;
nix.enable = true;
python = {
enable = true;
# lsp.server = "pyright";
};
go.enable = true;
bash.enable = true;
css.enable = true;
html.enable = true;
lua.enable = true;
};
lazy.plugins = {
"vim-tmux-navigator" = {
package = pkgs.vimPlugins.vim-tmux-navigator;
setupModule = "vim-tmux-navigator";
cmd = [
"TmuxNavigateLeft"
"TmuxNavigateDown"
"TmuxNavigateUp"
"TmuxNavigateRight"
"TmuxNavigatePrevious"
"TmuxNavigatorProcessList"
];
keys = [
{
key = "<c-h>";
mode = "n";
action = "<cmd><C-U>TmuxNavigateLeft<cr>";
}
{
key = "<c-j>";
mode = "n";
action = "<cmd><C-U>TmuxNavigateDown<cr>";
}
{
key = "<c-k>";
mode = "n";
action = "<cmd><C-U>TmuxNavigateUp<cr>";
}
{
key = "<c-l>";
mode = "n";
action = "<cmd><C-U>TmuxNavigateRight<cr>";
}
{
key = "<c-\\>";
mode = "n";
action = "<cmd><C-U>TmuxNavigatePrevious<cr>";
}
];
};
};
};
};
}

44
home/terminal/tmux.nix Normal file
View file

@ -0,0 +1,44 @@
{
pkgs,
config,
...
}: {
programs.tmux = {
enable = true;
shell = "${pkgs.fish}/bin/fish";
terminal = "tmux-256color";
historyLimit = 100000;
plugins = with pkgs.tmuxPlugins; [
vim-tmux-navigator
];
escapeTime = 0;
mouse = true;
extraConfig = ''
set -g destroy-unattached on
unbind C-b
set -g prefix C-Space
bind C-Space send-prefix
set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
set -g renumber-windows on
bind -n M-H previous-window
bind -n M-: next-window
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
unbind %
unbind '"'
bind ']' split-window -v -c "#{pane_current_path}"
bind '\' split-window -h -c "#{pane_current_path}"
bind C-l send-keys 'C-l'
'';
};
}

View file

@ -0,0 +1,44 @@
{
pkgs,
config,
...
}: {
programs.tmux = {
enable = true;
shell = "${pkgs.fish}/bin/fish";
terminal = "tmux-256color";
historyLimit = 100000;
plugins = with pkgs.tmuxPlugins; [
vim-tmux-navigator
];
escapeTime = 0;
mouse = true;
extraConfig = ''
set -g destroy-unattached on
unbind C-b
set -g prefix C-Space
bind C-Space send-prefix
set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
set -g renumber-windows on
bind -n M-H previous-window
bind -n M-: next-window
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
unbind %
unbind '"'
bind ']' split-window -v -c "#{pane_current_path}"
bind '\' split-window -h -c "#{pane_current_path}"
bind C-l send-keys 'C-l'
'';
};
}

40
home/terminal/yazi.nix Normal file
View file

@ -0,0 +1,40 @@
{
programs.yazi = {
enable = true;
settings = {
opener = {
edit = [
{
run = ''$EDITOR "$@"'';
block = true;
for = "unix";
}
];
open = [
{
run = ''xdg-open "$@"'';
desc = "Open";
}
];
};
open = {
prepend_rules = [
{
mime = "text/*";
use = "edit";
}
{
name = "*.html";
use = ["open" "edit"];
}
];
append_rules = [
{
name = "*";
use = "open";
}
];
};
};
};
}

View file

@ -0,0 +1,40 @@
{
programs.yazi = {
enable = true;
settings = {
opener = {
edit = [
{
run = ''$EDITOR "$@"'';
block = true;
for = "unix";
}
];
open = [
{
run = ''xdg-open "$@"'';
desc = "Open";
}
];
};
open = {
prepend_rules = [
{
mime = "text/*";
use = "edit";
}
{
name = "*.html";
use = ["open" "edit"];
}
];
append_rules = [
{
name = "*";
use = "open";
}
];
};
};
};
}

13
home/terminal/zoxide.nix Normal file
View file

@ -0,0 +1,13 @@
{
pkgs,
config,
...
}: {
programs.zoxide = {
enable = true;
enableFishIntegration = true;
options = [
"--cmd cd"
];
};
}

View file

@ -0,0 +1,13 @@
{
pkgs,
config,
...
}: {
programs.zoxide = {
enable = true;
enableFishIntegration = true;
options = [
"--cmd cd"
];
};
}

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="40px" viewBox="0 -960 960 960" width="40px" fill="#e9ecf2"><path d="M272-120h-85.33q-27 0-46.84-19.83Q120-159.67 120-186.67V-480q0-75 28.5-140.5t77-114q48.5-48.5 114-77T480-840q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-480v293.33q0 27-19.83 46.84Q800.33-120 773.33-120H688q-27.5 0-47.08-19.58-19.59-19.59-19.59-47.09v-170.66q0-27.5 19.59-47.09Q660.5-424 688-424h85.33v-56q0-122.57-85.38-207.95T480-773.33q-122.57 0-207.95 85.38T186.67-480v56H272q27.5 0 47.08 19.58 19.59 19.59 19.59 47.09v170.66q0 27.5-19.59 47.09Q299.5-120 272-120Z"/></svg>

After

Width:  |  Height:  |  Size: 592 B

405
home/waybar/default.nix Normal file
View file

@ -0,0 +1,405 @@
{
pkgs,
config,
...
}: let
music-script = pkgs.callPackage ./scripts/music {};
in {
programs.waybar = {
enable = true;
package = pkgs.waybar;
settings = {
main = {
name = "main";
layer = "top";
position = "bottom";
# output = ["DP-1"];
height = 50;
width = 1800;
spacing = 0;
margin-top = -15;
margin-bottom = 0;
modules-left = [
"tray"
"custom/cpu"
"cpu"
"custom/memory"
"memory"
"custom/player-btn-play"
#"custom/player-btn-prev"
#"custom/player-btn-next"
"custom/player-text"
];
modules-center = [
"hyprland/workspaces"
];
modules-right = [
"wireplumber#icon"
"wireplumber#text"
"custom/language"
"hyprland/language"
"custom/clock"
"clock"
"custom/date"
"clock#date"
];
"tray" = {
icon-size = 15;
spacing = 16;
};
"custom/cpu" = {
tooltip = false;
format = "&#xe322;";
};
"cpu" = {
interval = 1;
format = "{usage}%";
};
"custom/memory" = {
tooltip = false;
format = "&#xf7a3;";
};
"memory" = {
interval = 1;
format = "{used:0.1f}Gb";
};
"custom/player-btn-prev" = {
tooltip = false;
on-click = "${pkgs.playerctl}/bin/playerctl previous";
format = "{}";
return-type = "json";
exec = "${music-script}/bin/main.py --icon-text '&#xe045;'";
};
"custom/player-btn-play" = {
tooltip = false;
format = "{}";
max-length = 40;
return-type = "json";
on-click = "${pkgs.playerctl}/bin/playerctl play-pause";
exec = "${music-script}/bin/main.py --icon";
};
"custom/player-btn-next" = {
tooltip = false;
on-click = "${pkgs.playerctl}/bin/playerctl next";
format = "{}";
return-type = "json";
exec = "${music-script}/bin/main.py --icon-text '&#xe044;'";
};
"custom/player-text" = {
tooltip-format = "{}";
format = "{}";
max-length = 40;
return-type = "json";
escape = false;
exec = "${music-script}/bin/main.py";
};
"hyprland/workspaces" = {
format = "{name}";
on-click = "activate";
tooltip = false;
"persistent_workspaces" = {
"*" = [];
};
};
"wireplumber#icon" = {
tooltip = false;
scroll-step = 2;
format = "{icon}";
format-icons = ["&#xe04e;" "&#xe04d;" "&#xe050;"];
format-muted = "&#xe04f;";
on-click = "pwvucontrol";
max-volume = 100;
};
"wireplumber#text" = {
scroll-step = 2;
format = "{volume}%";
on-click = "pwvucontrol";
max-volume = 100;
};
"custom/language" = {
tooltip = false;
format = "&#xe894;";
};
"hyprland/language" = {
format = "{}";
format-en = "Eng";
format-ru = "Rus";
tooltip-format = "{}";
};
"custom/clock" = {
tooltip = false;
format = "&#xe8b5;";
};
"clock" = {
tooltip = false;
format = "{:%H:%M}";
timezone = "Asia/Yekaterinburg";
};
"custom/date" = {
tooltip = false;
format = "&#xebcc;";
};
"clock#date" = {
tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
format = "{:%b %d}";
timezone = "Asia/Yekaterinburg";
};
};
/*
second = {
name = "second";
layer = "top";
position = "bottom";
output = ["HDMI-A-1"];
height = 50;
width = 900;
spacing = 0;
margin-top = -15;
margin-bottom = 0;
modules-left = [
"tray"
];
modules-center = [
"hyprland/workspaces"
];
modules-right = [
"wireplumber#icon"
"wireplumber#text"
"custom/clock"
"clock"
"custom/date"
"clock#date"
];
"tray" = {
icon-size = 15;
spacing = 16;
};
"hyprland/workspaces" = {
format = "{name}";
on-click = "activate";
tooltip = false;
"persistent_workspaces" = {
"*" = [];
};
};
"wireplumber#icon" = {
tooltip = false;
scroll-step = 2;
format = "{icon}";
format-icons = ["&#xe04e;" "&#xe04d;" "&#xe050;"];
format-muted = "&#xe04f;";
on-click = "pwvucontrol";
max-volume = 100;
};
"wireplumber#text" = {
scroll-step = 2;
format = "{volume}%";
on-click = "pwvucontrol";
max-volume = 100;
};
"custom/clock" = {
tooltip = false;
format = "&#xe8b5;";
};
"clock" = {
tooltip = false;
format = "{:%H:%M}";
timezone = "Asia/Yekaterinburg";
};
"custom/date" = {
tooltip = false;
format = "&#xebcc;";
};
"clock#date" = {
tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
format = "{:%b %d}";
timezone = "Asia/Yekaterinburg";
};
};
*/
};
style = let
outer-radius = 100;
inner-radius = 40;
bar-radius = 25;
outer-gapps = 6;
inner-gapps = 8;
chip-gapps = 4;
icon-size = 20;
text-size = 15;
s = x: builtins.toString x;
half = x: s ((builtins.floor (x * 10 / 2) * 1.0) / 10);
in
with config.lib.stylix.colors.withHashtag;
/*
css
*/
''
* {
font-family: "${config.stylix.fonts.serif.name}";
font-weight: bold;
font-size: ${s text-size}px;
min-height: 0px;
}
window#waybar {
background-color: ${base01};
transition-duration: 0.5s;
border-radius: ${s bar-radius}px ${s bar-radius}px 0px 0px;
/* border-radius: ${s bar-radius}px; */
}
#workspaces {
font-size: 14px;
background-color: ${base00};
margin: ${s outer-gapps}px ${half inner-gapps}px;
padding: 4px;
border-radius: ${s outer-radius}px;
}
#workspaces button {
background-color: ${base00};
color: ${base04};
padding: 2px 4px;
margin: 3px;
border-radius: ${s outer-radius}px;
}
#workspaces button:hover {
background-color: ${base02};
color: ${base06};
}
#workspaces button.active {
background-color: ${base05};
color: ${base01};
}
/* global rules */
#custom-cpu,
#custom-memory,
#custom-language,
#custom-clock,
#custom-date,
#custom-player-btn-play,
#custom-player-btn-prev,
#custom-player-btn-next,
#custom-player-text,
#battery,
#wireplumber,
#tray,
#language,
#clock,
#cpu,
#memory,
#custom-spotify {
background: ${base00};
border-style: none;
border-radius: ${s outer-radius}px;
color: ${base05};
margin: ${s outer-gapps}px ${half inner-gapps}px;
padding: 0px 10px;
}
#tray {
margin: ${s outer-gapps}px ${half chip-gapps}px ${s outer-gapps}px ${s outer-gapps}px;
}
/* icon chips */
#wireplumber.icon,
#custom-memory,
#custom-language,
#custom-clock,
#custom-date,
#custom-player-btn-prev,
#custom-player-btn-next,
#custom-player-btn-play,
#custom-cpu {
font-size: ${s icon-size}px;
font-family: "Material Symbols Rounded";
min-width: 25px;
}
/* text chips */
#wireplumber.text,
#memory,
#language,
#clock,
#cpu {
min-width: 40px;
}
/* start chips */
#custom-cpu,
#custom-memory,
#custom-player-btn-play,
#wireplumber.icon,
#custom-language,
#custom-clock,
#custom-date {
padding: 0px 7px 0px 10px;
margin: ${s outer-gapps}px ${half chip-gapps}px ${s outer-gapps}px ${half inner-gapps}px;
border-radius: ${s outer-radius}px ${s inner-radius}px ${s inner-radius}px ${s outer-radius}px
}
/* center chips */
#custom-player-btn-next,
#custom-player-btn-prev {
margin: ${s outer-gapps}px ${half chip-gapps}px ${s outer-gapps}px ${half chip-gapps}px;
border-radius: ${s (inner-radius / 4)}px;
min-width: 15px;
}
/* end chips */
#cpu,
#memory,
#custom-player-text,
#wireplumber.text,
#language,
#clock{
padding: 0px 10px 0px 7px;
margin: ${s outer-gapps}px ${half inner-gapps}px ${s outer-gapps}px ${half chip-gapps}px;
border-radius: ${s inner-radius}px ${s outer-radius}px ${s outer-radius}px ${s inner-radius}px
}
#wireplumber.icon.muted {
color: ${base08};
}
#clock.date {
margin: ${s outer-gapps}px ${s outer-gapps}px ${s outer-gapps}px ${half chip-gapps}px;
}
'';
};
}

View file

@ -0,0 +1,23 @@
{
lib,
python3Packages,
gobject-introspection,
wrapGAppsHook,
playerctl,
}:
python3Packages.buildPythonApplication {
pname = "waybar-music-script";
version = "0.0.0";
nativeBuildInputs = [
gobject-introspection
wrapGAppsHook
];
propagatedBuildInputs = [
python3Packages.pygobject3
playerctl
];
src = ./.;
}

233
home/waybar/scripts/music/main.py Executable file
View file

@ -0,0 +1,233 @@
#!/usr/bin/env python3
import gi
gi.require_version("Playerctl", "2.0")
from gi.repository import Playerctl, GLib
from gi.repository.Playerctl import Player
import argparse
import logging
import sys
import signal
import gi
import json
import os
from typing import List
logger = logging.getLogger(__name__)
def signal_handler(sig, frame):
logger.info("Received signal to stop, exiting")
sys.stdout.write("\n")
sys.stdout.flush()
# loop.quit()
sys.exit(0)
class PlayerManager:
def __init__(
self, selected_player=None, excluded_player=[], icon=False, icon_text=None
):
self.manager = Playerctl.PlayerManager()
self.loop = GLib.MainLoop()
self.manager.connect(
"name-appeared", lambda *args: self.on_player_appeared(*args)
)
self.manager.connect(
"player-vanished", lambda *args: self.on_player_vanished(*args)
)
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
self.selected_player = selected_player
self.excluded_player = excluded_player.split(",") if excluded_player else []
self.icon = icon
self.icon_text = icon_text
self.init_players()
def init_players(self):
for player in self.manager.props.player_names:
if player.name in self.excluded_player:
continue
if self.selected_player is not None and self.selected_player != player.name:
logger.debug(f"{player.name} is not the filtered player, skipping it")
continue
self.init_player(player)
def run(self):
logger.info("Starting main loop")
self.loop.run()
def init_player(self, player):
logger.info(f"Initialize new player: {player.name}")
player = Playerctl.Player.new_from_name(player)
player.connect("playback-status", self.on_playback_status_changed, None)
player.connect("metadata", self.on_metadata_changed, None)
self.manager.manage_player(player)
self.on_metadata_changed(player, player.props.metadata)
def get_players(self) -> List[Player]:
return self.manager.props.players
def write_output(self, text, player):
logger.debug(f"Writing output: {text}")
output = {
"text": text,
"class": "custom-" + player.props.player_name,
"alt": player.props.player_name,
}
sys.stdout.write(json.dumps(output) + "\n")
sys.stdout.flush()
def clear_output(self):
sys.stdout.write("\n")
sys.stdout.flush()
def on_playback_status_changed(self, player, status, _=None):
logger.debug(
f"Playback status changed for player {player.props.player_name}: {status}"
)
self.on_metadata_changed(player, player.props.metadata)
def get_first_playing_player(self):
players = self.get_players()
logger.debug(f"Getting first playing player from {len(players)} players")
if len(players) > 0:
# if any are playing, show the first one that is playing
# reverse order, so that the most recently added ones are preferred
for player in players[::-1]:
if player.props.status == "Playing":
return player
# if none are playing, show the first one
return players[0]
else:
logger.debug("No players found")
return None
def show_most_important_player(self):
logger.debug("Showing most important player")
# show the currently playing player
# or else show the first paused player
# or else show nothing
current_player = self.get_first_playing_player()
if current_player is not None:
self.on_metadata_changed(current_player, current_player.props.metadata)
else:
self.clear_output()
def on_metadata_changed(self, player, metadata, _=None):
logger.debug(f"Metadata changed for player {player.props.player_name}")
player_name = player.props.player_name
artist = player.get_artist()
title = player.get_title()
title = title.replace("&", "&amp;")
track_info = ""
if (
player_name == "spotify"
and "mpris:trackid" in metadata.keys()
and ":ad:" in player.props.metadata["mpris:trackid"]
):
track_info = "Advertisement"
elif artist is not None and title is not None:
track_info = f"{title} - {artist}"
else:
track_info = title
if track_info:
if self.icon:
if player.props.status == "Playing":
track_info = "&#xe1a2;"
else:
track_info = "&#xe1c4;"
if self.icon_text:
track_info = self.icon_text
# only print output if no other player is playing
current_playing = self.get_first_playing_player()
if (
current_playing is None
or current_playing.props.player_name == player.props.player_name
):
self.write_output(track_info, player)
else:
logger.debug(
f"Other player {current_playing.props.player_name} is playing, skipping"
)
def on_player_appeared(self, _, player):
logger.info(f"Player has appeared: {player.name}")
if player.name in self.excluded_player:
logger.debug(
"New player appeared, but it's in exclude player list, skipping"
)
return
if player is not None and (
self.selected_player is None or player.name == self.selected_player
):
self.init_player(player)
else:
logger.debug(
"New player appeared, but it's not the selected player, skipping"
)
def on_player_vanished(self, _, player):
logger.info(f"Player {player.props.player_name} has vanished")
self.show_most_important_player()
def parse_arguments():
parser = argparse.ArgumentParser()
# Increase verbosity with every occurrence of -v
parser.add_argument("-v", "--verbose", action="count", default=0)
parser.add_argument("-x", "--exclude", "- Comma-separated list of excluded player")
# Define for which player we"re listening
parser.add_argument("--player")
parser.add_argument("--enable-logging", action="store_true")
parser.add_argument("--icon", action="store_true")
parser.add_argument("--icon-text")
return parser.parse_args()
def main():
arguments = parse_arguments()
# Initialize logging
if arguments.enable_logging:
logfile = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "media-player.log"
)
logging.basicConfig(
filename=logfile,
level=logging.DEBUG,
format="%(asctime)s %(name)s %(levelname)s:%(lineno)d %(message)s",
)
# Logging is set by default to WARN and higher.
# With every occurrence of -v it's lowered by one
logger.setLevel(max((3 - arguments.verbose) * 10, 0))
logger.info("Creating player manager")
if arguments.player:
logger.info(f"Filtering for player: {arguments.player}")
if arguments.exclude:
logger.info(f"Exclude player {arguments.exclude}")
player = PlayerManager(
arguments.player, arguments.exclude, arguments.icon, arguments.icon_text
)
player.run()
if __name__ == "__main__":
main()

View file

@ -0,0 +1,9 @@
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(name='waybar-music-info',
version='0.0.0',
packages=find_packages(),
scripts=["main.py"],
)

24
home/xdg/default.nix Normal file
View file

@ -0,0 +1,24 @@
{
xdg = {
mimeApps = {
enable = true;
defaultApplications = {
"text/plain" = ["neovim.desktop"];
"x-scheme-handler/http" = ["userapp-Zen-JXSV02.desktop"];
"x-scheme-handler/https" = ["userapp-Zen-JXSV02.desktop"];
"x-scheme-handler/chrome" = ["userapp-Zen-JXSV02.desktop"];
"text/html" = ["userapp-Zen-JXSV02.desktop"];
"application/x-extension-htm" = ["userapp-Zen-JXSV02.desktop"];
"application/x-extension-html" = ["userapp-Zen-JXSV02.desktop"];
"application/x-extension-shtml" = ["userapp-Zen-JXSV02.desktop"];
"application/xhtml+xml" = ["userapp-Zen-JXSV02.desktop"];
"application/x-extension-xhtml" = ["userapp-Zen-JXSV02.desktop"];
"application/x-extension-xht" = ["userapp-Zen-JXSV02.desktop"];
"x-scheme-handler/tg" = ["org.telegram.desktop.desktop"];
"x-scheme-handler/tonsite" = ["org.telegram.desktop.desktop"];
"application/pdf" = ["zen.desktop"];
"x-scheme-handler/discord" = ["vesktop.desktop"];
};
};
};
}

View file

@ -0,0 +1,21 @@
{
lib,
pkgs,
config,
...
}: {
boot = {
kernelPackages = pkgs.linuxPackages_zen;
kernelModules = [];
extraModulePackages = with config.boot.kernelPackages; [
amneziawg
];
loader.systemd-boot = {
enable = true;
};
loader.efi.canTouchEfiVariables = true;
binfmt.emulatedSystems = ["aarch64-linux"];
};
}

View file

@ -0,0 +1,34 @@
{
inputs,
pkgs,
...
}: {
nix = {
package = pkgs.lix;
nixPath = ["nixpkgs=${inputs.nixpkgs}"];
settings = {
experimental-features = ["nix-command" "flakes"];
extra-substituters = [
"https://cache.garnix.io"
"https://nix-community.cachix.org"
"https://cache.nixos.org"
"https://hyprland.cachix.org"
];
extra-trusted-public-keys = [
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
];
builders-use-substitutes = true;
auto-optimise-store = true;
trusted-users = [
"tx0"
"root"
"@wheel"
];
warn-dirty = false;
};
};
}

View file

@ -0,0 +1,9 @@
{...}: {
nixpkgs.config = {
allowUnfree = true;
allowBroken = true;
allowAliases = true;
allowInsecure = true;
allowUnfreePredicate = true;
};
}

View file

@ -0,0 +1,14 @@
{pkgs, ...}: {
environment.sessionVariables = {
EDITOR = "nvim";
FLAKE = "/home/tx0/nixos/";
};
environment.systemPackages = with pkgs; [
git
fish
home-manager
rocmPackages.clr.icd
steam
];
}

View file

@ -0,0 +1,32 @@
{
pkgs,
inputs,
...
}: {
programs = {
fish.enable = true;
amnezia-vpn.enable = true;
nh = {
enable = true;
clean = {
enable = true;
dates = "weekly";
extraArgs = "--keep-since 7d";
};
};
clash-verge = {
enable = true;
autoStart = true;
};
hyprland = {
enable = true;
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
portalPackage = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
};
command-not-found.dbPath = inputs.programsdb.packages.${pkgs.system}.programs-sqlite;
};
}

View file

@ -0,0 +1,35 @@
{
lib,
pkgs,
...
}: {
services = {
resolved.enable = true;
openssh = {
enable = true;
ports = [22 48001];
settings = {
PasswordAuthentication = false;
};
};
udev.packages = [
pkgs.android-udev-rules
];
printing.enable = true;
libinput.enable = true;
pipewire = {
enable = lib.mkForce true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
audio.enable = true;
};
udisks2.enable = true;
};
}

View file

@ -0,0 +1,41 @@
{pkgs, ...}: {
time.timeZone = "Asia/Yekaterinburg";
i18n.defaultLocale = "en_US.UTF-8";
users = {
defaultUserShell = pkgs.fish;
users."tx0" = {
isNormalUser = true;
extraGroups = [
"wheel"
"input"
"networkmanager"
"video"
"audio"
"podman"
"adbusers"
"kvm"
];
subGidRanges = [
{
count = 65536;
startGid = 100000;
}
];
subUidRanges = [
{
count = 65536;
startUid = 100000;
}
];
packages = [];
useDefaultShell = true;
openssh.authorizedKeys = {
keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCz8WZ+c24RYjBMVNZGMR+IjSQb7WtrMi2ZcfAf6BwNLaKJTlWABN20FSscbGy8oCdfheAKvdTrx+hMRNCmEdTmNZlDXZ0kDBFh1h3I2geC3XNWjXuYSSmZpfW71Tex5ZHpruD9lstL9rBVY7c1ZKJfmtgM5m+x44FZwjxdFffQbj9LtLmy6zWQ7iX7/zzcdPJvJxoQbBwmAeVqZErpR/IoSG2uXTS4tIqGStfg6kBoV/AZBwYCxE0f3jFzajTMm+n6kjnKOiztfaw+NVB4+QLlSvB5i3iJ7afjhv/KfH4/t0gmVCfqo+O9pPOUqLokQvHvAu33M6PP5Roc4mK+pGEYXabUdv757uo8RdDg6x3bu5kgJS+V06ZycnDtHYNda+8/qEh+nryu0TqqJtqALwO2k7VcTgDoMrU3UvXRSA3wIO+Gp8qbPVjJv1/jSKoVurmFe3Wwy0LVEA++zF4F571aOPzwY49q6AF+JuPCUWPy44K7oG6MfFPZSk7TtSelH18= timoxa@pc"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAka1w1Ld4KLiZfztI6Qqe5irM6g8G0ENGmqds+LWiGE"
];
};
shell = pkgs.fish;
};
};
}

View file

@ -0,0 +1,6 @@
{
virtualisation.podman = {
enable = true;
dockerCompat = true;
};
}

12
hosts/nixos/default.nix Normal file
View file

@ -0,0 +1,12 @@
{inputs, ...}: {
system.stateVersion = "24.11";
imports = inputs.nypkgs.legacyPackages."x86_64-linux".lib.umport {
paths = [./. ../common];
exclude = [
./default.nix
# ./stylix/themes
# ./programs/niri.nix
];
};
}

View file

@ -0,0 +1,81 @@
{
config,
lib,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod"];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = [];
boot.kernelParams = [
"video=DP-1:3440x1440@100"
"video=HDMI-A-1:1920x1200@60"
];
fileSystems."/" = {
device = "/dev/disk/by-uuid/eac97f4e-9e1b-4e9e-bf7c-726328f347bc";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/C2C4-53B2";
fsType = "vfat";
options = ["fmask=0077" "dmask=0077"];
};
fileSystems."/mnt/data" = {
device = "/dev/disk/by-partlabel/data";
fsType = "btrfs";
options = ["compress=zstd" "subvol=@Data"];
};
fileSystems."/mnt/data_home" = {
device = "/dev/disk/by-partlabel/data";
fsType = "btrfs";
options = ["compress=zstd" "subvol=@Home"];
};
# fileSystems."/mnt/arch" = {
# device = "/dev/disk/by-uuid/7c552892-f313-438d-91bd-b10fb8c06230";
# fsType = "btrfs";
# options = ["compress=zstd" "subvol=@"];
# };
# fileSystems."/mnt/arch/var/log" = {
# device = "/dev/disk/by-uuid/7c552892-f313-438d-91bd-b10fb8c06230";
# fsType = "btrfs";
# options = ["compress=zstd" "subvol=@log"];
# };
# fileSystems."/mnt/arch/var/cache/pacman/pkg" = {
# device = "/dev/disk/by-uuid/7c552892-f313-438d-91bd-b10fb8c06230";
# fsType = "btrfs";
# options = ["compress=zstd" "subvol=@pkg"];
# };
# fileSystems."/mnt/arch/home" = {
# device = "/dev/disk/by-uuid/7c552892-f313-438d-91bd-b10fb8c06230";
# fsType = "btrfs";
# options = ["compress=zstd" "subvol=@home"];
# };
swapDevices = [];
networking.useDHCP = lib.mkDefault true;
hardware.graphics = {
enable = true;
enable32Bit = true;
};
services.xserver.videoDrivers = ["displaylink" "modesetting" "amdgpu"];
virtualisation.vmware.host.enable = true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -0,0 +1,7 @@
{
networking = {
hostName = "nixos";
networkmanager.enable = true;
dhcpcd.enable = true;
};
}

View file

@ -0,0 +1,14 @@
{...}: {
services.yggdrasil = {
enable = false;
settings = {
Peers = [
"tls://ygg1.tx0.su:65534"
"tls://ygg2.tx0.su:65534"
"tls://ygg3.tx0.su:65534"
];
IfName = "ygg";
};
};
}

View file

@ -0,0 +1,14 @@
{
pkgs,
config,
...
}: {
services.ollama = {
enable = true;
# acceleration = "rocm";
# environmentVariables = {
# HCC_AMDGPU_TARGET = "gfx1032"; # used to be necessary, but doesn't seem to anymore
# };
# rocmOverrideGfx = "10.3.1";
};
}