Formated with alejandra

This commit is contained in:
Tomas Rivera
2026-04-13 15:32:01 +02:00
parent 0b2b88d41b
commit baaad664db
18 changed files with 1560 additions and 1545 deletions
+2 -1
View File
@@ -10,7 +10,8 @@
url = "github:nix-community/home-manager/release-25.11"; url = "github:nix-community/home-manager/release-25.11";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
caelestia-shell = { # based on quickshell. See https://github.com/caelestia-dots/shell caelestia-shell = {
# based on quickshell. See https://github.com/caelestia-dots/shell
url = "github:caelestia-dots/shell"; url = "github:caelestia-dots/shell";
inputs.nixpkgs.follows = "nixpkgs-unstable"; inputs.nixpkgs.follows = "nixpkgs-unstable";
}; };
+10 -12
View File
@@ -8,10 +8,7 @@
libs, libs,
inputs, inputs,
... ...
}: }: {
{
imports = [ imports = [
# Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
@@ -23,8 +20,7 @@
../../modules/nixos/udevsimple.nix ../../modules/nixos/udevsimple.nix
]; ];
programs.nix-ld.enable = true; #Run unpatched dynamic binaries on NixOS. For example lets run ./a.out from gcc
programs.nix-ld.enable=true; #Run unpatched dynamic binaries on NixOS. For example lets run ./a.out from gcc
documentation.man.generateCaches = true; # used for the man script documentation.man.generateCaches = true; # used for the man script
@@ -83,12 +79,13 @@
# zsh dont want to work if it is not initialzed here. # zsh dont want to work if it is not initialzed here.
programs.zsh.enable = true; programs.zsh.enable = true;
security.wrappers.gsr-kms-server = { # to remove the password prompt when using gpu-screen-recorder security.wrappers.gsr-kms-server = {
# to remove the password prompt when using gpu-screen-recorder
owner = "root"; owner = "root";
group = "root"; group = "root";
capabilities = "cap_sys_admin+ep"; capabilities = "cap_sys_admin+ep";
source = "${pkgs.gpu-screen-recorder}/bin/gsr-kms-server"; source = "${pkgs.gpu-screen-recorder}/bin/gsr-kms-server";
}; };
# Enable the GNOME Desktop Environment. # Enable the GNOME Desktop Environment.
# services.displayManager.gdm.enable = true; # services.displayManager.gdm.enable = true;
@@ -160,7 +157,6 @@
options = "--delete-older-than 7d"; # every week delete generations older than a month options = "--delete-older-than 7d"; # every week delete generations older than a month
}; };
# Allow unfree packages # Allow unfree packages
nixpkgs.config.allowUnfree = true; # Nonfree packages: Obsidian nixpkgs.config.allowUnfree = true; # Nonfree packages: Obsidian
@@ -221,9 +217,10 @@
framework-tool framework-tool
framework-tool-tui framework-tool-tui
krita # image edition krita # image edition
yt-dlp# some youtube downloader yt-dlp # some youtube downloader
vlc vlc
(pkgs-unstable.python314.withPackages (ps: with ps; [ (pkgs-unstable.python314.withPackages (ps:
with ps; [
matplotlib matplotlib
networkx networkx
scipy scipy
@@ -234,7 +231,8 @@
# utils for dev # utils for dev
pkg-config pkg-config
gdb gdb
raylib glfw # raylib and some dependecies raylib
glfw # raylib and some dependecies
rembg # background remover rembg # background remover
#some nix tools #some nix tools
manix manix
+6 -4
View File
@@ -25,7 +25,7 @@
#../../modules/home-manager/quickshell.nix # used for widgets, waybar and notifications # i migrated to caelestia-shell #../../modules/home-manager/quickshell.nix # used for widgets, waybar and notifications # i migrated to caelestia-shell
inputs.caelestia-shell.homeManagerModules.default inputs.caelestia-shell.homeManagerModules.default
../../modules/home-manager/caelestia.nix # caelestia shell is based on quickshell ../../modules/home-manager/caelestia.nix # caelestia shell is based on quickshell
#../../modules/home-manager/oh-my-posh.nix # zsh customizer #../../modules/home-manager/oh-my-posh.nix # zsh customizer
../../modules/home-manager/oh-my-zsh.nix # another zsh customizer ../../modules/home-manager/oh-my-zsh.nix # another zsh customizer
#../../modules/home-manager/hypridle.nix #../../modules/home-manager/hypridle.nix
#../../modules/home-manager/swaylock.nix #../../modules/home-manager/swaylock.nix
@@ -88,11 +88,12 @@
#(pkgs.callPackage ../../modules/scripts/QSsysinfo.nix {}) #(pkgs.callPackage ../../modules/scripts/QSsysinfo.nix {})
#(pkgs.callPackage ../../modules/scripts/QSnotifycache.nix {}) #(pkgs.callPackage ../../modules/scripts/QSnotifycache.nix {})
#(pkgs.callPackage ../../modules/scripts/QSnotifyhistory.nix {}) #(pkgs.callPackage ../../modules/scripts/QSnotifyhistory.nix {})
#pkgs #pkgs
pkgs.gruvbox-gtk-theme pkgs.gruvbox-gtk-theme
pkgs.biber pkgs.biber
(pkgs.texliveMedium.withPackages ( (pkgs.texliveMedium.withPackages (
ps: with ps; [ ps:
with ps; [
# these few pkgs are used in the CV template # these few pkgs are used in the CV template
titlesec # allows creating custom \section titlesec # allows creating custom \section
marvosym # some symboles marvosym # some symboles
@@ -125,7 +126,8 @@
footmisc footmisc
#(setq org-latex-compiler "lualatex") #(setq org-latex-compiler "lualatex")
#(setq org-preview-latex-default-process 'dvisvgm) #(setq org-preview-latex-default-process 'dvisvgm)
])) ]
))
# # It is sometimes useful to fine-tune packages, for example, by applying # # It is sometimes useful to fine-tune packages, for example, by applying
# # overrides. You can do that directly here, just don't forget the # # overrides. You can do that directly here, just don't forget the
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of # # parentheses. Maybe you want to install Nerd Fonts with a limited number of
+42 -37
View File
@@ -4,13 +4,12 @@
pkgs-unstable, pkgs-unstable,
caelestia-shell, caelestia-shell,
... ...
}: }: let
let
sisyphe = ../../assets/sisyphe.gif; sisyphe = ../../assets/sisyphe.gif;
pepe-music = ../../assets/pepe-music.gif; pepe-music = ../../assets/pepe-music.gif;
in { in {
home.file.".face" = {
home.file.".face" = { # this is were caelestia will search for profiles pictures # this is were caelestia will search for profiles pictures
source = ../../assets/sisyphePFP.png; source = ../../assets/sisyphePFP.png;
}; };
# set profile picture in ~/.face # set profile picture in ~/.face
@@ -21,7 +20,8 @@ in {
target = "graphical-session.target"; target = "graphical-session.target";
environment = []; environment = [];
}; };
settings = { # default config https://github.com/caelestia-dots/shell?tab=readme-ov-file#example-configuration settings = {
# default config https://github.com/caelestia-dots/shell?tab=readme-ov-file#example-configuration
appearance = { appearance = {
mediaGifSpeedAdjustment = 500; mediaGifSpeedAdjustment = 500;
sessionGifSpeed = 0.7; sessionGifSpeed = 0.7;
@@ -30,7 +30,8 @@ in {
scale = 1; scale = 1;
}; };
}; };
/*font = { /*
font = {
family = { family = {
clock = "Rubik"; # (TODO figure out those fonts) clock = "Rubik"; # (TODO figure out those fonts)
material = "Material Symboles Rounded"; material = "Material Symboles Rounded";
@@ -40,7 +41,8 @@ in {
size = { size = {
scale = 1; scale = 1;
}; };
};*/ };
*/
padding = { padding = {
scale = 1; scale = 1;
}; };
@@ -59,10 +61,10 @@ in {
general = { general = {
logo = "caelestia"; logo = "caelestia";
apps = { apps = {
terminal = [ "kitty" ]; # default foot terminal = ["kitty"]; # default foot
audio = [ "pavucontrol" ]; audio = ["pavucontrol"];
playback = [ "mpv" ]; # what's that? playback = ["mpv"]; # what's that?
explorer = [ "nautilus" ]; # default thunar explorer = ["nautilus"]; # default thunar
}; };
battery = { battery = {
wanLevels = [ wanLevels = [
@@ -103,7 +105,7 @@ in {
} }
{ {
timeout = 600; timeout = 600;
idleAction = [ "systemctl" "suspend-then-hibernate" ]; idleAction = ["systemctl" "suspend-then-hibernate"];
} }
]; ];
}; };
@@ -235,7 +237,7 @@ in {
} }
]; ];
}; };
excludedScreens = [ "" ]; # default says "" those this work? excludedScreens = [""]; # default says "" those this work?
}; };
border = { border = {
rounding = 25; rounding = 25;
@@ -254,7 +256,7 @@ in {
name = "Calculator"; name = "Calculator";
icon = "calculate"; icon = "calculate";
description = "Do simple math equations (powered by Qalc)"; description = "Do simple math equations (powered by Qalc)";
command = [ "autocomplete" "calc" ]; command = ["autocomplete" "calc"];
enabled = false; # default true enabled = false; # default true
dangerous = false; dangerous = false;
} }
@@ -262,7 +264,7 @@ in {
name = "Scheme"; name = "Scheme";
icon = "palette"; icon = "palette";
description = "Change the current colour scheme"; description = "Change the current colour scheme";
command = [ "autocomplete" "scheme" ]; command = ["autocomplete" "scheme"];
enabled = false; # default true enabled = false; # default true
dangerous = false; dangerous = false;
} }
@@ -270,7 +272,7 @@ in {
name = "Wallpaper"; name = "Wallpaper";
icon = "image"; icon = "image";
description = "Change the current wallpaper"; description = "Change the current wallpaper";
command = [ "autocomplete" "wallpaper" ]; command = ["autocomplete" "wallpaper"];
enabled = false; # default true enabled = false; # default true
dangerous = false; dangerous = false;
} }
@@ -278,7 +280,7 @@ in {
name = "Variant"; # to remove name = "Variant"; # to remove
icon = "colors"; icon = "colors";
description = "Change the current scheme variant"; description = "Change the current scheme variant";
command = [ "autocomplete" "variant" ]; command = ["autocomplete" "variant"];
enabled = true; enabled = true;
dangerous = false; dangerous = false;
} }
@@ -286,7 +288,7 @@ in {
name = "Transparency"; name = "Transparency";
icon = "opacity"; icon = "opacity";
description = "Change shell transparency"; description = "Change shell transparency";
command = [ "autocomplete" "transparency" ]; command = ["autocomplete" "transparency"];
enabled = false; enabled = false;
dangerous = false; dangerous = false;
} }
@@ -294,7 +296,7 @@ in {
name = "Random"; name = "Random";
icon = "casino"; icon = "casino";
description = "Switch to a random wallpaper"; description = "Switch to a random wallpaper";
command = [ "caelestia" "wallpaper" "-r" ]; command = ["caelestia" "wallpaper" "-r"];
enabled = false; # default true enabled = false; # default true
dangerous = false; dangerous = false;
} }
@@ -302,7 +304,7 @@ in {
name = "Light"; name = "Light";
icon = "light_mode"; icon = "light_mode";
description = "Change the scheme to light mode"; description = "Change the scheme to light mode";
command = [ "setMode" "light" ]; command = ["setMode" "light"];
enabled = false; # default true enabled = false; # default true
dangerous = false; dangerous = false;
} }
@@ -310,7 +312,7 @@ in {
name = "Dark"; name = "Dark";
icon = "dark_mode"; icon = "dark_mode";
description = "Change the scheme to dark mode"; description = "Change the scheme to dark mode";
command = [ "setMode" "dark" ]; command = ["setMode" "dark"];
enabled = false; # default true enabled = false; # default true
dangerous = false; dangerous = false;
} }
@@ -318,7 +320,7 @@ in {
name = "Shutdown"; name = "Shutdown";
icon = "power_settings_new"; icon = "power_settings_new";
description = "Shutdown the system"; description = "Shutdown the system";
command = [ "systemctl" "poweroff" ]; command = ["systemctl" "poweroff"];
enabled = true; enabled = true;
dangerous = true; dangerous = true;
} }
@@ -326,7 +328,7 @@ in {
name = "Reboot"; name = "Reboot";
icon = "cached"; icon = "cached";
description = "Reboot the system"; description = "Reboot the system";
command = [ "systemctl" "reboot" ]; command = ["systemctl" "reboot"];
enabled = true; enabled = true;
dangerous = true; dangerous = true;
} }
@@ -334,7 +336,7 @@ in {
name = "Lock"; # does this work with ly? name = "Lock"; # does this work with ly?
icon = "lock"; icon = "lock";
description = "Log out of the current session"; description = "Log out of the current session";
command = [ "loginctl" "terminate-user" "" ]; command = ["loginctl" "terminate-user" ""];
enabled = true; enabled = true;
dangerous = true; dangerous = true;
} }
@@ -342,7 +344,7 @@ in {
name = "Sleep"; name = "Sleep";
icon = "bedtime"; icon = "bedtime";
description = "Suspend then hibernate"; description = "Suspend then hibernate";
command = [ "systemctl" "suspend-then-hibernate" ]; command = ["systemctl" "suspend-then-hibernate"];
enabled = true; enabled = true;
dangerous = false; dangerous = false;
} }
@@ -350,7 +352,7 @@ in {
name = "Settings"; name = "Settings";
icon = "settings"; icon = "settings";
description = "Configure the shell"; description = "Configure the shell";
command = [ "caelestia" "shell" "controlCenter" "open" ]; command = ["caelestia" "shell" "controlCenter" "open"];
enabled = false; # default true enabled = false; # default true
dangerous = false; dangerous = false;
} }
@@ -361,7 +363,8 @@ in {
maxShown = 7; maxShown = 7;
maxWallpapers = 9; maxWallpapers = 9;
specialPrefix = "@"; specialPrefix = "@";
useFuzzy = { # should try useFuzzy = {
# should try
apps = false; apps = false;
actions = false; actions = false;
schemes = false; schemes = false;
@@ -384,7 +387,8 @@ in {
openeExpanded = false; openeExpanded = false;
expire = true; expire = true;
}; };
osd = { # thats the slider for brightness and sound osd = {
# thats the slider for brightness and sound
enabled = true; enabled = true;
enableBrightness = true; enableBrightness = true;
enableMicrophone = false; enableMicrophone = false;
@@ -423,10 +427,10 @@ in {
reboot = "cached"; reboot = "cached";
}; };
commands = { commands = {
logout = [ "loginctl" "terminate-user" ]; logout = ["loginctl" "terminate-user"];
shutdown = [ "systemctl" "poweroff" ]; shutdown = ["systemctl" "poweroff"];
hibernate = [ "systemctl" "hibernate" ]; hibernate = ["systemctl" "hibernate"];
reboot = [ "systemctl" "reboot" ]; reboot = ["systemctl" "reboot"];
}; };
}; };
sidebar = { sidebar = {
@@ -495,7 +499,8 @@ in {
} }
]; ];
}; };
cli = { # default config https://github.com/caelestia-dots/cli?tab=readme-ov-file#configuring cli = {
# default config https://github.com/caelestia-dots/cli?tab=readme-ov-file#configuring
enable = true; # Also add caelestia-cli to path enable = true; # Also add caelestia-cli to path
settings = { settings = {
record = { record = {
@@ -546,7 +551,7 @@ in {
initialTitle = "Spotify Free"; initialTitle = "Spotify Free";
} }
]; ];
command = [ "spicetify" "watch" "-s" ]; command = ["spicetify" "watch" "-s"];
move = true; move = true;
}; };
feishin = { feishin = {
@@ -571,7 +576,7 @@ in {
}; };
} }
]; ];
command = [ "foot" "-a" "btop" "-T" "btop" "fish" "-C" "exec btop" ]; # maybe switch to btm and kitty? command = ["foot" "-a" "btop" "-T" "btop" "fish" "-C" "exec btop"]; # maybe switch to btm and kitty?
}; };
}; };
todo = { todo = {
@@ -582,12 +587,12 @@ in {
class = "Todoist"; class = "Todoist";
} }
]; ];
command = [ "todoist" ]; command = ["todoist"];
move = true; move = true;
}; };
}; };
}; };
}; };
}; };
}; };
} }
+90 -85
View File
@@ -1,14 +1,19 @@
{ config, pkgs, ... }: # ls replacement {
config,
pkgs,
...
}:
# ls replacement
# see ./zsh.nix for the alias (usefull to se default flags) # see ./zsh.nix for the alias (usefull to se default flags)
{ {
programs.eza = { programs.eza = {
enable = true; enable = true;
enableZshIntegration = true; enableZshIntegration = true;
theme = { # from https://github.com/eza-community/eza-themes/blob/main/themes/gruvbox-dark.yml theme = {
# from https://github.com/eza-community/eza-themes/blob/main/themes/gruvbox-dark.yml
colourful = true; colourful = true;
filekinds= { filekinds = {
normal = {foreground = "#ebdbb2";}; normal = {foreground = "#ebdbb2";};
directory = {foreground = "#83a598";}; directory = {foreground = "#83a598";};
symlink = {foreground = "#8ec07c";}; symlink = {foreground = "#8ec07c";};
@@ -16,97 +21,97 @@
block_device = {foreground = "#fb4934";}; block_device = {foreground = "#fb4934";};
char_device = {foreground = "#fb4934";}; char_device = {foreground = "#fb4934";};
socket = {foreground = "#665c54";}; socket = {foreground = "#665c54";};
special= {foreground= "#d3869b";}; special = {foreground = "#d3869b";};
executable= {foreground= "#b8bb26";}; executable = {foreground = "#b8bb26";};
mount_point= {foreground= "#fe8019";}; mount_point = {foreground = "#fe8019";};
}; };
perms = { perms = {
user_read= {foreground= "#ebdbb2";}; user_read = {foreground = "#ebdbb2";};
user_write= {foreground= "#fabd2f";}; user_write = {foreground = "#fabd2f";};
user_execute_file= {foreground= "#b8bb26";}; user_execute_file = {foreground = "#b8bb26";};
user_execute_other= {foreground= "#b8bb26";}; user_execute_other = {foreground = "#b8bb26";};
group_read= {foreground= "#ebdbb2";}; group_read = {foreground = "#ebdbb2";};
group_write= {foreground= "#fabd2f";}; group_write = {foreground = "#fabd2f";};
group_execute= {foreground= "#b8bb26";}; group_execute = {foreground = "#b8bb26";};
other_read= {foreground= "#bdae93";}; other_read = {foreground = "#bdae93";};
other_write= {foreground= "#fabd2f";}; other_write = {foreground = "#fabd2f";};
other_execute= {foreground= "#b8bb26";}; other_execute = {foreground = "#b8bb26";};
special_user_file= {foreground= "#d3869b";}; special_user_file = {foreground = "#d3869b";};
special_other= {foreground= "#928374";}; special_other = {foreground = "#928374";};
attribute= {foreground= "#bdae93";}; attribute = {foreground = "#bdae93";};
}; };
size= { size = {
major= {foreground= "#bdae93";}; major = {foreground = "#bdae93";};
minor= {foreground= "#8ec07c";}; minor = {foreground = "#8ec07c";};
number_byte= {foreground= "#ebdbb2";}; number_byte = {foreground = "#ebdbb2";};
number_kilo= {foreground= "#ebdbb2";}; number_kilo = {foreground = "#ebdbb2";};
number_mega= {foreground= "#83a598";}; number_mega = {foreground = "#83a598";};
number_giga= {foreground= "#d3869b";}; number_giga = {foreground = "#d3869b";};
number_huge= {foreground= "#d3869b";}; number_huge = {foreground = "#d3869b";};
unit_byte= {foreground= "#bdae93";}; unit_byte = {foreground = "#bdae93";};
unit_kilo= {foreground= "#83a598";}; unit_kilo = {foreground = "#83a598";};
unit_mega= {foreground= "#d3869b";}; unit_mega = {foreground = "#d3869b";};
unit_giga= {foreground= "#d3869b";}; unit_giga = {foreground = "#d3869b";};
unit_huge= {foreground= "#fe8019";}; unit_huge = {foreground = "#fe8019";};
}; };
users= { users = {
user_you= {foreground= "#ebdbb2";}; user_you = {foreground = "#ebdbb2";};
user_root= {foreground= "#fb4934";}; user_root = {foreground = "#fb4934";};
user_other= {foreground= "#d3869b";}; user_other = {foreground = "#d3869b";};
group_yours= {foreground= "#ebdbb2";}; group_yours = {foreground = "#ebdbb2";};
group_other= {foreground= "#928374";}; group_other = {foreground = "#928374";};
group_root= {foreground= "#fb4934";}; group_root = {foreground = "#fb4934";};
}; };
links= { links = {
normal= {foreground= "#8ec07c";}; normal = {foreground = "#8ec07c";};
multi_link_file= {foreground= "#fe8019";}; multi_link_file = {foreground = "#fe8019";};
}; };
git= { git = {
new= {foreground= "#b8bb26";}; new = {foreground = "#b8bb26";};
modified= {foreground= "#fabd2f";}; modified = {foreground = "#fabd2f";};
deleted= {foreground= "#fb4934";}; deleted = {foreground = "#fb4934";};
renamed= {foreground= "#8ec07c";}; renamed = {foreground = "#8ec07c";};
typechange= {foreground= "#d3869b";}; typechange = {foreground = "#d3869b";};
ignored= {foreground= "#928374";}; ignored = {foreground = "#928374";};
conflicted= {foreground= "#cc241d";}; conflicted = {foreground = "#cc241d";};
}; };
git_repo= { git_repo = {
branch_main= {foreground= "#ebdbb2";}; branch_main = {foreground = "#ebdbb2";};
branch_other= {foreground= "#d3869b";}; branch_other = {foreground = "#d3869b";};
git_clean= {foreground= "#b8bb26";}; git_clean = {foreground = "#b8bb26";};
git_dirty= {foreground= "#fb4934";}; git_dirty = {foreground = "#fb4934";};
}; };
security_context= { security_context = {
colon= {foreground= "#928374";}; colon = {foreground = "#928374";};
user= {foreground= "#ebdbb2";}; user = {foreground = "#ebdbb2";};
role= {foreground= "#d3869b";}; role = {foreground = "#d3869b";};
typ= {foreground= "#665c54";}; typ = {foreground = "#665c54";};
range= {foreground= "#d3869b";}; range = {foreground = "#d3869b";};
}; };
file_type= { file_type = {
image= {foreground= "#fabd2f";}; image = {foreground = "#fabd2f";};
video= {foreground= "#fb4934";}; video = {foreground = "#fb4934";};
music= {foreground= "#b8bb26";}; music = {foreground = "#b8bb26";};
lossless= {foreground= "#8ec07c";}; lossless = {foreground = "#8ec07c";};
crypto= {foreground= "#928374";}; crypto = {foreground = "#928374";};
document= {foreground= "#ebdbb2";}; document = {foreground = "#ebdbb2";};
compressed= {foreground= "#d3869b";}; compressed = {foreground = "#d3869b";};
temp= {foreground= "#cc241d";}; temp = {foreground = "#cc241d";};
compiled= {foreground= "#83a598";}; compiled = {foreground = "#83a598";};
build= {foreground= "#928374";}; build = {foreground = "#928374";};
source= {foreground= "#83a598";}; source = {foreground = "#83a598";};
punctuation= {foreground= "#928374";}; punctuation = {foreground = "#928374";};
date= {foreground= "#fabd2f";}; date = {foreground = "#fabd2f";};
inode= {foreground= "#bdae93";}; inode = {foreground = "#bdae93";};
blocks= {foreground= "#a89984";}; blocks = {foreground = "#a89984";};
header= {foreground= "#ebdbb2";}; header = {foreground = "#ebdbb2";};
octal= {foreground= "#8ec07c";}; octal = {foreground = "#8ec07c";};
flags= {foreground= "#d3869b";}; flags = {foreground = "#d3869b";};
symlink_path= {foreground= "#8ec07c";}; symlink_path = {foreground = "#8ec07c";};
control_char= {foreground= "#83a598";}; control_char = {foreground = "#83a598";};
broken_symlink= {foreground= "#fb4934";}; broken_symlink = {foreground = "#fb4934";};
broken_path_overlay= {foreground= "#928374";}; broken_path_overlay = {foreground = "#928374";};
}; };
}; };
}; };
+8 -4
View File
@@ -149,13 +149,15 @@ in {
"Ctrl+Alt, 7, exec, caelestia shell gameMode toggle" "Ctrl+Alt, 7, exec, caelestia shell gameMode toggle"
# reloads the autostart programs # pos 3 1 # reloads the autostart programs # pos 3 1
# we passed to caelestia-shell and stoped using that # we passed to caelestia-shell and stoped using that
/*"Ctrl+$mod, 4, exec, sleep 1 && kitty -o font_size=16 -e sh -c 'custom-weather'" /*
"Ctrl+$mod, 4, exec, sleep 1 && kitty -o font_size=16 -e sh -c 'custom-weather'"
"Ctrl+$mod, 4, exec, sleep 1 && kitty -o font_size=11 -e sh -c 'custom-cowsay'" "Ctrl+$mod, 4, exec, sleep 1 && kitty -o font_size=11 -e sh -c 'custom-cowsay'"
"Ctrl+$mod, 4, exec, kitty -e 'custom-launch'" "Ctrl+$mod, 4, exec, kitty -e 'custom-launch'"
"Ctrl+$mod, 4, exec, sleep 1 && kitty -o font_size=5 -e btm --theme gruvbox --disable-click --disable_advanced_kill --enable_cache_memory -g -R -T " "Ctrl+$mod, 4, exec, sleep 1 && kitty -o font_size=5 -e btm --theme gruvbox --disable-click --disable_advanced_kill --enable_cache_memory -g -R -T "
"Ctrl+$mod, 4, exec, sleep 1 && kitty -o font_size=1 -e sh -c 'cmatrix -br'" "Ctrl+$mod, 4, exec, sleep 1 && kitty -o font_size=1 -e sh -c 'cmatrix -br'"
#"Ctrl+Alt, 1, exec, swaync-client -t" # pos 4 1 notification center #"Ctrl+Alt, 1, exec, swaync-client -t" # pos 4 1 notification center
"Ctrl+Alt, 1, exec, qs ipc call notifications toggle" */ "Ctrl+Alt, 1, exec, qs ipc call notifications toggle"
*/
"Ctrl+Alt, 1, exec, caelestia shell drawers toggle sidebar" "Ctrl+Alt, 1, exec, caelestia shell drawers toggle sidebar"
"Ctrl+$mod, 4, exec, caelestia shell notifs toggleDnd" "Ctrl+$mod, 4, exec, caelestia shell notifs toggleDnd"
"Ctrl+$mod, 3, exec, pavucontrol" # pos 1 2 audiocontrol "Ctrl+$mod, 3, exec, pavucontrol" # pos 1 2 audiocontrol
@@ -220,7 +222,8 @@ in {
#"custom-obsidianbackup" # backups the obsidian notes to kdrive and to a timed hidden dir (~/.Notes.backup/) #"custom-obsidianbackup" # backups the obsidian notes to kdrive and to a timed hidden dir (~/.Notes.backup/)
#"QS-notifycache" # builds the cache that will be used for the notification history #"QS-notifycache" # builds the cache that will be used for the notification history
"sleep 2 & caelestia-shell" #works better if it sleeps a bit before "sleep 2 & caelestia-shell" #works better if it sleeps a bit before
/* We stopped using that ######################### maybe we should desactivate those scripts /*
We stopped using that ######################### maybe we should desactivate those scripts
# login autostart # login autostart
####################### #######################
"[workspace 1 silent] sleep 1 && kitty -o font_size=16 -e sh -c 'custom-weather'" "[workspace 1 silent] sleep 1 && kitty -o font_size=16 -e sh -c 'custom-weather'"
@@ -229,7 +232,8 @@ in {
"[workspace 1 silent] sleep 1 && kitty -o font_size=5 -e btm --theme gruvbox --disable-click --disable_advanced_kill --enable_cache_memory -g -R -T " "[workspace 1 silent] sleep 1 && kitty -o font_size=5 -e btm --theme gruvbox --disable-click --disable_advanced_kill --enable_cache_memory -g -R -T "
"[workspace 1 silent] sleep 1 && kitty -o font_size=1 -e sh -c 'cmatrix -br'" "[workspace 1 silent] sleep 1 && kitty -o font_size=1 -e sh -c 'cmatrix -br'"
###################### ######################
######################*/ ######################
*/
]; ];
# gestures (also keybindings) # gestures (also keybindings)
+44 -42
View File
@@ -11,61 +11,62 @@
## old condfig ## old condfig
extraConfig = '' extraConfig = ''
font_size 14 font_size 14
bold_font auto bold_font auto
italic_font auto italic_font auto
bold_italic_font auto bold_italic_font auto
window_padding_width 25 window_padding_width 25
# --- Core --- # --- Core ---
foreground #ece0d9 foreground #ece0d9
background #18120e background #18120e
selection_foreground #18120e selection_foreground #18120e
selection_background #ece0d9 selection_background #ece0d9
cursor #ffb878 cursor #ffb878
cursor_text_color #18120e cursor_text_color #18120e
# --- Tabs --- # --- Tabs ---
active_tab_foreground #18120e active_tab_foreground #18120e
active_tab_background #5c412a active_tab_background #5c412a
inactive_tab_foreground #d6c3b5 inactive_tab_foreground #d6c3b5
inactive_tab_background #241e1a inactive_tab_background #241e1a
# --- Black / Gray --- # --- Black / Gray ---
color0 #353433 color0 #353433
color8 #b29f91 color8 #b29f91
# --- Red --- # --- Red ---
color1 #e17300 color1 #e17300
color9 #ff8a20 color9 #ff8a20
# --- Green --- # --- Green ---
color2 #ffc071 color2 #ffc071
color10 #ffd6a8 color10 #ffd6a8
# --- Yellow --- # --- Yellow ---
color3 #ffe0c6 color3 #ffe0c6
color11 #fff2e8 color11 #fff2e8
# --- Blue --- # --- Blue ---
color4 #b9ab66 color4 #b9ab66
color12 #d7be91 color12 #d7be91
# --- Magenta --- # --- Magenta ---
color5 #ed9562 color5 #ed9562
color13 #fcad7e color13 #fcad7e
# --- Cyan --- # --- Cyan ---
color6 #f4c16d color6 #f4c16d
color14 #ffd497 color14 #ffd497
# --- White --- # --- White ---
color7 #ebd4c1 color7 #ebd4c1
color15 #FFFFFF color15 #FFFFFF
''; '';
/*extraConfig = '' /*
extraConfig = ''
# font nerd-fonts._0xproto # this key dont work and causes errors # font nerd-fonts._0xproto # this key dont work and causes errors
font_size 14 font_size 14
bold_font auto bold_font auto
@@ -118,6 +119,7 @@ color15 #FFFFFF
# white # white
color7 #FFF0CC color7 #FFF0CC
color15 #F0DBAA color15 #F0DBAA
'';*/ '';
*/
}; };
} }
+33 -34
View File
@@ -4,7 +4,6 @@
pkgs-unstable, pkgs-unstable,
... ...
}: { }: {
programs.neovim = { programs.neovim = {
enable = true; enable = true;
vimAlias = false; vimAlias = false;
@@ -79,28 +78,28 @@
vim.g.maplocalleader = ' ' vim.g.maplocalleader = ' '
vim.keymap.set({'n', 'v'}, '<Space>', '<Nop>', { desc = 'Leader key, disable default behavior' }) vim.keymap.set({'n', 'v'}, '<Space>', '<Nop>', { desc = 'Leader key, disable default behavior' })
vim.keymap.set('n', 'q', '<Nop>', { desc = 'Disable macro recording' }) vim.keymap.set('n', 'q', '<Nop>', { desc = 'Disable macro recording' })
vim.keymap.set('n', 'gg', '<Nop>', { desc = 'Disable g motion' }) vim.keymap.set('n', 'gg', '<Nop>', { desc = 'Disable g motion' })
vim.keymap.set('n', 'gG', '<Nop>', { desc = 'Disable g motion' }) vim.keymap.set('n', 'gG', '<Nop>', { desc = 'Disable g motion' })
vim.keymap.set('n', 'g0', '<Nop>', { desc = 'Disable g motion' }) vim.keymap.set('n', 'g0', '<Nop>', { desc = 'Disable g motion' })
vim.keymap.set('n', 'g^', '<Nop>', { desc = 'Disable g motion' }) vim.keymap.set('n', 'g^', '<Nop>', { desc = 'Disable g motion' })
vim.keymap.set('n', 'g$', '<Nop>', { desc = 'Disable g motion' }) vim.keymap.set('n', 'g$', '<Nop>', { desc = 'Disable g motion' })
vim.keymap.set('n', 'gj', '<Nop>', { desc = 'Disable g motion' }) vim.keymap.set('n', 'gj', '<Nop>', { desc = 'Disable g motion' })
vim.keymap.set('n', 'gk', '<Nop>', { desc = 'Disable g motion' }) vim.keymap.set('n', 'gk', '<Nop>', { desc = 'Disable g motion' })
vim.keymap.set('n', 'g~', '<Nop>', { desc = 'Disable g motion' }) vim.keymap.set('n', 'g~', '<Nop>', { desc = 'Disable g motion' })
vim.keymap.set('n', 'gu', '<Nop>', { desc = 'Disable g motion' }) vim.keymap.set('n', 'gu', '<Nop>', { desc = 'Disable g motion' })
vim.keymap.set('n', 'gU', '<Nop>', { desc = 'Disable g motion' }) vim.keymap.set('n', 'gU', '<Nop>', { desc = 'Disable g motion' })
vim.keymap.set('n', 'g=', '<Nop>', { desc = 'Disable g motion' }) vim.keymap.set('n', 'g=', '<Nop>', { desc = 'Disable g motion' })
vim.keymap.set('n', 'gq', '<Nop>', { desc = 'Disable g motion' }) vim.keymap.set('n', 'gq', '<Nop>', { desc = 'Disable g motion' })
vim.keymap.set('n', 'g@', '<Nop>', { desc = 'Disable g motion' }) vim.keymap.set('n', 'g@', '<Nop>', { desc = 'Disable g motion' })
vim.keymap.set('n', 'g?', '<Nop>', { desc = 'Disable g motion' }) vim.keymap.set('n', 'g?', '<Nop>', { desc = 'Disable g motion' })
vim.keymap.set('n', 'gC', '<Nop>', { desc = 'Disable g motion' }) vim.keymap.set('n', 'gC', '<Nop>', { desc = 'Disable g motion' })
vim.keymap.set('n', 'gD', '<Nop>', { desc = 'Disable g motion' }) vim.keymap.set('n', 'gD', '<Nop>', { desc = 'Disable g motion' })
vim.keymap.set('n', 'gx', '<Nop>', { desc = 'Disable g motion' }) vim.keymap.set('n', 'gx', '<Nop>', { desc = 'Disable g motion' })
vim.keymap.set('n', 'gr', '<Nop>', { desc = 'Disable g motion' }) vim.keymap.set('n', 'gr', '<Nop>', { desc = 'Disable g motion' })
vim.keymap.set('n', 'g[', '<Nop>', { desc = 'Disable g motion' }) vim.keymap.set('n', 'g[', '<Nop>', { desc = 'Disable g motion' })
vim.keymap.set('n', 'g]', '<Nop>', { desc = 'Disable g motion' }) vim.keymap.set('n', 'g]', '<Nop>', { desc = 'Disable g motion' })
vim.keymap.set('n', 'g;', '<Nop>', { desc = 'Disable g motion' }) vim.keymap.set('n', 'g;', '<Nop>', { desc = 'Disable g motion' })
vim.keymap.set('n', 'g,', '<Nop>', { desc = 'Disable g motion' }) vim.keymap.set('n', 'g,', '<Nop>', { desc = 'Disable g motion' })
-- ========================= -- =========================
-- GENERAL OPTIONS -- GENERAL OPTIONS
-- ========================= -- =========================
@@ -212,7 +211,7 @@ vim.keymap.set('n', 'g,', '<Nop>', { desc = 'Disable g motion' })
additional_vim_regex_highlighting = false, additional_vim_regex_highlighting = false,
}, },
indent = { enable = true }, indent = { enable = true },
}) })
-- ========================= -- =========================
-- NVIM-TREE -- NVIM-TREE
-- ========================= -- =========================
@@ -244,10 +243,10 @@ vim.keymap.set('n', 'g,', '<Nop>', { desc = 'Disable g motion' })
cmp.setup.cmdline({ '/', '?' }, { mapping = cmp.mapping.preset.cmdline(), sources = { { name = 'buffer' } } }) cmp.setup.cmdline({ '/', '?' }, { mapping = cmp.mapping.preset.cmdline(), sources = { { name = 'buffer' } } })
cmp.setup.cmdline(':', { mapping = cmp.mapping.preset.cmdline(), sources = cmp.config.sources({ { name = 'path' } }, { { name = 'cmdline' } }), matching = { disallow_symbol_nonprefix_matching = false } }) cmp.setup.cmdline(':', { mapping = cmp.mapping.preset.cmdline(), sources = cmp.config.sources({ { name = 'path' } }, { { name = 'cmdline' } }), matching = { disallow_symbol_nonprefix_matching = false } })
-- ========================= -- =========================
-- LSP CONFIGURATION -- LSP CONFIGURATION
-- ========================= -- =========================
local capabilities = require('cmp_nvim_lsp').default_capabilities() local capabilities = require('cmp_nvim_lsp').default_capabilities()
-- Diagnostics -- Diagnostics
vim.keymap.set("n", "<leader>e1", function() vim.diagnostic.jump({ prev=true, count = 1 }) end, { desc = "Previous diagnostic" }) vim.keymap.set("n", "<leader>e1", function() vim.diagnostic.jump({ prev=true, count = 1 }) end, { desc = "Previous diagnostic" })
@@ -281,8 +280,8 @@ local capabilities = require('cmp_nvim_lsp').default_capabilities()
vim.keymap.set("n", "<leader>g4", vim.lsp.buf.implementation, { desc = "Go to implementation" }) vim.keymap.set("n", "<leader>g4", vim.lsp.buf.implementation, { desc = "Go to implementation" })
vim.keymap.set("n", "<leader>g5", vim.lsp.buf.references, { desc = "Show references" }) vim.keymap.set("n", "<leader>g5", vim.lsp.buf.references, { desc = "Show references" })
-- LSP server setup -- LSP server setup
vim.lsp.config("lua_ls", { cmd = { "lua-language-server" }, filetypes = { "lua" }, root_dir = vim.fs.dirname, on_attach = on_attach }) vim.lsp.config("lua_ls", { cmd = { "lua-language-server" }, filetypes = { "lua" }, root_dir = vim.fs.dirname, on_attach = on_attach })
vim.lsp.config("clangd", { vim.lsp.config("clangd", {
cmd = { "clangd" }, cmd = { "clangd" },
filetypes = { "c","cpp","objc","objcpp" }, filetypes = { "c","cpp","objc","objcpp" },
@@ -298,7 +297,7 @@ vim.lsp.config("lua_ls", { cmd = { "lua-language-server" }, filetypes = { "lua"
filetyypes = { "nix" }, filetyypes = { "nix" },
on_attach = on_attach, on_attach = on_attach,
}) })
vim.lsp.config("pylsp", { vim.lsp.config("pylsp", {
cmd = { "pylsp" }, cmd = { "pylsp" },
filetypes = { "python" }, filetypes = { "python" },
on_attach = on_attach, on_attach = on_attach,
@@ -310,10 +309,10 @@ vim.lsp.config("pylsp", {
} }
} }
} }
}) })
vim.lsp.config("texlab", { cmd = { "texlab" }, filetypes = { "tex" }, on_attach = on_attach }) vim.lsp.config("texlab", { cmd = { "texlab" }, filetypes = { "tex" }, on_attach = on_attach })
vim.lsp.enable({ "lua_ls", "clangd", "pylsp", "texlab", "nixd"}) vim.lsp.enable({ "lua_ls", "clangd", "pylsp", "texlab", "nixd"})
-- ========================= -- =========================
-- DASHBOARD -- DASHBOARD
-- ========================= -- =========================
+12 -4
View File
@@ -1,12 +1,20 @@
{ config, pkgs, ... }:
{ {
config,
pkgs,
...
}: {
programs.obsidian = { programs.obsidian = {
enable = true; enable = true;
vaults = { vaults = {
miscellanious = { enable = true; target = "/Documents/Notes/miscellanious"; }; miscellanious = {
work = { enable = true; target = "/Documents/Notes/work"; }; enable = true;
target = "/Documents/Notes/miscellanious";
};
work = {
enable = true;
target = "/Documents/Notes/work";
};
}; };
defaultSettings = { defaultSettings = {
+3 -4
View File
@@ -1,17 +1,16 @@
# pulled from https://codeberg.org/zacoons/rivendell-hyprdots # pulled from https://codeberg.org/zacoons/rivendell-hyprdots
{ {
config, config,
pkgs, pkgs,
... ...
}: { }: {
qt.enable =true; qt.enable = true;
programs.quickshell = { programs.quickshell = {
systemd.enable = true; systemd.enable = true;
enable = true; enable = true;
}; };
home.file.".config/quickshell" = { home.file.".config/quickshell" = {
source = ../../other/quickshell; source = ../../other/quickshell;
recursive = true; recursive = true;
}; };
} }
+33 -33
View File
@@ -3,13 +3,13 @@
# https://chatgpt.com/c/69da11b3-ba24-8331-b7b0-a58a72e69d42 # https://chatgpt.com/c/69da11b3-ba24-8331-b7b0-a58a72e69d42
# at your risk and perils # at your risk and perils
# click on the icon to get a notification with state, percentage and wattage # click on the icon to get a notification with state, percentage and wattage
{ lib {
, stdenv lib,
, qt6 stdenv,
, pkg-config qt6,
, pkgs pkg-config,
pkgs,
}: }:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "qtbatticon"; pname = "qtbatticon";
version = "1.0"; version = "1.0";
@@ -17,43 +17,43 @@ stdenv.mkDerivation {
src = pkgs.writeTextFile { src = pkgs.writeTextFile {
name = "qtbatticon.cpp"; name = "qtbatticon.cpp";
text = '' text = ''
#include <QApplication> #include <QApplication>
#include <QSystemTrayIcon> #include <QSystemTrayIcon>
#include <QTimer> #include <QTimer>
#include <QFile> #include <QFile>
#include <QTextStream> #include <QTextStream>
#include <QIcon> #include <QIcon>
#include <QString> #include <QString>
#include <QDebug> #include <QDebug>
#include <cstdlib> #include <cstdlib>
QString readFile(const QString &path) { QString readFile(const QString &path) {
QFile f(path); QFile f(path);
if (!f.open(QIODevice::ReadOnly)) return ""; if (!f.open(QIODevice::ReadOnly)) return "";
QTextStream in(&f); QTextStream in(&f);
return in.readAll().trimmed(); return in.readAll().trimmed();
} }
int readInt(const QString &path) { int readInt(const QString &path) {
return readFile(path).toInt(); return readFile(path).toInt();
} }
double readDouble(const QString &path) { double readDouble(const QString &path) {
QFile f(path); QFile f(path);
if (!f.open(QIODevice::ReadOnly)) return 0; if (!f.open(QIODevice::ReadOnly)) return 0;
QTextStream in(&f); QTextStream in(&f);
return in.readAll().trimmed().toDouble(); return in.readAll().trimmed().toDouble();
} }
int toStep(int capacity) { int toStep(int capacity) {
return (capacity / 10) * 10; return (capacity / 10) * 10;
} }
QString pad3(int n) { QString pad3(int n) {
return QString("%1").arg(n, 3, 10, QChar('0')); return QString("%1").arg(n, 3, 10, QChar('0'));
} }
double getPowerW(const QString &batPath) { double getPowerW(const QString &batPath) {
double current_uA = readDouble(batPath + "/current_now"); double current_uA = readDouble(batPath + "/current_now");
double voltage_uV = readDouble(batPath + "/voltage_now"); double voltage_uV = readDouble(batPath + "/voltage_now");
@@ -61,9 +61,9 @@ double getPowerW(const QString &batPath) {
return (current_uA * voltage_uV) / 1e12; return (current_uA * voltage_uV) / 1e12;
} }
return -1; return -1;
} }
QIcon batteryIcon(int capacity, bool charging) { QIcon batteryIcon(int capacity, bool charging) {
int step = toStep(capacity); int step = toStep(capacity);
QString num = pad3(step); QString num = pad3(step);
@@ -84,14 +84,14 @@ QIcon batteryIcon(int capacity, bool charging) {
} }
return icon; return icon;
} }
void sendNotification(const QString &title, const QString &body) { void sendNotification(const QString &title, const QString &body) {
QString cmd = "notify-send \"" + title + "\" \"" + body + "\""; QString cmd = "notify-send \"" + title + "\" \"" + body + "\"";
system(cmd.toUtf8().constData()); system(cmd.toUtf8().constData());
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
QApplication app(argc, argv); QApplication app(argc, argv);
QString batPath = "/sys/class/power_supply/BAT1"; QString batPath = "/sys/class/power_supply/BAT1";
@@ -147,7 +147,7 @@ int main(int argc, char *argv[]) {
timer.start(5000); timer.start(5000);
return app.exec(); return app.exec();
} }
''; '';
}; };
+6 -9
View File
@@ -1,17 +1,14 @@
# creates and maintains cache file for the notification history # creates and maintains cache file for the notification history
{ {writeShellApplication, ...}:
writeShellApplication,
...
}:
writeShellApplication { writeShellApplication {
name = "QS-notifycache"; name = "QS-notifycache";
runtimeInputs = [ runtimeInputs = [
]; ];
text = '' text = ''
CACHE="$HOME/.cache/notify_history" CACHE="$HOME/.cache/notify_history"
# Create or erase existing cache # Create or erase existing cache
mkdir -p "$(dirname "$CACHE")" mkdir -p "$(dirname "$CACHE")"
: > "$CACHE" # truncate file : > "$CACHE" # truncate file
echo "Notification history initialized at $(date)" >> "$CACHE" echo "Notification history initialized at $(date)" >> "$CACHE"
''; '';
} }
+1 -4
View File
@@ -1,7 +1,4 @@
{ {writeShellApplication, ...}:
writeShellApplication,
...
}:
writeShellApplication { writeShellApplication {
name = "QS-notifyhistory"; name = "QS-notifyhistory";
runtimeInputs = [ runtimeInputs = [
+45 -45
View File
@@ -1,80 +1,80 @@
{ {
writeShellApplication, writeShellApplication,
ripgrep, ripgrep,
gawkInteractive, gawkInteractive,
iproute2, iproute2,
coreutils, coreutils,
procps, procps,
upower, upower,
... ...
}: }:
writeShellApplication { writeShellApplication {
name = "QS-sysinfo"; name = "QS-sysinfo";
runtimeInputs = [ runtimeInputs = [
ripgrep ripgrep
gawkInteractive gawkInteractive
iproute2 iproute2
coreutils coreutils
procps procps
upower upower
]; ];
text = '' text = ''
# Pad CPU, MEM, DISK to 2 chars (right-aligned) # Pad CPU, MEM, DISK to 2 chars (right-aligned)
cpu=$(awk '/^cpu /{printf("%.0f", ($2+$4)*100/($2+$4+$5))}' /proc/stat) cpu=$(awk '/^cpu /{printf("%.0f", ($2+$4)*100/($2+$4+$5))}' /proc/stat)
cpu=$(printf "%2s" "$cpu") cpu=$(printf "%2s" "$cpu")
sum=0 sum=0
count=0 count=0
for f in /sys/class/hwmon/hwmon*/temp*_input; do for f in /sys/class/hwmon/hwmon*/temp*_input; do
if [ -r "$f" ]; then if [ -r "$f" ]; then
val=$(cat "$f" 2>/dev/null) || continue val=$(cat "$f" 2>/dev/null) || continue
sum=$((sum + val)) sum=$((sum + val))
count=$((count + 1)) count=$((count + 1))
fi fi
done done
temp=$(( sum / count / 1000 )) temp=$(( sum / count / 1000 ))
sum=0 sum=0
count=0 count=0
for f in /sys/class/hwmon/hwmon*/fan*_input; do for f in /sys/class/hwmon/hwmon*/fan*_input; do
if [ -r "$f" ]; then if [ -r "$f" ]; then
val=$(cat "$f" 2>/dev/null) || continue val=$(cat "$f" 2>/dev/null) || continue
sum=$((sum + val)) sum=$((sum + val))
count=$((count + 1)) count=$((count + 1))
fi fi
done done
fan=$(( sum / count )) fan=$(( sum / count ))
fan=$(printf "%4s" "$fan") fan=$(printf "%4s" "$fan")
mem=$(free | awk '/Mem:/ {printf("%.0f",$3/$2*100)}') mem=$(free | awk '/Mem:/ {printf("%.0f",$3/$2*100)}')
mem=$(printf "%2s" "$mem") mem=$(printf "%2s" "$mem")
disk=$(df / | awk 'NR==2 {gsub("%",""); print $5}') disk=$(df / | awk 'NR==2 {gsub("%",""); print $5}')
disk=$(printf "%2s" "$disk") disk=$(printf "%2s" "$disk")
# Pad POWER to 5 chars (XX.XX) # Pad POWER to 5 chars (XX.XX)
power=$(upower -b | awk -F: '/energy-rate/ {gsub(/^[ \t]+/, "", $2); split($2,a," "); printf("%.2f", a[1])}') power=$(upower -b | awk -F: '/energy-rate/ {gsub(/^[ \t]+/, "", $2); split($2,a," "); printf("%.2f", a[1])}')
power=$(printf "%5s" "$power") power=$(printf "%5s" "$power")
# network calculations # network calculations
iface=$(ip route get 1.1.1.1 | awk '{print $5; exit}') iface=$(ip route get 1.1.1.1 | awk '{print $5; exit}')
rx1=$(cat "/sys/class/net/$iface/statistics/rx_bytes") rx1=$(cat "/sys/class/net/$iface/statistics/rx_bytes")
tx1=$(cat "/sys/class/net/$iface/statistics/tx_bytes") tx1=$(cat "/sys/class/net/$iface/statistics/tx_bytes")
sleep 1 sleep 1
rx2=$(cat "/sys/class/net/$iface/statistics/rx_bytes") rx2=$(cat "/sys/class/net/$iface/statistics/rx_bytes")
tx2=$(cat "/sys/class/net/$iface/statistics/tx_bytes") tx2=$(cat "/sys/class/net/$iface/statistics/tx_bytes")
down_speed=$(( (rx2 - rx1) / 1024 )) down_speed=$(( (rx2 - rx1) / 1024 ))
up_speed=$(( (tx2 - tx1) / 1024 )) up_speed=$(( (tx2 - tx1) / 1024 ))
# Output JSON # Output JSON
echo "{\"cpu\":\"$cpu\",\"temp\":\"$temp\",\"fan\":\"$fan\",\"mem\":\"$mem\",\"disk\":\"$disk\",\"power\":\"$power\",\"down\":\"$down_speed\",\"up\":\"$up_speed\"}" echo "{\"cpu\":\"$cpu\",\"temp\":\"$temp\",\"fan\":\"$fan\",\"mem\":\"$mem\",\"disk\":\"$disk\",\"power\":\"$power\",\"down\":\"$down_speed\",\"up\":\"$up_speed\"}"
''; '';
} }
+7 -7
View File
@@ -1,13 +1,13 @@
# taken and adapted https://github.com/miniMinn24/Battery_Notify with MIT License # taken and adapted https://github.com/miniMinn24/Battery_Notify with MIT License
{ {
writeShellApplication, writeShellApplication,
mplayer, mplayer,
brightnessctl, brightnessctl,
... ...
}: let }: let
NotifySound = ../../assets/battery_notify.mp3; NotifySound = ../../assets/battery_notify.mp3;
in in
writeShellApplication { writeShellApplication {
name = "custom-batterywarning"; name = "custom-batterywarning";
runtimeInputs = [ runtimeInputs = [
mplayer mplayer
@@ -45,4 +45,4 @@ writeShellApplication {
fi fi
done done
''; '';
} }
-1
View File
@@ -5,7 +5,6 @@
rsync, rsync,
... ...
}: }:
writeShellApplication { writeShellApplication {
name = "custom-obsidianbackup"; name = "custom-obsidianbackup";
runtimeInputs = [ runtimeInputs = [
-1
View File
@@ -5,7 +5,6 @@
ripgrep, ripgrep,
... ...
}: }:
writeShellApplication { writeShellApplication {
name = "custom-obsidianvaults"; name = "custom-obsidianvaults";
runtimeInputs = [ runtimeInputs = [
+57 -57
View File
@@ -10,25 +10,25 @@ writeShellApplication {
nix nix
]; ];
text = '' text = ''
set -euo pipefail set -euo pipefail
## Defaults ## Defaults
keepGensDef=30; keepDaysDef=7 keepGensDef=30; keepDaysDef=7
keepGens=$keepGensDef; keepDays=$keepDaysDef keepGens=$keepGensDef; keepDays=$keepDaysDef
## Usage ## Usage
usage () { usage () {
printf "Usage:\n\t ./trim-generations.sh <keep-generations> <keep-days> <profile> \n\n printf "Usage:\n\t ./trim-generations.sh <keep-generations> <keep-days> <profile> \n\n
(defaults are: Keep-Gens=%d Keep-Days=%d Profile=user)\n\n" "$keepGensDef" "$keepDaysDef" (defaults are: Keep-Gens=%d Keep-Days=%d Profile=user)\n\n" "$keepGensDef" "$keepDaysDef"
printf "If you enter any parameters, you must enter all three, or none to use defaults.\n" printf "If you enter any parameters, you must enter all three, or none to use defaults.\n"
printf "Example:\n\t trim-generations.sh 15 10 home-manager\n" printf "Example:\n\t trim-generations.sh 15 10 home-manager\n"
printf " this will work on the home-manager profile and keep all generations from the\n" printf " this will work on the home-manager profile and keep all generations from the\n"
printf "last 10 days, and keep at least 15 generations no matter how old.\n" printf "last 10 days, and keep at least 15 generations no matter how old.\n"
printf "\nProfiles available are:\tuser, home-manager, channels, system (root)\n" printf "\nProfiles available are:\tuser, home-manager, channels, system (root)\n"
printf "\n-h or --help prints this help text." printf "\n-h or --help prints this help text."
} }
if [ $# -eq 1 ]; then # if help requested if [ $# -eq 1 ]; then # if help requested
if [ "$1" = "-h" ]; then if [ "$1" = "-h" ]; then
usage usage
exit 1; exit 1;
@@ -56,12 +56,12 @@ if [ $# -eq 1 ]; then # if help requested
exit 7; exit 7;
;; ;;
esac esac
fi fi
## Handle parameters (and change if root) ## Handle parameters (and change if root)
if [[ $EUID -ne 0 ]]; then # if not root if [[ $EUID -ne 0 ]]; then # if not root
profile=$(readlink /home/"$USER"/.nix-profile) profile=$(readlink /home/"$USER"/.nix-profile)
else else
if [ -d /nix/var/nix/profiles/system ]; then # maybe this or the other if [ -d /nix/var/nix/profiles/system ]; then # maybe this or the other
profile="/nix/var/nix/profiles/system" profile="/nix/var/nix/profiles/system"
elif [ -d /nix/var/nix/profiles/default ]; then elif [ -d /nix/var/nix/profiles/default ]; then
@@ -70,18 +70,18 @@ else
echo "Cant find profile for root. Exiting" echo "Cant find profile for root. Exiting"
exit 8 exit 8
fi fi
fi fi
if (( $# < 1 )); then if (( $# < 1 )); then
printf "Keeping default: %d generations OR %d days, whichever is more\n" "$keepGensDef" "$keepDaysDef" printf "Keeping default: %d generations OR %d days, whichever is more\n" "$keepGensDef" "$keepDaysDef"
elif [[ $# -le 2 ]]; then elif [[ $# -le 2 ]]; then
printf "\nError: Not enough arguments.\n\n" >&2 printf "\nError: Not enough arguments.\n\n" >&2
usage usage
exit 1 exit 1
elif (( $# > 4)); then elif (( $# > 4)); then
printf "\nError: Too many arguments.\n\n" >&2 printf "\nError: Too many arguments.\n\n" >&2
usage usage
exit 2 exit 2
else else
if [ "$1" -lt 1 ]; then if [ "$1" -lt 1 ]; then
printf "using Gen numbers less than 1 not recommended. Setting to min=1\n" printf "using Gen numbers less than 1 not recommended. Setting to min=1\n"
read -r -p "is that ok? (y/n): " answer read -r -p "is that ok? (y/n): " answer
@@ -151,12 +151,12 @@ else
printf "OK! \t Keep Gens = %s \t Keep Days = %s \n\n" "$keepGens" "$keepDays" printf "OK! \t Keep Gens = %s \t Keep Days = %s \n\n" "$keepGens" "$keepDays"
fi fi
printf "Operating on profile: %s \t \n\n" "$profile" printf "Operating on profile: %s \t \n\n" "$profile"
## Runs at the end, to decide whether to delete profiles that match chosen parameters. ## Runs at the end, to decide whether to delete profiles that match chosen parameters.
choose () { choose () {
local default="$1" local default="$1"
local prompt="$2" local prompt="$2"
local answer local answer
@@ -176,38 +176,38 @@ choose () {
exit 7; exit 7;
;; ;;
esac esac
} # end of function choose } # end of function choose
# printf "profile = %s \n\n" "$profile" # printf "profile = %s \n\n" "$profile"
## Query nix-env for generations list ## Query nix-env for generations list
#IFS=$'\n' nixGens=( $(nix-env --list-generations -p "$profile" | sed 's:^\s*::; s:\s*$::' | tr '\t' ' ' | tr -s ' ') ) #IFS=$'\n' nixGens=( $(nix-env --list-generations -p "$profile" | sed 's:^\s*::; s:\s*$::' | tr '\t' ' ' | tr -s ' ') )
# gave errors replaced by: # gave errors replaced by:
mapfile -t nixGens < <( mapfile -t nixGens < <(
nix-env --list-generations -p "$profile" | nix-env --list-generations -p "$profile" |
sed 's:^\s*::; s:\s*$::' | sed 's:^\s*::; s:\s*$::' |
tr '\t' ' ' | tr '\t' ' ' |
tr -s ' ' tr -s ' '
) )
timeNow=$(date +%s) timeNow=$(date +%s)
## Get info on oldest generation ## Get info on oldest generation
IFS=' ' read -r -a oldestGenArr <<< "''${nixGens[0]}" IFS=' ' read -r -a oldestGenArr <<< "''${nixGens[0]}"
oldestGen=''${oldestGenArr[0]} oldestGen=''${oldestGenArr[0]}
oldestDate=''${oldestGenArr[1]} oldestDate=''${oldestGenArr[1]}
printf "%-30s %s\n" "oldest generation:" "$oldestGen" printf "%-30s %s\n" "oldest generation:" "$oldestGen"
#oldestDate=''${nixGens[0]:3:19} #oldestDate=''${nixGens[0]:3:19}
printf "%-30s %s\n" "oldest generation created:" "$oldestDate" printf "%-30s %s\n" "oldest generation created:" "$oldestDate"
oldestTime=$(date -d "$oldestDate" +%s) oldestTime=$(date -d "$oldestDate" +%s)
oldestElapsedSecs=$((timeNow-oldestTime)) oldestElapsedSecs=$((timeNow-oldestTime))
oldestElapsedMins=$((oldestElapsedSecs/60)) oldestElapsedMins=$((oldestElapsedSecs/60))
oldestElapsedHours=$((oldestElapsedMins/60)) oldestElapsedHours=$((oldestElapsedMins/60))
oldestElapsedDays=$((oldestElapsedHours/24)) oldestElapsedDays=$((oldestElapsedHours/24))
printf "%-30s %s\n" "minutes before now:" "$oldestElapsedMins" printf "%-30s %s\n" "minutes before now:" "$oldestElapsedMins"
printf "%-30s %s\n" "hours before now:" "$oldestElapsedHours" printf "%-30s %s\n" "hours before now:" "$oldestElapsedHours"
printf "%-30s %s\n\n" "days before now:" "$oldestElapsedDays" printf "%-30s %s\n\n" "days before now:" "$oldestElapsedDays"
## Get info on current generation ## Get info on current generation
for i in "''${nixGens[@]}"; do for i in "''${nixGens[@]}"; do
IFS=' ' read -r -a iGenArr <<< "$i" IFS=' ' read -r -a iGenArr <<< "$i"
genNumber=''${iGenArr[0]} genNumber=''${iGenArr[0]}
genDate=''${iGenArr[1]} genDate=''${iGenArr[1]}
@@ -225,21 +225,21 @@ for i in "''${nixGens[@]}"; do
printf "%-30s %s\n" "hours before now:" "$currentElapsedHours" printf "%-30s %s\n" "hours before now:" "$currentElapsedHours"
printf "%-30s %s\n\n" "days before now:" "$currentElapsedDays" printf "%-30s %s\n\n" "days before now:" "$currentElapsedDays"
fi fi
done done
## Compare oldest and current generations ## Compare oldest and current generations
timeBetweenOldestAndCurrent=$((currentTime-oldestTime)) timeBetweenOldestAndCurrent=$((currentTime-oldestTime))
elapsedDays=$((timeBetweenOldestAndCurrent/60/60/24)) elapsedDays=$((timeBetweenOldestAndCurrent/60/60/24))
generationsDiff=$((currentGen-oldestGen)) generationsDiff=$((currentGen-oldestGen))
## Figure out what we should do, based on generations and options ## Figure out what we should do, based on generations and options
if [[ elapsedDays -le keepDays ]]; then if [[ elapsedDays -le keepDays ]]; then
printf "All generations are no more than %s days older than current generation. \nOldest gen days difference from current gen: %s \n\n\tNothing to do!\n" "$keepDays" "$elapsedDays" printf "All generations are no more than %s days older than current generation. \nOldest gen days difference from current gen: %s \n\n\tNothing to do!\n" "$keepDays" "$elapsedDays"
exit 4; exit 4;
elif [[ generationsDiff -lt keepGens ]]; then elif [[ generationsDiff -lt keepGens ]]; then
printf "Oldest generation (%d) is only %d generations behind current (%d). \n\n\t Nothing to do!\n" "$oldestGen" "$generationsDiff" "$currentGen" printf "Oldest generation (%d) is only %d generations behind current (%d). \n\n\t Nothing to do!\n" "$oldestGen" "$generationsDiff" "$currentGen"
exit 5; exit 5;
else else
printf "\tSomething to do...\n" printf "\tSomething to do...\n"
declare -a gens declare -a gens
for i in "''${nixGens[@]}"; do for i in "''${nixGens[@]}"; do
@@ -260,7 +260,7 @@ else
done done
printf "\n" printf "\n"
choose "y" "Do you want to delete these? [Y/n]: " choose "y" "Do you want to delete these? [Y/n]: "
fi fi
''; '';
} }