Modules: separated hosts-specific modules in new dir

This commit is contained in:
2026-04-23 12:11:23 +02:00
parent 0f003b3a4f
commit f9fe349c49
19 changed files with 413 additions and 379 deletions
+1
View File
@@ -0,0 +1 @@
This modules must be host independent.
@@ -1,3 +1,5 @@
# OLD Deprecated.
{
config,
pkgs,
-2
View File
@@ -210,7 +210,6 @@ in {
"wl-paste --type image --watch cliphist store" # clipboard store image data
"custom-batterynotify"
"custom-batterywarning"
"qtbatticon" # custom battery tray
"birdtray" # thunderbird tray app
#wallpapers/b
"swww img ${wallpaper}"
@@ -268,7 +267,6 @@ in {
# █░▀░█ █▄█ █#░▀█ █ ░█░ █▄█ █▀▄
monitor = [
#",preferred, auto, auto"
"eDP-1, highres@highrr, 0x0, 1"
"HDMI-A-1, highres2highrr, auto-left, 1"
];
# _______ ___ __ __ _______ ___ __ _ _______
-2
View File
@@ -41,8 +41,6 @@
manix = "custom-manix";
man = "custom-man";
mplayer = "mplayer -volume 5";
snrt = "git add -A && sudo nixos-rebuild test --flake ~/nixos/#laptop";
snrs = "git add -A && sudo nixos-rebuild switch --flake ~/nixos/#laptop";
# these are to create the developpement shell
cenv = "nix-shell -p zsh gcc raylib libx11 libGL";
};
+302
View File
@@ -0,0 +1,302 @@
{...}: {
services.displayManager.ly = {
enable = true;
settings = {
animation = "gameoflife"; # none or doom or matrix or gameoflife or a dur file
animation_frame_delay = 5;
animation_timeout_sec = 0;
asterisk = "0x2022";
auth_fails = 2; # numbers of failed authentification before special animation
battery_id = "BAT1";
bigclock = "en";
bigclock_12hr = false;
bigclock_seconds = false;
# Blank main box background
# Setting to false will make it transparent
blank_box = false;
# Border foreground color id
border_fg = "0x00FFFFFF";
# Title to show at the top of the main box
# If set to null, none will be shown
box_title = null;
# Brightness decrease command
brightness_down_cmd = "$PREFIX_DIRECTORY/bin/brightnessctl -q -n s 10%-";
# Brightness decrease key combination, or null to disable
brightness_down_key = "F5";
# Brightness increase command
brightness_up_cmd = "$PREFIX_DIRECTORY/bin/brightnessctl -q -n s +10%";
# Brightness increase key combination, or null to disable
brightness_up_key = "F6";
# Erase password input on failure
clear_password = true;
# Format string for clock in top right corner (see strftime specification). Example: %c
# If null, the clock won't be shown
clock = true;
# CMatrix animation foreground color id
cmatrix_fg = "0x0000FF00";
# CMatrix animation character string head color id
cmatrix_head_col = "0x01FFFFFF";
# CMatrix animation minimum codepoint. It uses a 16-bit integer
# For Japanese characters for example, you can use 0x3000 here
cmatrix_min_codepoint = "0x21";
# CMatrix animation maximum codepoint. It uses a 16-bit integer
# For Japanese characters for example, you can use 0x30FF here
cmatrix_max_codepoint = "0x7B";
# Color mixing animation first color id
colormix_col1 = "0x00FF0000";
# Color mixing animation second color id
colormix_col2 = "0x000000FF";
# Color mixing animation third color id
colormix_col3 = "0x20000000";
# Custom sessions directory
# You can specify multiple directories,
# e.g. $CONFIG_DIRECTORY/ly/custom-sessions:$PREFIX_DIRECTORY/share/custom-sessions
custom_sessions = "$CONFIG_DIRECTORY/ly/custom-sessions";
# Input box active by default on startup
# Available inputs: info_line, session, login, password
default_input = "password";
# DOOM animation fire height (1 thru 9)
doom_fire_height = 6;
# DOOM animation fire spread (0 thru 4)
doom_fire_spread = 2;
# DOOM animation custom top color (low intensity flames)
doom_top_color = "0x009F2707";
# DOOM animation custom middle color (medium intensity flames)
doom_middle_color = "0x00C78F17";
# DOOM animation custom bottom color (high intensity flames)
doom_bottom_color = "0x00FFFFFF";
# Dur file path
dur_file_path = "$CONFIG_DIRECTORY/ly/example.dur";
# Dur file alignment
# The dur file can be aligned with a direction and centered easily with the flags below
# Available inputs: topleft, topcenter, topright, centerleft, center, centerright, bottomleft, bottomcenter, bottomright
dur_offset_alignment = "center";
# Dur offset x direction (value is added to the current position determined by alignment, negatives are supported)
dur_x_offset = 0;
# Dur offset y direction (value is added to the current position determined by alignment, negatives are supported)
dur_y_offset = 0;
# Set margin to the edges of the DM (useful for curved monitors)
edge_margin = 0;
# Error background color id
error_bg = "0x00000000";
# Error foreground color id
# Default is red and bold
error_fg = "0x01FF0000";
# Foreground color id
fg = "0x00FFFFFF";
# Render true colors (if supported)
# If false, output will be in eight-color mode
# All eight-color mode color codes:
# TB_DEFAULT 0x0000
# TB_BLACK 0x0001
# TB_RED 0x0002
# TB_GREEN 0x0003
# TB_YELLOW 0x0004
# TB_BLUE 0x0005
# TB_MAGENTA 0x0006
# TB_CYAN 0x0007
# TB_WHITE 0x0008
# If full color is off, the styling options still work. The colors are
# always 32-bit values with the styling in the most significant byte.
# Note: If using the dur_file animation option and the dur file's color range
# is saved as 256 with this option disabled, the file will not be drawn.
full_color = true;
# Game of Life entropy interval (0 = disabled, >0 = add entropy every N generations)
# 0 -> Pure Conway's Game of Life (will eventually stabilize)
# 10 -> Add entropy every 10 generations (recommended for continuous activity)
# 50+ -> Less frequent entropy for more natural evolution
gameoflife_entropy_interval = 10;
# Game of Life animation foreground color id
gameoflife_fg = "0x0000FF00";
# Game of Life frame delay (lower = faster animation, higher = slower)
# 1-3 -> Very fast animation
# 6 -> Default smooth animation speed
# 10+ -> Slower, more contemplative speed
gameoflife_frame_delay = 3;
# Game of Life initial cell density (0.0 to 1.0)
# 0.1 -> Sparse, minimal activity
# 0.4 -> Balanced activity (recommended)
# 0.7+ -> Dense, chaotic patterns
gameoflife_initial_density = 0.666;
# Command executed when pressing hibernate key (can be null)
hibernate_cmd = null;
# Specifies the key combination used for hibernate
hibernate_key = "F4";
# Remove main box borders
hide_borders = false;
# Remove power management command hints
hide_key_hints = false;
# Remove keyboard lock states from the top right corner
hide_keyboard_locks = false;
# Remove version number from the top left corner
hide_version_string = false;
# Command executed when no input is detected for a certain time
# If null, no command will be executed
inactivity_cmd = null;
# Executes a command after a certain amount of seconds
inactivity_delay = 0;
# Initial text to show on the info line
# If set to null, the info line defaults to the hostname
initial_info_text = null;
# Input boxes length
input_len = 34;
# Active language
# Available languages are found in $CONFIG_DIRECTORY/ly/lang/
lang = "en";
# Command executed when logging in
# If null, no command will be executed
# Important: the code itself must end with `exec "$@"` in order to launch the session!
# You can also set environment variables in there, they'll persist until logout
login_cmd = null;
# Path for login.defs file (used for listing all local users on the system on
# Linux)
#login_defs_path = /etc/login.defs
# Command executed when logging out
# If null, no command will be executed
# Important: the session will already be terminated when this command is executed, so
# no need to add `exec "$@"` at the end
logout_cmd = null;
# General log file path
#ly_log = /var/log/ly.log
# Main box horizontal margin
margin_box_h = 2;
# Main box vertical margin
margin_box_v = 1;
# Set numlock on/off at startup
numlock = false;
# Default path
# If null, ly doesn't set a path
#path = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Command executed when pressing restart_key
#restart_cmd = "/sbin/shutdown -r now"
# Specifies the key combination used for restart
restart_key = "F2";
# Save the current desktop and login as defaults, and load them on startup
save = true;
# Service name (set to ly to use the provided pam config file)
service_name = "ly";
# Session log file path
# This will contain stdout and stderr of Wayland sessions
# By default it's saved in the user's home directory
# Important: due to technical limitations, X11, shell sessions as well as
# launching session via KMSCON aren't supported, which means you won't get any
# logs from those sessions.
# If null, no session log will be created
session_log = null;
# Setup command
setup_cmd = "$CONFIG_DIRECTORY/ly/setup.sh";
# Command executed when pressing shutdown_key
shutdown_cmd = "/sbin/shutdown $PLATFORM_SHUTDOWN_ARG now";
# Specifies the key combination used for shutdown
shutdown_key = "F1";
# Command executed when pressing sleep key (can be null)
sleep_cmd = null;
# Specifies the key combination used for sleep
sleep_key = "F3";
# Command executed when starting Ly (before the TTY is taken control of)
# See file at path below for an example of changing the default TTY colors
start_cmd = "$CONFIG_DIRECTORY/ly/startup.sh";
# Center the session name.
text_in_center = false;
# Default vi mode
# normal -> normal mode
# insert -> insert mode
vi_default_mode = "normal";
# Enable vi keybindings
vi_mode = false;
# Wayland desktop environments
# You can specify multiple directories,
# e.g. $PREFIX_DIRECTORY/share/wayland-sessions:$PREFIX_DIRECTORY/local/share/wayland-sessions
waylandsessions = "$PREFIX_DIRECTORY/share/wayland-sessions";
# Xorg server command
x_cmd = "$PREFIX_DIRECTORY/bin/X";
# Xorg virtual terminal number
# Mostly useful for FreeBSD where choosing the current TTY causes issues
# If null, the current TTY will be chosen
x_vt = null;
# Xorg xauthority edition tool
xauth_cmd = "$PREFIX_DIRECTORY/bin/xauth";
# xinitrc
# If null, the xinitrc session will be hidden
xinitrc = "~/.xinitrc";
# Xorg desktop environments
# You can specify multiple directories,
# e.g. $PREFIX_DIRECTORY/share/xsessions:$PREFIX_DIRECTORY/local/share/xsessions
xsessions = "$PREFIX_DIRECTORY/share/xsessions";
};
};
}
-42
View File
@@ -1,42 +0,0 @@
# https://discourse.nixos.org/t/what-is-the-best-option-for-power-management/63406/2
{...}:
# we just activate tlp unconditonally
#let
# cfg = config.custom;
#hasBattery =
# lib.any (x: lib.strings.hasPrefix "BAT" x)
# (builtins.attrNames (builtins.readDir "/sys/class/power_supply"));
#in
{
# options.custom = {
# battery.enable = lib.mkOption {
# default = hasBattery;
# description = "Enable better battery support";
# type = lib.types.bool;
# };
# };
# config = lib.mkIf cfg.battery.enable {
powerManagement.powertop.enable = true; # enable powertop auto tuning on startup.
services.system76-scheduler.settings.cfsProfiles.enable = true; # Better scheduling for CPU cycles - thanks System76!!!
services.thermald.enable = true; # Enable thermald, the temperature management daemon. (only necessary if on Intel CPUs)
services.power-profiles-daemon.enable = false; # Disable GNOMEs power management
services.tlp = {
enable = true; # Enable TLP (better than gnomes internal power manager)
settings = {
CPU_BOOST_ON_AC = 1;
CPU_BOOST_ON_BAT = 1;
CPU_HWP_DYN_BOOST_ON_AC = 1;
CPU_HWP_DYN_BOOST_ON_BAT = 1;
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
CPU_ENERGY_PERF_POLICY_ON_BAT = "balance_power";
PLATFORM_PROFILE_ON_AC = "performance";
PLATFORM_PROFILE_ON_BAT = "balanced";
START_CHARGE_THRESH_BAT1 = 75;
STOP_CHARGE_THRESH_BAT1 = 85;
};
};
# };
}
+65 -273
View File
@@ -1,302 +1,94 @@
{...}: {
# a minimal ly config as the big config (ly.nix) didnt worked
services.displayManager.ly = {
enable = true;
settings = {
animation = "gameoflife"; # none or doom or matrix or gameoflife or a dur file
animation_frame_delay = 5;
animation_timeout_sec = 0;
asterisk = "0x2022";
auth_fails = 2; # numbers of failed authentification before special animation
battery_id = "BAT1";
bigclock = "en";
bigclock_12hr = false;
bigclock_seconds = false;
# Blank main box background
# Setting to false will make it transparent
blank_box = false;
# Border foreground color id
border_fg = "0x00FFFFFF";
# Title to show at the top of the main box
# If set to null, none will be shown
box_title = null;
# Brightness decrease command
brightness_down_cmd = "$PREFIX_DIRECTORY/bin/brightnessctl -q -n s 10%-";
# Brightness decrease key combination, or null to disable
brightness_down_key = "F5";
# Brightness increase command
brightness_up_cmd = "$PREFIX_DIRECTORY/bin/brightnessctl -q -n s +10%";
# Brightness increase key combination, or null to disable
brightness_up_key = "F6";
# Erase password input on failure
# Core animation
animation = "none"; # none or doom or matrix or gameoflife or a dur file
# Ly supports 24-bit true color with styling, which means each color is a 32-bit value.
# The format is 0xSSRRGGBB, where SS is the styling, RR is red, GG is green, and BB is blue.
# Here are the possible styling options:
# TB_BOLD 0x01000000
# TB_UNDERLINE 0x02000000
# TB_REVERSE 0x04000000
# TB_ITALIC 0x08000000
# TB_BLINK 0x10000000
# TB_HI_BLACK 0x20000000
# TB_BRIGHT 0x40000000
# TB_DIM 0x80000000
# Programmatically, you'd apply them using the bitwise OR operator (|), but because Ly's
# configuration doesn't support using it, you have to manually compute the color value.
# Note that, if you want to use the default color value of the terminal, you can use the
# special value 0x00000000. This means that, if you want to use black, you *must* use
# the styling option TB_HI_BLACK (the RGB values are ignored when using this option).
# Basic TUI settings
clear_password = true;
# Format string for clock in top right corner (see strftime specification). Example: %c
# If null, the clock won't be shown
clock = true;
# CMatrix animation foreground color id
cmatrix_fg = "0x0000FF00";
# CMatrix animation character string head color id
cmatrix_head_col = "0x01FFFFFF";
# CMatrix animation minimum codepoint. It uses a 16-bit integer
# For Japanese characters for example, you can use 0x3000 here
cmatrix_min_codepoint = "0x21";
# CMatrix animation maximum codepoint. It uses a 16-bit integer
# For Japanese characters for example, you can use 0x30FF here
cmatrix_max_codepoint = "0x7B";
# Color mixing animation first color id
colormix_col1 = "0x00FF0000";
# Color mixing animation second color id
colormix_col2 = "0x000000FF";
# Color mixing animation third color id
colormix_col3 = "0x20000000";
# Custom sessions directory
# You can specify multiple directories,
# e.g. $CONFIG_DIRECTORY/ly/custom-sessions:$PREFIX_DIRECTORY/share/custom-sessions
custom_sessions = "$CONFIG_DIRECTORY/ly/custom-sessions";
# Input box active by default on startup
# Available inputs: info_line, session, login, password
default_input = "password";
# DOOM animation fire height (1 thru 9)
doom_fire_height = 6;
# DOOM animation fire spread (0 thru 4)
doom_fire_spread = 2;
# DOOM animation custom top color (low intensity flames)
doom_top_color = "0x009F2707";
# DOOM animation custom middle color (medium intensity flames)
doom_middle_color = "0x00C78F17";
# DOOM animation custom bottom color (high intensity flames)
doom_bottom_color = "0x00FFFFFF";
# Dur file path
dur_file_path = "$CONFIG_DIRECTORY/ly/example.dur";
# Dur file alignment
# The dur file can be aligned with a direction and centered easily with the flags below
# Available inputs: topleft, topcenter, topright, centerleft, center, centerright, bottomleft, bottomcenter, bottomright
dur_offset_alignment = "center";
# Dur offset x direction (value is added to the current position determined by alignment, negatives are supported)
dur_x_offset = 0;
# Dur offset y direction (value is added to the current position determined by alignment, negatives are supported)
dur_y_offset = 0;
# Set margin to the edges of the DM (useful for curved monitors)
edge_margin = 0;
# Error background color id
error_bg = "0x00000000";
# Error foreground color id
# Default is red and bold
error_fg = "0x01FF0000";
# Foreground color id
fg = "0x00FFFFFF";
# Render true colors (if supported)
# If false, output will be in eight-color mode
# All eight-color mode color codes:
# TB_DEFAULT 0x0000
# TB_BLACK 0x0001
# TB_RED 0x0002
# TB_GREEN 0x0003
# TB_YELLOW 0x0004
# TB_BLUE 0x0005
# TB_MAGENTA 0x0006
# TB_CYAN 0x0007
# TB_WHITE 0x0008
# If full color is off, the styling options still work. The colors are
# always 32-bit values with the styling in the most significant byte.
# Note: If using the dur_file animation option and the dur file's color range
# is saved as 256 with this option disabled, the file will not be drawn.
fg = "0x01cd6400";
full_color = true;
# Game of Life entropy interval (0 = disabled, >0 = add entropy every N generations)
# 0 -> Pure Conway's Game of Life (will eventually stabilize)
# 10 -> Add entropy every 10 generations (recommended for continuous activity)
# 50+ -> Less frequent entropy for more natural evolution
gameoflife_entropy_interval = 10;
# Game of Life animation foreground color id
gameoflife_fg = "0x0000FF00";
# Game of Life frame delay (lower = faster animation, higher = slower)
# 1-3 -> Very fast animation
# 6 -> Default smooth animation speed
# 10+ -> Slower, more contemplative speed
gameoflife_frame_delay = 3;
# Game of Life initial cell density (0.0 to 1.0)
# 0.1 -> Sparse, minimal activity
# 0.4 -> Balanced activity (recommended)
# 0.7+ -> Dense, chaotic patterns
gameoflife_initial_density = 0.666;
# Command executed when pressing hibernate key (can be null)
hibernate_cmd = null;
# Specifies the key combination used for hibernate
hibernate_key = "F4";
# Remove main box borders
hide_borders = false;
# Remove power management command hints
hide_key_hints = false;
# Remove keyboard lock states from the top right corner
hide_keyboard_locks = false;
# Remove version number from the top left corner
hide_keyboard_locks = true;
hide_version_string = false;
# Command executed when no input is detected for a certain time
# If null, no command will be executed
inactivity_cmd = null;
# Executes a command after a certain amount of seconds
inactivity_delay = 0;
# Initial text to show on the info line
# If set to null, the info line defaults to the hostname
initial_info_text = null;
# Input boxes length
input_len = 34;
# Active language
# Available languages are found in $CONFIG_DIRECTORY/ly/lang/
lang = "en";
# Command executed when logging in
# If null, no command will be executed
# Important: the code itself must end with `exec "$@"` in order to launch the session!
# You can also set environment variables in there, they'll persist until logout
login_cmd = null;
# Path for login.defs file (used for listing all local users on the system on
# Linux)
#login_defs_path = /etc/login.defs
# Command executed when logging out
# If null, no command will be executed
# Important: the session will already be terminated when this command is executed, so
# no need to add `exec "$@"` at the end
logout_cmd = null;
# General log file path
#ly_log = /var/log/ly.log
# Main box horizontal margin
margin_box_h = 2;
# Main box vertical margin
margin_box_v = 1;
# Set numlock on/off at startup
numlock = false;
# Default path
# If null, ly doesn't set a path
#path = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Command executed when pressing restart_key
#restart_cmd = "/sbin/shutdown -r now"
# Specifies the key combination used for restart
restart_key = "F2";
# Save the current desktop and login as defaults, and load them on startup
save = true;
# Service name (set to ly to use the provided pam config file)
service_name = "ly";
# Session log file path
# This will contain stdout and stderr of Wayland sessions
# By default it's saved in the user's home directory
# Important: due to technical limitations, X11, shell sessions as well as
# launching session via KMSCON aren't supported, which means you won't get any
# logs from those sessions.
# If null, no session log will be created
session_log = null;
bigclock = "en";
clock = "%H:%M";
# Setup command
setup_cmd = "$CONFIG_DIRECTORY/ly/setup.sh";
colormix_col1 = "0x08E85D04";
colormix_col2 = "0x08FABD2F";
colormix_col3 = "0x08FE8019";
# Command executed when pressing shutdown_key
shutdown_cmd = "/sbin/shutdown $PLATFORM_SHUTDOWN_ARG now";
# Box appearance
#border_fg = "0x00FFFFFF";
blank_box = true;
box_title = "tomasr@nixos";
#margin_box_h = 2;
#margin_box_v = 1;
#text_in_center = false;
# Specifies the key combination used for shutdown
shutdown_key = "F1";
# Animation: Conways Game of Life (optional, comment out for minimal setup)
gameoflife_fg = "0x40FFFFFF";
# Command executed when pressing sleep key (can be null)
gameoflife_frame_delay = 3;
gameoflife_entropy_interval = 10;
gameoflife_initial_density = 0.666;
# Optional commands (leave null or comment if unused)
hibernate_cmd = null;
inactivity_cmd = null;
login_cmd = "start-hyprland";
#logout_cmd = null;
sleep_cmd = null;
# Specifies the key combination used for sleep
# System commands keys
shutdown_cmd = "/sbin/shutdown $PLATFORM_SHUTDOWN_ARG now";
shutdown_key = "F1";
restart_key = "F2";
sleep_key = "F3";
hibernate_key = "F4";
# Command executed when starting Ly (before the TTY is taken control of)
# See file at path below for an example of changing the default TTY colors
start_cmd = "$CONFIG_DIRECTORY/ly/startup.sh";
# top bar
session_log = null;
initial_info_text = null; #
# Custom sessions
#custom_sessions = "$CONFIG_DIRECTORY/ly/custom-sessions";
#waylandsessions = "$PREFIX_DIRECTORY/share/wayland-sessions";
#xsessions = "$PREFIX_DIRECTORY/share/xsessions";
# Center the session name.
text_in_center = false;
# Xorg settings (only needed if using X)
#x_cmd = "$PREFIX_DIRECTORY/bin/X";
#x_vt = null;
#xauth_cmd = "$PREFIX_DIRECTORY/bin/xauth";
#xinitrc = "~/.xinitrc";
# Default vi mode
# normal -> normal mode
# insert -> insert mode
vi_default_mode = "normal";
# Enable vi keybindings
vi_mode = false;
# Wayland desktop environments
# You can specify multiple directories,
# e.g. $PREFIX_DIRECTORY/share/wayland-sessions:$PREFIX_DIRECTORY/local/share/wayland-sessions
waylandsessions = "$PREFIX_DIRECTORY/share/wayland-sessions";
# Xorg server command
x_cmd = "$PREFIX_DIRECTORY/bin/X";
# Xorg virtual terminal number
# Mostly useful for FreeBSD where choosing the current TTY causes issues
# If null, the current TTY will be chosen
x_vt = null;
# Xorg xauthority edition tool
xauth_cmd = "$PREFIX_DIRECTORY/bin/xauth";
# xinitrc
# If null, the xinitrc session will be hidden
xinitrc = "~/.xinitrc";
# Xorg desktop environments
# You can specify multiple directories,
# e.g. $PREFIX_DIRECTORY/share/xsessions:$PREFIX_DIRECTORY/local/share/xsessions
xsessions = "$PREFIX_DIRECTORY/share/xsessions";
# Setup / startup scripts
#setup_cmd = "$CONFIG_DIRECTORY/ly/setup.sh";
#start_cmd = "$CONFIG_DIRECTORY/ly/startup.sh";
};
};
}
-94
View File
@@ -1,94 +0,0 @@
{...}: {
# a minimal ly config as the big config (ly.nix) didnt worked
services.displayManager.ly = {
enable = true;
settings = {
# Core animation
animation = "none"; # none or doom or matrix or gameoflife or a dur file
# Ly supports 24-bit true color with styling, which means each color is a 32-bit value.
# The format is 0xSSRRGGBB, where SS is the styling, RR is red, GG is green, and BB is blue.
# Here are the possible styling options:
# TB_BOLD 0x01000000
# TB_UNDERLINE 0x02000000
# TB_REVERSE 0x04000000
# TB_ITALIC 0x08000000
# TB_BLINK 0x10000000
# TB_HI_BLACK 0x20000000
# TB_BRIGHT 0x40000000
# TB_DIM 0x80000000
# Programmatically, you'd apply them using the bitwise OR operator (|), but because Ly's
# configuration doesn't support using it, you have to manually compute the color value.
# Note that, if you want to use the default color value of the terminal, you can use the
# special value 0x00000000. This means that, if you want to use black, you *must* use
# the styling option TB_HI_BLACK (the RGB values are ignored when using this option).
# Basic TUI settings
clear_password = true;
default_input = "password";
fg = "0x01cd6400";
full_color = true;
hide_borders = false;
hide_key_hints = false;
hide_keyboard_locks = true;
hide_version_string = false;
input_len = 34;
lang = "en";
numlock = false;
save = true;
service_name = "ly";
bigclock = "en";
clock = "%H:%M";
colormix_col1 = "0x08E85D04";
colormix_col2 = "0x08FABD2F";
colormix_col3 = "0x08FE8019";
# Box appearance
#border_fg = "0x00FFFFFF";
blank_box = true;
box_title = "tomasr@nixos";
#margin_box_h = 2;
#margin_box_v = 1;
#text_in_center = false;
# Animation: Conways Game of Life (optional, comment out for minimal setup)
gameoflife_fg = "0x40FFFFFF";
gameoflife_frame_delay = 3;
gameoflife_entropy_interval = 10;
gameoflife_initial_density = 0.666;
# Optional commands (leave null or comment if unused)
hibernate_cmd = null;
inactivity_cmd = null;
login_cmd = "start-hyprland";
#logout_cmd = null;
sleep_cmd = null;
# System commands keys
shutdown_cmd = "/sbin/shutdown $PLATFORM_SHUTDOWN_ARG now";
shutdown_key = "F1";
restart_key = "F2";
sleep_key = "F3";
hibernate_key = "F4";
# top bar
session_log = null;
initial_info_text = null; #
# Custom sessions
#custom_sessions = "$CONFIG_DIRECTORY/ly/custom-sessions";
#waylandsessions = "$PREFIX_DIRECTORY/share/wayland-sessions";
#xsessions = "$PREFIX_DIRECTORY/share/xsessions";
# Xorg settings (only needed if using X)
#x_cmd = "$PREFIX_DIRECTORY/bin/X";
#x_vt = null;
#xauth_cmd = "$PREFIX_DIRECTORY/bin/xauth";
#xinitrc = "~/.xinitrc";
# Setup / startup scripts
#setup_cmd = "$CONFIG_DIRECTORY/ly/setup.sh";
#start_cmd = "$CONFIG_DIRECTORY/ly/startup.sh";
};
};
}
-16
View File
@@ -1,16 +0,0 @@
{
config,
pkgs,
...
}: {
# udev with only the necessary rules. See udev.nix to get all the rules
services.udev.extraRules = ''
# adapted from here https://wiki.nixos.org/wiki/Keychron_M6
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="32ac", MODE="0660", GROUP="users", TAG+="uaccess"
# taken from here
SUBSYSTEMS=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0013", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0018", TAG+="uaccess"
'';
}
+3
View File
@@ -0,0 +1,3 @@
Used for custom qt modules.
Previously, `qtbatticon`. (Moved to `../../hostsModules/laptop/qt/qtbatticon`)
-176
View File
@@ -1,176 +0,0 @@
# because cbatticon, batticonplus and other things didn't work.
# chatGpt did this.
# https://chatgpt.com/c/69da11b3-ba24-8331-b7b0-a58a72e69d42
# at your risk and perils
# click on the icon to get a notification with state, percentage and wattage
{
lib,
stdenv,
qt6,
pkg-config,
pkgs,
}:
stdenv.mkDerivation {
pname = "qtbatticon";
version = "1.0";
src = pkgs.writeTextFile {
name = "qtbatticon.cpp";
text = ''
#include <QApplication>
#include <QSystemTrayIcon>
#include <QTimer>
#include <QFile>
#include <QTextStream>
#include <QIcon>
#include <QString>
#include <QDebug>
#include <cstdlib>
QString readFile(const QString &path) {
QFile f(path);
if (!f.open(QIODevice::ReadOnly)) return "";
QTextStream in(&f);
return in.readAll().trimmed();
}
int readInt(const QString &path) {
return readFile(path).toInt();
}
double readDouble(const QString &path) {
QFile f(path);
if (!f.open(QIODevice::ReadOnly)) return 0;
QTextStream in(&f);
return in.readAll().trimmed().toDouble();
}
int toStep(int capacity) {
return (capacity / 10) * 10;
}
QString pad3(int n) {
return QString("%1").arg(n, 3, 10, QChar('0'));
}
double getPowerW(const QString &batPath) {
double current_uA = readDouble(batPath + "/current_now");
double voltage_uV = readDouble(batPath + "/voltage_now");
if (current_uA > 0 && voltage_uV > 0) {
return (current_uA * voltage_uV) / 1e12;
}
return -1;
}
QIcon batteryIcon(int capacity, bool charging) {
int step = toStep(capacity);
QString num = pad3(step);
QString base = "/run/current-system/sw/share/icons/Papirus/24x24/panel/";
QString file;
if (charging) {
file = base + "battery-" + num + "-charging.svg";
} else {
file = base + "battery-" + num + ".svg";
}
QIcon icon(file);
if (icon.isNull()) {
qDebug() << "FAILED icon:" << file;
icon = QIcon(base + "battery-100.svg");
}
return icon;
}
void sendNotification(const QString &title, const QString &body) {
QString cmd = "notify-send \"" + title + "\" \"" + body + "\"";
system(cmd.toUtf8().constData());
}
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
QString batPath = "/sys/class/power_supply/BAT1";
QSystemTrayIcon tray;
auto updateIcon = [&]() {
int capacity = readInt(batPath + "/capacity");
QString status = readFile(batPath + "/status");
bool charging = status.contains("Charging");
tray.setIcon(batteryIcon(capacity, charging));
};
auto notify = [&]() {
int capacity = readInt(batPath + "/capacity");
QString status = readFile(batPath + "/status");
bool charging = status.contains("Charging");
bool discharging = status.contains("Discharging");
double power = getPowerW(batPath);
QString state;
if (charging) state = "Charging";
else if (discharging) state = "Discharging";
else state = status;
QString powerStr = (power > 0.01)
? QString::number(power, 'f', 2) + " W"
: "N/A";
QString msg =
QString("%1\n%2%\n%3")
.arg(state)
.arg(capacity)
.arg(powerStr);
sendNotification("Battery status", msg);
};
QObject::connect(&tray, &QSystemTrayIcon::activated,
[&](QSystemTrayIcon::ActivationReason r) {
if (r == QSystemTrayIcon::Trigger) {
notify();
}
});
updateIcon();
tray.setVisible(true);
QTimer timer;
QObject::connect(&timer, &QTimer::timeout, updateIcon);
timer.start(5000);
return app.exec();
}
'';
};
nativeBuildInputs = [
pkg-config
qt6.wrapQtAppsHook
];
buildInputs = [
qt6.qtbase
qt6.qtsvg
pkgs.papirus-icon-theme
];
dontUnpack = true;
buildPhase = ''
g++ $src -o qtbatticon \
$(pkg-config --cflags --libs Qt6Widgets)
'';
installPhase = ''
mkdir -p $out/bin
install -m755 qtbatticon $out/bin/
'';
}
-73
View File
@@ -1,73 +0,0 @@
# taken and adapted https://github.com/miniMinn24/Battery_Notify with MIT License
{
writeShellApplication,
mplayer,
brightnessctl,
...
}: let
NotifySound = ../../assets/battery_notify.mp3;
in
writeShellApplication {
name = "custom-batterynotify";
runtimeInputs = [
mplayer
brightnessctl
];
text = ''
# Delay for startup
sleep 5
# Change your sound path here
playsound() {
mplayer ${NotifySound}
}
adjustBrightness() {
local adjustment="$1"
brightnessctl set "$adjustment"
}
sendNotification() {
local title="$1"
local message="$2"
notify-send -h string:x-canonical-private-synchronous:sys-notify -e -u low "$title" "$message"
}
# Runs full time in background
x=0
while true; do
Battery_Status="$(\cat /sys/class/power_supply/BAT*/status)"
Battery_Capacity=$(\cat /sys/class/power_supply/BAT*/capacity)
case "$Battery_Status" in
"Discharging")
if [ $x -eq 1 ]; then
sendNotification "Discharging" "Remains: <b>''${Battery_Capacity}%</b>"
adjustBrightness "15%-"
playsound
x=0
fi
;;
"Charging")
if [ $x -eq 0 ]; then
sendNotification "Charging" "Current: <b>''${Battery_Capacity}%</b>"
adjustBrightness "15%+"
playsound
x=1
fi
;;
"Full")
if [ $x -eq 0 ]; then
sendNotification "Fully Charged" "Noice: <b>''${Battery_Capacity}%</b>"
playsound
x=1
fi
;;
esac
sleep 1
done
'';
}
-48
View File
@@ -1,48 +0,0 @@
# taken and adapted https://github.com/miniMinn24/Battery_Notify with MIT License
{
writeShellApplication,
mplayer,
brightnessctl,
...
}: let
NotifySound = ../../assets/battery_notify.mp3;
in
writeShellApplication {
name = "custom-batterywarning";
runtimeInputs = [
mplayer
brightnessctl
];
text = ''
# Delay for startup
sleep 5
playsound() {
mplayer ${NotifySound}
}
while true; do
Battery_Status="$(cat /sys/class/power_supply/BAT*/status)"
Battery_Capacity="$(cat /sys/class/power_supply/BAT*/capacity)"
if [ "$Battery_Status" == "Discharging" ]; then
if [ "$Battery_Capacity" -le 20 ] && [ "$Battery_Capacity" -ge 10 ]; then
notify-send -e -u critical "Battery Low!" "Power running out: <b>''${Battery_Capacity}%</b>"
playsound
sleep 180
elif [ "$Battery_Capacity" -lt 10 ]; then
notify-send -e -u critical "Battery Low!" "<b>Save your works</b> before immediate shutdown."
playsound
sleep 180
fi
else
sleep 120
fi
done
'';
}