Auto: cleanup-2026-05-24T10-18-36Z

This commit is contained in:
2026-05-24 12:18:49 +02:00
parent 4dc460dc0c
commit 16c01a5e67
71 changed files with 1770 additions and 1731 deletions
+23 -23
View File
@@ -23,28 +23,28 @@
}; };
import-tree.url = "github:vic/import-tree"; # imports ./modules recursively import-tree.url = "github:vic/import-tree"; # imports ./modules recursively
}; };
outputs = inputs @ { flake-parts, ... }: outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake { inherit inputs; } flake-parts.lib.mkFlake {inherit inputs;}
({ ({
flake = let flake = let
system = "x86_64-linux"; system = "x86_64-linux";
unfreePkgs = [ unfreePkgs = [
"hplip" "hplip"
"vivify.vim" "vivify.vim"
"cheatsheet.nvim" "cheatsheet.nvim"
]; ];
mkUnfreePredicate = pkg: mkUnfreePredicate = pkg:
builtins.elem (inputs.nixpkgs.lib.getName pkg) unfreePkgs; builtins.elem (inputs.nixpkgs.lib.getName pkg) unfreePkgs;
mkPkgs = nixpkgsInput: mkPkgs = nixpkgsInput:
import nixpkgsInput { import nixpkgsInput {
inherit system; inherit system;
config.allowUnfreePredicate = mkUnfreePredicate; config.allowUnfreePredicate = mkUnfreePredicate;
};
pkgs = mkPkgs inputs.nixpkgs;
pkgs-unstable = mkPkgs inputs.nixpkgs-unstable;
in {
inherit pkgs pkgs-unstable;
}; };
pkgs = mkPkgs inputs.nixpkgs; }
pkgs-unstable = mkPkgs inputs.nixpkgs-unstable; // (inputs.import-tree ./modules));
in { }
inherit pkgs pkgs-unstable;
};
}
// (inputs.import-tree ./modules));
}
+46 -46
View File
@@ -1,58 +1,58 @@
{ ... }: { _: {
flake.nixosModules.anki = { pkgs, ... }: { flake.nixosModules.anki = {pkgs, ...}: {
environment.systemPackages = [ environment.systemPackages = [
(pkgs.anki.withAddons [ (pkgs.anki.withAddons [
(pkgs.ankiAddons.recolor.withConfig { (pkgs.ankiAddons.recolor.withConfig {
config = { config = {
# we must specify all the colors or it crashes as this overwrite the whole colors set # we must specify all the colors or it crashes as this overwrite the whole colors set
colors = { colors = {
# ===== Foregrounds ===== # ===== Foregrounds =====
FG = ["Foreground" "#ebdbb2" "#ebdbb2" ""]; FG = ["Foreground" "#ebdbb2" "#ebdbb2" ""];
FG_SUBTLE = ["Subtle FG" "#d5c4a1" "#d5c4a1" ""]; FG_SUBTLE = ["Subtle FG" "#d5c4a1" "#d5c4a1" ""];
FG_FAINT = ["Faint FG" "#a89984" "#a89984" ""]; FG_FAINT = ["Faint FG" "#a89984" "#a89984" ""];
FG_DISABLED = ["Disabled FG" "#928374" "#928374" ""]; FG_DISABLED = ["Disabled FG" "#928374" "#928374" ""];
# ===== Main Background Layers ===== # ===== Main Background Layers =====
BG = ["Background" "#1d2021" "#1d2021" ""]; BG = ["Background" "#1d2021" "#1d2021" ""];
MAIN_BG = ["Main Background" "#1d2021" "#1d2021" ""]; MAIN_BG = ["Main Background" "#1d2021" "#1d2021" ""];
VIEW_BG = ["View Background" "#282828" "#282828" ""]; VIEW_BG = ["View Background" "#282828" "#282828" ""];
EDITOR_BG = ["Editor Background" "#282828" "#282828" ""]; EDITOR_BG = ["Editor Background" "#282828" "#282828" ""];
CANVAS = ["Canvas" "#282828" "#282828" ""]; CANVAS = ["Canvas" "#282828" "#282828" ""];
CANVAS_ELEVATED = ["Elevated Canvas" "#32302f" "#32302f" ""]; CANVAS_ELEVATED = ["Elevated Canvas" "#32302f" "#32302f" ""];
# ===== Tables & Lists ===== # ===== Tables & Lists =====
TABLE_BG = ["Table Background" "#282828" "#282828" ""]; TABLE_BG = ["Table Background" "#282828" "#282828" ""];
TABLE_ALT_BG = ["Table Alt Background" "#32302f" "#32302f" ""]; TABLE_ALT_BG = ["Table Alt Background" "#32302f" "#32302f" ""];
HEADER_BG = ["Header Background" "#3c3836" "#3c3836" ""]; HEADER_BG = ["Header Background" "#3c3836" "#3c3836" ""];
SELECTED_BG = ["Selected Background" "#504945" "#504945" ""]; SELECTED_BG = ["Selected Background" "#504945" "#504945" ""];
# ===== Borders ===== # ===== Borders =====
BORDER = ["Border" "#504945" "#504945" ""]; BORDER = ["Border" "#504945" "#504945" ""];
FAINT_BORDER = ["Faint Border" "#3c3836" "#3c3836" ""]; FAINT_BORDER = ["Faint Border" "#3c3836" "#3c3836" ""];
# ===== Buttons ===== # ===== Buttons =====
BUTTON_GRADIENT_START = ["Button Start" "#3c3836" "#3c3836" ""]; BUTTON_GRADIENT_START = ["Button Start" "#3c3836" "#3c3836" ""];
BUTTON_GRADIENT_END = ["Button End" "#3c3836" "#3c3836" ""]; BUTTON_GRADIENT_END = ["Button End" "#3c3836" "#3c3836" ""];
BUTTON_HOVER = ["Button Hover" "#665c54" "#665c54" ""]; BUTTON_HOVER = ["Button Hover" "#665c54" "#665c54" ""];
# ===== Accent & Links ===== # ===== Accent & Links =====
ACCENT = ["Accent" "#458588" "#458588" ""]; ACCENT = ["Accent" "#458588" "#458588" ""];
LINK = ["Link" "#83a598" "#83a598" ""]; LINK = ["Link" "#83a598" "#83a598" ""];
LINK_HOVER = ["Link Hover" "#8ec07c" "#8ec07c" ""]; LINK_HOVER = ["Link Hover" "#8ec07c" "#8ec07c" ""];
# ===== Status ===== # ===== Status =====
WARNING = ["Warning" "#fe8019" "#fe8019" ""]; WARNING = ["Warning" "#fe8019" "#fe8019" ""];
ERROR = ["Error" "#fb4934" "#fb4934" ""]; ERROR = ["Error" "#fb4934" "#fb4934" ""];
SUCCESS = ["Success" "#8ec07c" "#8ec07c" ""]; SUCCESS = ["Success" "#8ec07c" "#8ec07c" ""];
};
}; };
# version = { major = 3; minor = 1; }; };
# let nixpkgs handle the version # version = { major = 3; minor = 1; };
}) # let nixpkgs handle the version
]) })
]; ])
];
}; };
flake.homeModules.anki = { ... }: { flake.homeModules.anki = _: {
programs.anki = { programs.anki = {
# we enable system wide with nixpkgs because it offers some addon configuration. We just use this for some config # we enable system wide with nixpkgs because it offers some addon configuration. We just use this for some config
#enable = true; #enable = true;
+2 -2
View File
@@ -1,6 +1,6 @@
{ ... }: { _: {
# unused at the moment see ../hardware/battery.nix # unused at the moment see ../hardware/battery.nix
flake.homeModules.batsignal = { ... }: { flake.homeModules.batsignal = _: {
services.batsignal.enable = true; services.batsignal.enable = true;
}; };
} }
+7 -3
View File
@@ -1,12 +1,16 @@
{ self, ...}: { {self, ...}: {
flake.nixosModules.browsers = { pkgs, pkgs-unstable, ...}: { flake.nixosModules.browsers = {
pkgs,
pkgs-unstable,
...
}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
chromium # used only to flash the firmware on my framework laptop 16 (keyboard.frame.work) as only chromium based browser support webHID. chromium # used only to flash the firmware on my framework laptop 16 (keyboard.frame.work) as only chromium based browser support webHID.
pkgs-unstable.tor-browser pkgs-unstable.tor-browser
self.packages.${pkgs.system}.custom-librewolfprofiles self.packages.${pkgs.system}.custom-librewolfprofiles
]; ];
}; };
flake.homeModules.librewolf = { ... }: { flake.homeModules.librewolf = _: {
# adapted from https://github.com/contre95/dotfiles/blob/main/dotfiles/nixos/programs/librewolf.nix # adapted from https://github.com/contre95/dotfiles/blob/main/dotfiles/nixos/programs/librewolf.nix
home.sessionVariables = { home.sessionVariables = {
MOZ_ENABLE_WAYLAND = 1; MOZ_ENABLE_WAYLAND = 1;
+3 -4
View File
@@ -1,17 +1,16 @@
{ self, ... }: { {self, ...}: {
flake.nixosModules.caelestia = { pkgs, ... }: { flake.nixosModules.caelestia = {pkgs, ...}: {
qt.enable = true; qt.enable = true;
# to resolve this https://wiki.nixos.org/wiki/Home_Manager#I_cannot_set_GNOME_or_Gtk_themes_via_Home_Manager # to resolve this https://wiki.nixos.org/wiki/Home_Manager#I_cannot_set_GNOME_or_Gtk_themes_via_Home_Manager
programs.dconf.enable = true; programs.dconf.enable = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
self.packages.${pkgs.system}.qtbatticon self.packages.${pkgs.system}.qtbatticon
kdePackages.qtdeclarative # provides qmlls and other things kdePackages.qtdeclarative # provides qmlls and other things
quickshell # we have it but adding it there solves "WARN qt.qpa.services: Failed to register with host portal QDBusError("org.freedesktop.portal.Error.Failed", "Could not register app ID: App info not found for 'org.quickshell'")" quickshell # we have it but adding it there solves "WARN qt.qpa.services: Failed to register with host portal QDBusError("org.freedesktop.portal.Error.Failed", "Could not register app ID: App info not found for 'org.quickshell'")"
]; ];
}; };
flake.homeModules.caelestia = { ... }: let flake.homeModules.caelestia = _: let
sisyphe = ../../assets/sisyphe.gif; sisyphe = ../../assets/sisyphe.gif;
pepe-music = ../../assets/pepe-music.gif; pepe-music = ../../assets/pepe-music.gif;
in { in {
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.homeModules.eza = { ... }: { flake.homeModules.eza = _: {
# ls replacement # 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 = {
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.homeModules.fastfetch = { ... }: { flake.homeModules.fastfetch = _: {
# Adapted from https://github.com/dacrab/fastfetch-config/blob/main/config.jsonc # Adapted from https://github.com/dacrab/fastfetch-config/blob/main/config.jsonc
programs.fastfetch = { programs.fastfetch = {
enable = true; enable = true;
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.games = {pkgs, ...}: { flake.nixosModules.games = {pkgs, ...}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
supertux # fuck mario supertux # fuck mario
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.homeModules.git = { ... }: { flake.homeModules.git = _: {
programs.git = { programs.git = {
enable = true; enable = true;
settings = { settings = {
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.homeModules.gtk = {pkgs, ...}: { flake.homeModules.gtk = {pkgs, ...}: {
# gtk config # gtk config
gtk.theme = { gtk.theme = {
+2 -2
View File
@@ -1,6 +1,6 @@
{ ... }: { _: {
# this was in my home-manager config, but looks like more # this was in my home-manager config, but looks like more
flake.nixosModules.hypridle = { ... }: { flake.nixosModules.hypridle = _: {
services.hypridle = { services.hypridle = {
enable = true; enable = true;
settings = { settings = {
+8 -4
View File
@@ -1,5 +1,9 @@
{ self, ... }: { {self, ...}: {
flake.nixosModules.hyprland = { pkgs, pkgs-unstable, ... }: { flake.nixosModules.hyprland = {
pkgs,
pkgs-unstable,
...
}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
swww #wallpaper daemon swww #wallpaper daemon
gruvbox-gtk-theme gruvbox-gtk-theme
@@ -31,10 +35,10 @@
# removes uxterm # removes uxterm
services.xserver.excludePackages = [pkgs.xterm]; services.xserver.excludePackages = [pkgs.xterm];
# Enable the X11 windowing system. # Enable the X11 windowing system.
services.xserver.enable = true; services.xserver.enable = true;
}; };
flake.homeModules.hyprland-laptop = { ... }: { flake.homeModules.hyprland-laptop = _: {
wayland.windowManager.hyprland.settings = { wayland.windowManager.hyprland.settings = {
exec-once = [ exec-once = [
"qtbatticon" # custom battery tray "qtbatticon" # custom battery tray
+55 -53
View File
@@ -1,50 +1,51 @@
{ ...}: { # for some reason perSystem can't expose pkgs-unstable so we need to expose it here _: {
# ----------------------------------------------------- # for some reason perSystem can't expose pkgs-unstable so we need to expose it here
# Here are a bunch of scripts that interact with hyprland # -----------------------------------------------------
# Some are still used. Some are broken. Some are deprecated. But I do still keep them in case I want to go back to old tools # Here are a bunch of scripts that interact with hyprland
# ----------------------------------------------------- # Some are still used. Some are broken. Some are deprecated. But I do still keep them in case I want to go back to old tools
perSystem = { pkgs, ... }: let # -----------------------------------------------------
perSystem = {pkgs, ...}: let
wallpaper1 = ../../assets/wallpaper1.jpg; wallpaper1 = ../../assets/wallpaper1.jpg;
wallpaper2 = ../../assets/wallpaper2.jpg; wallpaper2 = ../../assets/wallpaper2.jpg;
wallpaper3 = ../../assets/wallpaper3.jpg; wallpaper3 = ../../assets/wallpaper3.jpg;
wallpaper4 = ../../assets/wallpaper4.jpg; wallpaper4 = ../../assets/wallpaper4.jpg;
wallpaper5 = ../../assets/wallpaper5.jpg; wallpaper5 = ../../assets/wallpaper5.jpg;
in { in {
# kills the app, but when it's steam or custom-pomodoro # kills the app, but when it's steam or custom-pomodoro
packages.custom-dontkillsteam = pkgs.writeShellApplication { packages.custom-dontkillsteam = pkgs.writeShellApplication {
name = "custom-dontkillsteam"; name = "custom-dontkillsteam";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
hyprland hyprland
jq jq
]; ];
text = '' text = ''
class=$(hyprctl activewindow -j | jq -r ".class") class=$(hyprctl activewindow -j | jq -r ".class")
if [[ "$class" == "Steam" || "$class" == "custom-pomodoro" ]]; then if [[ "$class" == "Steam" || "$class" == "custom-pomodoro" ]]; then
hyprctl dispatch movetoworkspacesilent special hyprctl dispatch movetoworkspacesilent special
else else
hyprctl dispatch killactive "" hyprctl dispatch killactive ""
fi fi
''; '';
}; };
packages.custom-killall = pkgs.writeShellApplication { packages.custom-killall = pkgs.writeShellApplication {
name = "custom-killall"; name = "custom-killall";
runtimeInputs = [ runtimeInputs = [
pkgs.hyprland # for some reason pkgs-unstable doesn't work here pkgs.hyprland # for some reason pkgs-unstable doesn't work here
pkgs.jq pkgs.jq
]; ];
text = '' text = ''
active_workspace_id=$(hyprctl activeworkspace -j | jq -r '.id') active_workspace_id=$(hyprctl activeworkspace -j | jq -r '.id')
hyprctl clients -j | hyprctl clients -j |
jq -r ".[] jq -r ".[]
| select(.workspace.id==''${active_workspace_id}) | select(.workspace.id==''${active_workspace_id})
| select(.focusHistoryID!=0) | select(.focusHistoryID!=0)
| .pid" | | .pid" |
xargs -r kill xargs -r kill
''; '';
}; };
packages.custom-wallpaper = pkgs.writeShellApplication { packages.custom-wallpaper = pkgs.writeShellApplication {
name = "custom-wallpaper"; name = "custom-wallpaper";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
socat socat
@@ -80,18 +81,19 @@
socat -U - UNIX-CONNECT:"$XDG_RUNTIME_DIR"/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock | while read -r line; do handle "$line"; done socat -U - UNIX-CONNECT:"$XDG_RUNTIME_DIR"/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock | while read -r line; do handle "$line"; done
''; '';
};
packages.custom-launch = pkgs.writeShellApplication {
# used for the terminal autostart. Needs to get cleared and recall fastfetch so that the bar from oh-my-zsh get resized
# unused
name = "custom-launch";
runtimeInputs = with pkgs; [
zsh
];
text = ''
sleep 2
clear
zsh
'';
};
}; };
packages.custom-launch = pkgs.writeShellApplication { }
# used for the terminal autostart. Needs to get cleared and recall fastfetch so that the bar from oh-my-zsh get resized
# unused
name = "custom-launch";
runtimeInputs = with pkgs; [
zsh
];
text = ''
sleep 2
clear
zsh
'';
};
};}
+22 -21
View File
@@ -1,5 +1,5 @@
{ self, ... }: { {self, ...}: {
flake.nixosModules.kdrive = { pkgs-unstable, ... }: { flake.nixosModules.kdrive = {pkgs-unstable, ...}: {
environment.systemPackages = with pkgs-unstable; [ environment.systemPackages = with pkgs-unstable; [
rclone rclone
self.packages.${pkgs.system}.custom-checkKdrive self.packages.${pkgs.system}.custom-checkKdrive
@@ -11,7 +11,7 @@
enable = true; enable = true;
}; };
}; };
perSystem = { pkgs, ... }: { perSystem = {pkgs, ...}: {
packages.custom-checkKdrive = pkgs.writeShellApplication { packages.custom-checkKdrive = pkgs.writeShellApplication {
name = "custom-checkKdrive"; name = "custom-checkKdrive";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
@@ -47,23 +47,24 @@
''; '';
}; };
packages.custom-mountkdrive = pkgs.writeShellApplication { packages.custom-mountkdrive = pkgs.writeShellApplication {
name = "custom-mountkdrive"; name = "custom-mountkdrive";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
rclone rclone
libnotify libnotify
]; ];
text = '' text = ''
REMOTE_NAME="kdrive" REMOTE_NAME="kdrive"
MOUNT_POINT="$HOME/kdrive" MOUNT_POINT="$HOME/kdrive"
if rclone listremotes | rg "^''${REMOTE_NAME}:"; then if rclone listremotes | rg "^''${REMOTE_NAME}:"; then
echo "Mounting ''${REMOTE_NAME}..." echo "Mounting ''${REMOTE_NAME}..."
rclone mount "''${REMOTE_NAME}:" "$MOUNT_POINT" --vfs-cache-mode writes --allow-non-empty & rclone mount "''${REMOTE_NAME}:" "$MOUNT_POINT" --vfs-cache-mode writes --allow-non-empty &
else else
notify-send "rclone mount failed" \ notify-send "rclone mount failed" \
"Remote ''${REMOTE_NAME} not found.\nConfigure rclone and create the dir ~/kdrive/ or comment out the exec line in hyprland.nix." "Remote ''${REMOTE_NAME} not found.\nConfigure rclone and create the dir ~/kdrive/ or comment out the exec line in hyprland.nix."
echo "Remote ''${REMOTE_NAME} not found. Configure rclone or comment out the exec line in hyprland.nix." echo "Remote ''${REMOTE_NAME} not found. Configure rclone or comment out the exec line in hyprland.nix."
fi fi
''; '';
};
}; };
};} }
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.homeModules.kitty = { ... }: { flake.homeModules.kitty = _: {
programs.kitty = { programs.kitty = {
enable = true; enable = true;
#font.name = nerd-fonts._0xproto; #font.name = nerd-fonts._0xproto;
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.nixosModules.ly = { ... }: { flake.nixosModules.ly = _: {
# a minimal ly config as the big config (ly.nix) didnt worked # a minimal ly config as the big config (ly.nix) didnt worked
services.displayManager.ly = { services.displayManager.ly = {
enable = true; enable = true;
+2 -2
View File
@@ -1,5 +1,5 @@
{ inputs, ... }: { {inputs, ...}: {
flake.hostModules.micro = { pkgs-unstable, ... }: { flake.hostModules.micro = {pkgs-unstable, ...}: {
programs.micro = { programs.micro = {
enable = true; enable = true;
package = pkgs-unstable.micro-full; package = pkgs-unstable.micro-full;
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.mullvad = {pkgs-unstable, ...}: { flake.nixosModules.mullvad = {pkgs-unstable, ...}: {
services.mullvad-vpn = { services.mullvad-vpn = {
enable = true; enable = true;
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.homeModules.neovim = {pkgs-unstable, ...}: { flake.homeModules.neovim = {pkgs-unstable, ...}: {
programs.neovim = { programs.neovim = {
enable = true; enable = true;
+90 -89
View File
@@ -1,6 +1,6 @@
{ ... }: { _: {
# obsidian is unused -> see my project https://github.com/tomasriveral/NoteWrapper # obsidian is unused -> see my project https://github.com/tomasriveral/NoteWrapper
flake.homeModules.obsidian = { ... }: { flake.homeModules.obsidian = _: {
programs.obsidian = { programs.obsidian = {
enable = true; enable = true;
@@ -27,99 +27,100 @@
}; };
}; };
perSystem = {pkgs, ...}: { perSystem = {pkgs, ...}: {
packages.custom-obsidianbackup = pkgs.writeShellApplication { packages.custom-obsidianbackup = pkgs.writeShellApplication {
name = "custom-obsidianbackup"; name = "custom-obsidianbackup";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
rclone rclone
libnotify libnotify
rsync rsync
]; ];
text = '' text = ''
#!/usr/bin/env bash #!/usr/bin/env bash
SOURCE_DIR="$HOME/Documents/Notes" SOURCE_DIR="$HOME/Documents/Notes"
DEST_DIR="$HOME/kdrive/Notes" DEST_DIR="$HOME/kdrive/Notes"
BACKUP_DIR="$HOME/.Notes.backup" BACKUP_DIR="$HOME/.Notes.backup"
mkdir -p "$DEST_DIR" mkdir -p "$DEST_DIR"
mkdir -p "$BACKUP_DIR" mkdir -p "$BACKUP_DIR"
while true; do while true; do
# Timestamp for this run # Timestamp for this run
TIMESTAMP=$(date +%Y-%m-%d_%H-%M) TIMESTAMP=$(date +%Y-%m-%d_%H-%M)
TIMESTAMPED_BACKUP="$BACKUP_DIR/$TIMESTAMP" TIMESTAMPED_BACKUP="$BACKUP_DIR/$TIMESTAMP"
mkdir -p "$TIMESTAMPED_BACKUP" mkdir -p "$TIMESTAMPED_BACKUP"
echo "[$(date)] Starting Obsidian backup..." echo "[$(date)] Starting Obsidian backup..."
# Check rclone mount # Check rclone mount
status=$(rclone about kdrive: 2>&1 || true) status=$(rclone about kdrive: 2>&1 || true)
if [[ "$status" =~ .*CRITICAL.* ]]; then if [[ "$status" =~ .*CRITICAL.* ]]; then
echo "[$(date)] rclone failed:" echo "[$(date)] rclone failed:"
echo "$status" echo "$status"
notify-send -u critical "rclone failed" \ notify-send -u critical "rclone failed" \
"rclone might be broken or you need to deactivate this script in HomeManager." "rclone might be broken or you need to deactivate this script in HomeManager."
else else
# Run rsync with verbose debugging # Run rsync with verbose debugging
echo "[$(date)] Running rsync..." echo "[$(date)] Running rsync..."
rsync -Lavh --progress --update --backup --backup-dir="$TIMESTAMPED_BACKUP" \ rsync -Lavh --progress --update --backup --backup-dir="$TIMESTAMPED_BACKUP" \
--exclude='.obsidian/cache/**' \ --exclude='.obsidian/cache/**' \
"$SOURCE_DIR/" "$DEST_DIR/" "$SOURCE_DIR/" "$DEST_DIR/"
echo "[$(date)] Backup completed for this run." echo "[$(date)] Backup completed for this run."
fi fi
# Safely remove backups older than 30 days # Safely remove backups older than 30 days
if [[ -d "$BACKUP_DIR" && "$BACKUP_DIR" == "$HOME/.Notes.backup" ]]; then if [[ -d "$BACKUP_DIR" && "$BACKUP_DIR" == "$HOME/.Notes.backup" ]]; then
echo "[$(date)] Cleaning old backups..." echo "[$(date)] Cleaning old backups..."
find "$BACKUP_DIR/" -mindepth 1 -maxdepth 1 -type d -mtime +30 -exec rm -rf {} \; find "$BACKUP_DIR/" -mindepth 1 -maxdepth 1 -type d -mtime +30 -exec rm -rf {} \;
else else
echo "[$(date)] Backup directory not safe. Skipping cleanup." echo "[$(date)] Backup directory not safe. Skipping cleanup."
fi fi
# Wait 1 hour # Wait 1 hour
echo "[$(date)] Sleeping for 1 hour..." echo "[$(date)] Sleeping for 1 hour..."
sleep 3600 sleep 3600
done done
''; '';
};
# this might be broken after dendritic nix. As it searched for the obsidian.nix to get list of vaults
packages.custom-obsidianbvaults = pkgs.writeShellApplication {
name = "custom-obsidianvaults";
runtimeInputs = with pkgs; [
zsh
fzf
ripgrep
];
text = ''
# Path to your obsidian.nix
obsidian_nix="$HOME/nixos/modules/home-manager/obsidian.nix"
# Extract vault names without line numbers and colors
mapfile -t vaults < <(rg -N --color=never -Po 'vaults\.\K[[:alnum:]_]+' "$obsidian_nix")
# Let user select a vault with fzf
selected=$(printf "%s\n" "''${vaults[@]}" \
| fzf --height 6 --reverse --prompt="Select Obsidian vault:")
# Exit if user cancels
[[ -z "$selected" ]] && exit 0
# Remove any stray ANSI codes (optional)
selected=$(echo "$selected" | sed -r 's/\x1B\[[0-9;]*[mK]//g')
# Find the target path of the selected vault
vault_path=$(rg -N --color=never -A2 "vaults.$selected" "$obsidian_nix" \
| rg 'target =' | sed -E 's/.*"([^"]+)".*/\1/')
# Expand ~ if present
vault_path="''${vault_path/#\~/$HOME}"
# Launch Obsidian with the selected vault using URI
[[ -n "$vault_path" ]] && setsid xdg-open "obsidian://open?vault=$selected" >/dev/null 2>&1 &
# Exit the kitty terminal after selection
pkill -f "kitty.*Select Obsidian vault"
exit
'';
};
}; };
# this might be broken after dendritic nix. As it searched for the obsidian.nix to get list of vaults }
packages.custom-obsidianbvaults = pkgs.writeShellApplication {
name = "custom-obsidianvaults";
runtimeInputs = with pkgs; [
zsh
fzf
ripgrep
];
text = ''
# Path to your obsidian.nix
obsidian_nix="$HOME/nixos/modules/home-manager/obsidian.nix"
# Extract vault names without line numbers and colors
mapfile -t vaults < <(rg -N --color=never -Po 'vaults\.\K[[:alnum:]_]+' "$obsidian_nix")
# Let user select a vault with fzf
selected=$(printf "%s\n" "''${vaults[@]}" \
| fzf --height 6 --reverse --prompt="Select Obsidian vault:")
# Exit if user cancels
[[ -z "$selected" ]] && exit 0
# Remove any stray ANSI codes (optional)
selected=$(echo "$selected" | sed -r 's/\x1B\[[0-9;]*[mK]//g')
# Find the target path of the selected vault
vault_path=$(rg -N --color=never -A2 "vaults.$selected" "$obsidian_nix" \
| rg 'target =' | sed -E 's/.*"([^"]+)".*/\1/')
# Expand ~ if present
vault_path="''${vault_path/#\~/$HOME}"
# Launch Obsidian with the selected vault using URI
[[ -n "$vault_path" ]] && setsid xdg-open "obsidian://open?vault=$selected" >/dev/null 2>&1 &
# Exit the kitty terminal after selection
pkill -f "kitty.*Select Obsidian vault"
exit
'';
};
};}
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.homeModules.oh-my-posh = { ... }: { flake.homeModules.oh-my-posh = _: {
programs.oh-my-posh = { programs.oh-my-posh = {
enable = true; enable = true;
enableZshIntegration = true; enableZshIntegration = true;
+117 -117
View File
@@ -1,123 +1,123 @@
{ ... }: _: {
{ flake.homeModules.quickshell = _: {
flake.homeModules.quickshell = { ... }: {
# pulled from https://codeberg.org/zacoons/rivendell-hyprdots # pulled from https://codeberg.org/zacoons/rivendell-hyprdots
# replaced by caelestia-shell # replaced by caelestia-shell
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;
}; };
}; };
perSystem = {pkgs, ...}: { perSystem = {pkgs, ...}: {
# creates and maintains cache file for the notification history # creates and maintains cache file for the notification history
packages.QS-notifycache = pkgs.writeShellApplication { packages.QS-notifycache = pkgs.writeShellApplication {
name = "QS-notifycache"; name = "QS-notifycache";
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"
''; '';
};
packages.QS-notifyhistory = pkgs.writeShellApplication {
name = "QS-notifyhistory";
text = ''
app="$1"
title="$2"
body="$3"
date="$(date +%T)"
urgency="$4"
case "$urgency" in
0) urgency_text="low";;
1) urgency_text="normal";;
2) urgency_text="critical";;
*) urgency_text="unknown";;
esac
{
echo "$app"
echo "$title"
echo "$body"
echo "$date"
echo "$urgency_text"
} >> "$HOME/.cache/notify_history"
'';
};
packages.QS-sysinfo = pkgs.writeShellApplication {
name = "QS-sysinfo";
runtimeInputs = with pkgs; [
ripgrep
gawkInteractive
iproute2
coreutils
procps
upower
];
text = ''
# Pad CPU, MEM, DISK to 2 chars (right-aligned)
cpu=$(awk '/^cpu /{printf("%.0f", ($2+$4)*100/($2+$4+$5))}' /proc/stat)
cpu=$(printf "%2s" "$cpu")
sum=0
count=0
for f in /sys/class/hwmon/hwmon*/temp*_input; do
if [ -r "$f" ]; then
val=$(cat "$f" 2>/dev/null) || continue
sum=$((sum + val))
count=$((count + 1))
fi
done
temp=$(( sum / count / 1000 ))
sum=0
count=0
for f in /sys/class/hwmon/hwmon*/fan*_input; do
if [ -r "$f" ]; then
val=$(cat "$f" 2>/dev/null) || continue
sum=$((sum + val))
count=$((count + 1))
fi
done
fan=$(( sum / count ))
fan=$(printf "%4s" "$fan")
mem=$(free | awk '/Mem:/ {printf("%.0f",$3/$2*100)}')
mem=$(printf "%2s" "$mem")
disk=$(df / | awk 'NR==2 {gsub("%",""); print $5}')
disk=$(printf "%2s" "$disk")
# 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=$(printf "%5s" "$power")
# network calculations
iface=$(ip route get 1.1.1.1 | awk '{print $5; exit}')
rx1=$(cat "/sys/class/net/$iface/statistics/rx_bytes")
tx1=$(cat "/sys/class/net/$iface/statistics/tx_bytes")
sleep 1
rx2=$(cat "/sys/class/net/$iface/statistics/rx_bytes")
tx2=$(cat "/sys/class/net/$iface/statistics/tx_bytes")
down_speed=$(( (rx2 - rx1) / 1024 ))
up_speed=$(( (tx2 - tx1) / 1024 ))
# Output JSON
echo "{\"cpu\":\"$cpu\",\"temp\":\"$temp\",\"fan\":\"$fan\",\"mem\":\"$mem\",\"disk\":\"$disk\",\"power\":\"$power\",\"down\":\"$down_speed\",\"up\":\"$up_speed\"}"
'';
};
}; };
packages.QS-notifyhistory = pkgs.writeShellApplication { }
name = "QS-notifyhistory";
text = ''
app="$1"
title="$2"
body="$3"
date="$(date +%T)"
urgency="$4"
case "$urgency" in
0) urgency_text="low";;
1) urgency_text="normal";;
2) urgency_text="critical";;
*) urgency_text="unknown";;
esac
{
echo "$app"
echo "$title"
echo "$body"
echo "$date"
echo "$urgency_text"
} >> "$HOME/.cache/notify_history"
'';
};
packages.QS-sysinfo = pkgs.writeShellApplication {
name = "QS-sysinfo";
runtimeInputs = with pkgs; [
ripgrep
gawkInteractive
iproute2
coreutils
procps
upower
];
text = ''
# Pad CPU, MEM, DISK to 2 chars (right-aligned)
cpu=$(awk '/^cpu /{printf("%.0f", ($2+$4)*100/($2+$4+$5))}' /proc/stat)
cpu=$(printf "%2s" "$cpu")
sum=0
count=0
for f in /sys/class/hwmon/hwmon*/temp*_input; do
if [ -r "$f" ]; then
val=$(cat "$f" 2>/dev/null) || continue
sum=$((sum + val))
count=$((count + 1))
fi
done
temp=$(( sum / count / 1000 ))
sum=0
count=0
for f in /sys/class/hwmon/hwmon*/fan*_input; do
if [ -r "$f" ]; then
val=$(cat "$f" 2>/dev/null) || continue
sum=$((sum + val))
count=$((count + 1))
fi
done
fan=$(( sum / count ))
fan=$(printf "%4s" "$fan")
mem=$(free | awk '/Mem:/ {printf("%.0f",$3/$2*100)}')
mem=$(printf "%2s" "$mem")
disk=$(df / | awk 'NR==2 {gsub("%",""); print $5}')
disk=$(printf "%2s" "$disk")
# 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=$(printf "%5s" "$power")
# network calculations
iface=$(ip route get 1.1.1.1 | awk '{print $5; exit}')
rx1=$(cat "/sys/class/net/$iface/statistics/rx_bytes")
tx1=$(cat "/sys/class/net/$iface/statistics/tx_bytes")
sleep 1
rx2=$(cat "/sys/class/net/$iface/statistics/rx_bytes")
tx2=$(cat "/sys/class/net/$iface/statistics/tx_bytes")
down_speed=$(( (rx2 - rx1) / 1024 ))
up_speed=$(( (tx2 - tx1) / 1024 ))
# Output JSON
echo "{\"cpu\":\"$cpu\",\"temp\":\"$temp\",\"fan\":\"$fan\",\"mem\":\"$mem\",\"disk\":\"$disk\",\"power\":\"$power\",\"down\":\"$down_speed\",\"up\":\"$up_speed\"}"
'';
};
};}
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.homeModules.ripgrep = { ... }: { flake.homeModules.ripgrep = _: {
programs.ripgrep = { programs.ripgrep = {
enable = true; enable = true;
arguments = [ arguments = [
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.homeModules.rofi = { ... }: { flake.homeModules.rofi = _: {
programs.rofi = { programs.rofi = {
enable = true; enable = true;
theme = "gruvbox-dark-hard"; theme = "gruvbox-dark-hard";
+4 -4
View File
@@ -1,7 +1,7 @@
{ ... }: { _: {
flake.homeModules.sbb-tui = { pkgs-unstable, ... }: { flake.homeModules.sbb-tui = {pkgs-unstable, ...}: {
home.packages = [ home.packages = [
pkgs-unstable.sbb-tui pkgs-unstable.sbb-tui
]; ];
home.file.".config/sbb-tui/config.yaml" = { home.file.".config/sbb-tui/config.yaml" = {
enable = true; enable = true;
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.homeModules.ssh = { ... }: { flake.homeModules.ssh = _: {
programs.ssh = { programs.ssh = {
enable = true; enable = true;
enableDefaultConfig = false; # will be removed in the futur. Removes evaluation warning enableDefaultConfig = false; # will be removed in the futur. Removes evaluation warning
+3 -3
View File
@@ -1,11 +1,11 @@
{ ... }: { _: {
# replaced by caelestia # replaced by caelestia
flake.homeModules.swaync = { ... }: { flake.homeModules.swaync = _: {
services.swaync = { services.swaync = {
enable = true; enable = true;
}; };
}; };
flake.homeModules.swaylock = { ... }: { flake.homeModules.swaylock = _: {
programs.swaylock = { programs.swaylock = {
enable = true; enable = true;
settings = { settings = {
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.homeModules.thunderbird = { ... }: { flake.homeModules.thunderbird = _: {
programs.thunderbird = { programs.thunderbird = {
enable = true; enable = true;
profiles.tomasr = { profiles.tomasr = {
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.homeModules.vivify = {pkgs-unstable, ...}: { flake.homeModules.vivify = {pkgs-unstable, ...}: {
home.file.".config/vivify/config.json" = { home.file.".config/vivify/config.json" = {
enable = true; enable = true;
+22 -22
View File
@@ -1,6 +1,5 @@
{ ... }: _: {
{ flake.homeModules.waybar = _: {
flake.homeModules.waybar = { ... }: {
# replaced by caelestia # replaced by caelestia
programs.waybar = { programs.waybar = {
enable = true; enable = true;
@@ -694,23 +693,24 @@
''; '';
}; };
}; };
perSystem = { pkgs, ... }: { perSystem = {pkgs, ...}: {
packages.custom-weatherwaybar = pkgs.writeShellApplication { packages.custom-weatherwaybar = pkgs.writeShellApplication {
name = "custom-weatherwaybar"; name = "custom-weatherwaybar";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
curl curl
]; ];
text = '' text = ''
PATTERN="C" PATTERN="C"
PATTERN2=" " PATTERN2=" "
TEXT1="''$(curl -s "https://wttr.in/?format=%c")" TEXT1="''$(curl -s "https://wttr.in/?format=%c")"
TEXT1=''${TEXT1/$PATTERN2/} TEXT1=''${TEXT1/$PATTERN2/}
TEXT2="''$(curl -s "https://wttr.in/?format=%t")" TEXT2="''$(curl -s "https://wttr.in/?format=%t")"
TEXT2=''${TEXT2/$PATTERN/} TEXT2=''${TEXT2/$PATTERN/}
TEXT3="''$(curl -s "https://wttr.in/?format=%f")" TEXT3="''$(curl -s "https://wttr.in/?format=%f")"
TEXT3=''${TEXT3/$PATTERN/} TEXT3=''${TEXT3/$PATTERN/}
printf '{"text":" %s\\n %s\\n %s", "tooltip": false, "class": "weather"}\\n' \ printf '{"text":" %s\\n %s\\n %s", "tooltip": false, "class": "weather"}\\n' \
"$TEXT1" "$TEXT2" "$TEXT3" "$TEXT1" "$TEXT2" "$TEXT3"
''; '';
};
}; };
};} }
+2 -2
View File
@@ -1,6 +1,6 @@
{ ... }: { _: {
# replaced by wlogout # replaced by wlogout
flake.homeModules.wlogout = { ... }: let flake.homeModules.wlogout = _: let
wallpaper = ../../assets/wallpaper1.jpg; wallpaper = ../../assets/wallpaper1.jpg;
lock = ../../assets/lock.png; lock = ../../assets/lock.png;
lock-hover = ../../assets/lock-hover.png; lock-hover = ../../assets/lock-hover.png;
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.homeModules.zoxide = { ... }: { flake.homeModules.zoxide = _: {
programs.zoxide = { programs.zoxide = {
enable = true; enable = true;
enableZshIntegration = true; enableZshIntegration = true;
+4 -4
View File
@@ -1,5 +1,5 @@
{ self, ... }: { {self, ...}: {
flake.homeModules.zsh-laptop = { ... }: { flake.homeModules.zsh-laptop = _: {
programs.zsh = { programs.zsh = {
shellAliases = { shellAliases = {
snrt = "git -C ~/nixos add -A && time sudo nixos-rebuild test --flake ~/nixos/#laptop && pkill shell || true && pkill caelestia-shell || true && caelestia-shell -n > /dev/null 2>&1 & disown"; snrt = "git -C ~/nixos add -A && time sudo nixos-rebuild test --flake ~/nixos/#laptop && pkill shell || true && pkill caelestia-shell || true && caelestia-shell -n > /dev/null 2>&1 & disown";
@@ -7,7 +7,7 @@
}; };
}; };
}; };
flake.homeModules.zsh = {pkgs,...}: { flake.homeModules.zsh = {pkgs, ...}: {
home.packages = [ home.packages = [
self.packages.${pkgs.system}.dejaManuallyDerived self.packages.${pkgs.system}.dejaManuallyDerived
#pkgs-unstable.deja #pkgs-unstable.deja
@@ -67,7 +67,7 @@
}; };
}; };
}; };
flake.homeModules.oh-my-zsh = { ... }: { flake.homeModules.oh-my-zsh = _: {
programs.zsh.oh-my-zsh = { programs.zsh.oh-my-zsh = {
enable = true; enable = true;
theme = "jonathan"; theme = "jonathan";
+98 -97
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.battery-laptop = { flake.nixosModules.battery-laptop = {
lib, lib,
config, config,
@@ -53,7 +53,7 @@
}; };
# }; # };
}; };
perSystem = { pkgs, ... }: let perSystem = {pkgs, ...}: let
NotifySound = ../../assets/battery_notify.mp3; NotifySound = ../../assets/battery_notify.mp3;
in { in {
packages.custom-batterynotify = pkgs.writeShellApplication { packages.custom-batterynotify = pkgs.writeShellApplication {
@@ -331,104 +331,105 @@
install -m755 qtbatticon $out/bin/ install -m755 qtbatticon $out/bin/
''; '';
}; };
# This was replaced by caelestia shell's Game Mode # This was replaced by caelestia shell's Game Mode
packages.custom-performance = pkgs.writeShellApplication { packages.custom-performance = pkgs.writeShellApplication {
name = "custom-performance"; name = "custom-performance";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
hyprland hyprland
gawk gawk
libnotify libnotify
]; ];
text = '' text = ''
HYPRGAMEMODE=$(hyprctl getoption animations:enabled | awk 'NR==1{print $2}') HYPRGAMEMODE=$(hyprctl getoption animations:enabled | awk 'NR==1{print $2}')
if [ "$HYPRGAMEMODE" = 1 ] ; then if [ "$HYPRGAMEMODE" = 1 ] ; then
hyprctl --batch "\ hyprctl --batch "\
keyword animations:enabled 0;\ keyword animations:enabled 0;\
keyword animation borderangle,0; \ keyword animation borderangle,0; \
keyword decoration:shadow:enabled 0;\ keyword decoration:shadow:enabled 0;\
keyword decoration:blur:enabled 0;\ keyword decoration:blur:enabled 0;\
keyword decoration:fullscreen_opacity 1;\ keyword decoration:fullscreen_opacity 1;\
keyword general:gaps_in 0;\ keyword general:gaps_in 0;\
keyword general:gaps_out 0;\ keyword general:gaps_out 0;\
keyword general:border_size 1;\ keyword general:border_size 1;\
keyword decoration:rounding 0" keyword decoration:rounding 0"
notify-send -u critical -t 5000 "Performance mode [ON]" notify-send -u critical -t 5000 "Performance mode [ON]"
exit exit
else
notify-send -u critical -t 5000 "Performance mode [OFF]"
hyprctl reload
exit 0
fi
'';
};
# Old script that was used for the battery. Might not work.
packages.custom-olddeprecatedbatterynotify = pkgs.writeShellApplication {
name = "custom-olddeprecatedbatterynotify";
runtimeInputs = with pkgs; [
libnotify # provides notify-send
systemd # provides systemctl
];
text = ''
set -euo pipefail
LOW="''${BATTERY_LOW_THRESHOLD:-20}"
CRITICAL="''${BATTERY_CRITICAL_THRESHOLD:-5}"
FULL="''${BATTERY_FULL_THRESHOLD:-95}"
INTERVAL="''${BATTERY_INTERVAL:-30}"
ACTION="''${BATTERY_CRITICAL_ACTION:-systemctl suspend}"
notify() {
notify-send -a "Battery" -u "$1" "$2" "$3"
}
get_info() {
total=0
count=0
for bat in /sys/class/power_supply/BAT*; do
[ -f "$bat/capacity" ] || continue
capacity=$(<"$bat/capacity")
status=$(<"$bat/status")
total=$((total + capacity))
count=$((count + 1))
done
[ "$count" -gt 0 ] || exit 0
percentage=$((total / count))
}
last_state=""
while true; do
get_info
if [[ "$status" == "Discharging" && "$percentage" -le "$CRITICAL" ]]; then
notify critical "Battery Critically Low" "$percentage% suspending."
$ACTION
elif [[ "$status" == "Discharging" && "$percentage" -le "$LOW" ]]; then
if [[ "$last_state" != "low" ]]; then
notify normal "Battery Low" "$percentage% remaining."
last_state="low"
fi
elif [[ "$status" != "Discharging" && "$percentage" -ge "$FULL" ]]; then
if [[ "$last_state" != "full" ]]; then
notify normal "Battery Full" "$percentage% unplug charger."
last_state="full"
fi
else else
last_state="" notify-send -u critical -t 5000 "Performance mode [OFF]"
hyprctl reload
exit 0
fi fi
'';
};
# Old script that was used for the battery. Might not work.
packages.custom-olddeprecatedbatterynotify = pkgs.writeShellApplication {
name = "custom-olddeprecatedbatterynotify";
sleep "$INTERVAL" runtimeInputs = with pkgs; [
done libnotify # provides notify-send
''; systemd # provides systemctl
};}; ];
flake.homeModules.cbatticon = { ... }: {
text = ''
set -euo pipefail
LOW="''${BATTERY_LOW_THRESHOLD:-20}"
CRITICAL="''${BATTERY_CRITICAL_THRESHOLD:-5}"
FULL="''${BATTERY_FULL_THRESHOLD:-95}"
INTERVAL="''${BATTERY_INTERVAL:-30}"
ACTION="''${BATTERY_CRITICAL_ACTION:-systemctl suspend}"
notify() {
notify-send -a "Battery" -u "$1" "$2" "$3"
}
get_info() {
total=0
count=0
for bat in /sys/class/power_supply/BAT*; do
[ -f "$bat/capacity" ] || continue
capacity=$(<"$bat/capacity")
status=$(<"$bat/status")
total=$((total + capacity))
count=$((count + 1))
done
[ "$count" -gt 0 ] || exit 0
percentage=$((total / count))
}
last_state=""
while true; do
get_info
if [[ "$status" == "Discharging" && "$percentage" -le "$CRITICAL" ]]; then
notify critical "Battery Critically Low" "$percentage% suspending."
$ACTION
elif [[ "$status" == "Discharging" && "$percentage" -le "$LOW" ]]; then
if [[ "$last_state" != "low" ]]; then
notify normal "Battery Low" "$percentage% remaining."
last_state="low"
fi
elif [[ "$status" != "Discharging" && "$percentage" -ge "$FULL" ]]; then
if [[ "$last_state" != "full" ]]; then
notify normal "Battery Full" "$percentage% unplug charger."
last_state="full"
fi
else
last_state=""
fi
sleep "$INTERVAL"
done
'';
};
};
flake.homeModules.cbatticon = _: {
# don't works. some GTK error. I let it here if someday, someone is interest in this shit. # don't works. some GTK error. I let it here if someday, someone is interest in this shit.
# ChatGPT half baked a replacement that works on my system. # ChatGPT half baked a replacement that works on my system.
# see qtbatticon # see qtbatticon
+1 -1
View File
@@ -1,4 +1,4 @@
{ ...}: { _: {
flake.nixosModules.bluetooth = {pkgs, ...}: { flake.nixosModules.bluetooth = {pkgs, ...}: {
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.bootloader-laptop = { flake.nixosModules.bootloader-laptop = {
inputs, inputs,
pkgs, pkgs,
+3 -3
View File
@@ -1,11 +1,11 @@
{ ... }: { _: {
flake.nixosModules.disk = { pkgs, ... }: { flake.nixosModules.disk = {pkgs, ...}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
gnome-disk-utility gnome-disk-utility
udiskie udiskie
]; ];
}; };
flake.nixosModules.disk-laptop = { ... }: { flake.nixosModules.disk-laptop = _: {
# i found swap necessary when running nixpkgs review # i found swap necessary when running nixpkgs review
swapDevices = [ swapDevices = [
{ {
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.hardware-configuration-laptop = { flake.nixosModules.hardware-configuration-laptop = {
config, config,
lib, lib,
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.hardwareUtils-laptop = {pkgs, ...}: { flake.nixosModules.hardwareUtils-laptop = {pkgs, ...}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
# used for the framework 16 laptop # used for the framework 16 laptop
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.nixosModules.udev = { ... }: { flake.nixosModules.udev = _: {
# udev with only the necessary rules. See udev.nix to get all the rules # udev with only the necessary rules. See udev.nix to get all the rules
services.udev.extraRules = '' services.udev.extraRules = ''
# adapted from here https://wiki.nixos.org/wiki/Keychron_M6 # adapted from here https://wiki.nixos.org/wiki/Keychron_M6
+19 -17
View File
@@ -1,16 +1,19 @@
{ inputs, self, ...}: { {
inputs,
self,
...
}: {
flake.nixosConfigurations.laptop = inputs.nixpkgs.lib.nixosSystem { flake.nixosConfigurations.laptop = inputs.nixpkgs.lib.nixosSystem {
#system = "x86_64-linux"; #system = "x86_64-linux";
specialArgs = { specialArgs = {
inherit (self) pkgs-unstable; inherit (self) pkgs-unstable;
}; };
modules = with self.nixosModules; [ modules = with self.nixosModules; [
# important do not remove # important do not remove
home-manager-laptop home-manager-laptop
laptop laptop
{ nixpkgs.pkgs = self.pkgs; } {nixpkgs.pkgs = self.pkgs;}
# keep this alphabetically organised # keep this alphabetically organised
anki anki
audioAndMedia audioAndMedia
autoCleanup-laptop autoCleanup-laptop
@@ -44,7 +47,7 @@
user user
]; ];
}; };
flake.homeModules.laptop = { ... }: { flake.homeModules.laptop = {...}: {
imports = with self.homeModules; [ imports = with self.homeModules; [
inputs.caelestia-shell.homeManagerModules.default inputs.caelestia-shell.homeManagerModules.default
anki anki
@@ -67,13 +70,13 @@
ssh ssh
thunderbird thunderbird
tomasr tomasr
vivify vivify
zoxide zoxide
zsh zsh
zsh-laptop zsh-laptop
]; ];
}; };
flake.nixosModules.laptop = { ... }: { flake.nixosModules.laptop = _: {
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions # settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave # on your system were taken. Its perfectly fine and recommended to leave
@@ -81,25 +84,25 @@
# Before changing this value read the documentation for this option # Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "25.11"; # Did you read the comment? system.stateVersion = "25.11"; # Did you read the comment?
nix.settings.experimental-features = [ nix.settings.experimental-features = [
"nix-command" "nix-command"
"flakes" "flakes"
]; ];
}; };
flake.nixosModules.home-manager-laptop = { pkgs, ... }: { flake.nixosModules.home-manager-laptop = {pkgs, ...}: {
imports = [ imports = [
inputs.home-manager.nixosModules.default # import official home-manager NixOS module inputs.home-manager.nixosModules.default # import official home-manager NixOS module
]; ];
# Warning. Git is used in case I break everything up. It already saved me once # Warning. Git is used in case I break everything up. It already saved me once
environment.systemPackages = [ pkgs.git ]; environment.systemPackages = [pkgs.git];
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
extraSpecialArgs = { extraSpecialArgs = {
pkgs-unstable = self.pkgs-unstable; inherit (self) pkgs-unstable;
inherit self; inherit self;
}; };
}; };
@@ -108,8 +111,7 @@
}; };
home-manager.users.tomasr = self.homeModules.laptop; home-manager.users.tomasr = self.homeModules.laptop;
}; };
flake.homeModules.tomasr = { ... }: { flake.homeModules.tomasr = _: {
home.username = "tomasr"; home.username = "tomasr";
home.homeDirectory = "/home/tomasr"; home.homeDirectory = "/home/tomasr";
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.IO = {pkgs, ...}: { flake.nixosModules.IO = {pkgs, ...}: {
# Configure keymap in X11 # Configure keymap in X11
services.xserver.xkb = { services.xserver.xkb = {
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.homeModules.cursor = {pkgs, ...}: { flake.homeModules.cursor = {pkgs, ...}: {
home.pointerCursor = { home.pointerCursor = {
hyprcursor.enable = true; hyprcursor.enable = true;
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.homeModules.desktopEntries = { ... }: { flake.homeModules.desktopEntries = _: {
# for when the system lacks of a .desktop file # for when the system lacks of a .desktop file
home.file.".local/share/applications/org.quickshell.desktop" = { home.file.".local/share/applications/org.quickshell.desktop" = {
enable = true; enable = true;
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.nixosModules.fonts = { pkgs, ... }: { flake.nixosModules.fonts = {pkgs, ...}: {
# fonts # fonts
fonts.packages = with pkgs; [ fonts.packages = with pkgs; [
nerd-fonts._0xproto nerd-fonts._0xproto
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.printer = {pkgs, ...}: { flake.nixosModules.printer = {pkgs, ...}: {
#https://wiki.nixos.org/wiki/Printing #https://wiki.nixos.org/wiki/Printing
services.avahi = { services.avahi = {
+4 -4
View File
@@ -1,8 +1,8 @@
{ ... }: { _: {
flake.nixosModules.user = { flake.nixosModules.user = {
pkgs, pkgs,
pkgs-unstable, pkgs-unstable,
... ...
}: { }: {
services.dbus.enable = true; services.dbus.enable = true;
security.polkit.enable = true; security.polkit.enable = true;
+12 -12
View File
@@ -1,14 +1,14 @@
{ ... }: { _: {
perSystem = { pkgs, ... }: { perSystem = {pkgs, ...}: {
packages.custom-bottom = pkgs.writeShellApplication { packages.custom-bottom = pkgs.writeShellApplication {
name = "custom-bottom"; name = "custom-bottom";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
kitty kitty
bottom bottom
]; ];
text = '' text = ''
kitty --class "custom-bottom" -o font_size=10 --name "custom-bottom" -e btm --theme gruvbox --disable-click --disable_advanced_kill --enable_cache_memory -g -R -T kitty --class "custom-bottom" -o font_size=10 --name "custom-bottom" -e btm --theme gruvbox --disable-click --disable_advanced_kill --enable_cache_memory -g -R -T
''; '';
};
}; };
};
} }
+60 -61
View File
@@ -1,75 +1,74 @@
{ ... }: { _: {
perSystem = {pkgs, ...}: {
perSystem = { pkgs, ... }: { packages.custom-colorpicker = pkgs.writeShellApplication {
packages.custom-colorpicker = pkgs.writeShellApplication { # useless. Just use hyprpicker
# useless. Just use hyprpicker name = "custom-colorpicker";
name = "custom-colorpicker"; runtimeInputs = with pkgs; [
runtimeInputs = with pkgs; [ hyprpicker
hyprpicker libnotify
libnotify toybox
toybox wl-clipboard
wl-clipboard ];
]; text = ''
text = '' check() {
check() { command -v "$1" 1>/dev/null
command -v "$1" 1>/dev/null
}
notify() {
check notify-send && {
notify-send -a "Color Picker" "$@"
return
} }
echo "$@"
}
loc="$HOME/.cache/colorpicker" notify() {
[ -d "$loc" ] || mkdir -p "$loc" check notify-send && {
[ -f "$loc/colors" ] || touch "$loc/colors" notify-send -a "Color Picker" "$@"
return
}
echo "$@"
}
limit=10 loc="$HOME/.cache/colorpicker"
[ -d "$loc" ] || mkdir -p "$loc"
[ -f "$loc/colors" ] || touch "$loc/colors"
[[ $# -eq 1 && $1 = "-l" ]] && { limit=10
cat "$loc/colors"
exit
}
[[ $# -eq 1 && $1 = "-j" ]] && { [[ $# -eq 1 && $1 = "-l" ]] && {
text="$(head -n 1 "$loc/colors")" cat "$loc/colors"
exit
}
mapfile -t allcolors < <(tail -n +2 "$loc/colors") [[ $# -eq 1 && $1 = "-j" ]] && {
# allcolors=($(tail -n +2 "$loc/colors")) text="$(head -n 1 "$loc/colors")"
tooltip="<b> COLORS</b>\n\n"
tooltip+="-> <b>$text</b> <span color='$text'>󰸌</span> \n" mapfile -t allcolors < <(tail -n +2 "$loc/colors")
for i in "''${allcolors[@]}"; do # allcolors=($(tail -n +2 "$loc/colors"))
tooltip+=" <b>$i</b> <span color='$i'>󰸌</span> \n" tooltip="<b> COLORS</b>\n\n"
done
cat <<EOF tooltip+="-> <b>$text</b> <span color='$text'>󰸌</span> \n"
{ "text":"<span color='$text'>󰸌</span>", "tooltip":"$tooltip"} for i in "''${allcolors[@]}"; do
EOF tooltip+=" <b>$i</b> <span color='$i'>󰸌</span> \n"
done
exit cat <<EOF
} { "text":"<span color='$text'>󰸌</span>", "tooltip":"$tooltip"}
EOF
check hyprpicker || { exit
notify "hyprpicker is not installed" }
exit
}
killall -q hyprpicker
color=$(hyprpicker)
check wl-copy && { check hyprpicker || {
echo "$color" | sed -z 's/\n//g' | wl-copy notify "hyprpicker is not installed"
} exit
}
killall -q hyprpicker
color=$(hyprpicker)
prevColors=$(head -n $((limit - 1)) "$loc/colors") check wl-copy && {
echo "$color" >"$loc/colors" echo "$color" | sed -z 's/\n//g' | wl-copy
echo "$prevColors" >>"$loc/colors" }
sed -i '/^$/d' "$loc/colors"
pkill -RTMIN+1 waybar prevColors=$(head -n $((limit - 1)) "$loc/colors")
''; echo "$color" >"$loc/colors"
echo "$prevColors" >>"$loc/colors"
sed -i '/^$/d' "$loc/colors"
pkill -RTMIN+1 waybar
'';
};
}; };
};
} }
+82 -81
View File
@@ -1,83 +1,84 @@
{ ... }: { _: {
perSystem = { pkgs, ... }: { perSystem = {pkgs, ...}: {
packages.custom-cowsay = pkgs.writeShellApplication { packages.custom-cowsay = pkgs.writeShellApplication {
name = "custom-cowsay"; name = "custom-cowsay";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
cowsay cowsay
]; ];
text = '' text = ''
cows=("actually" "alpaca" "bud-frogs" "daemon" "elephant-in-snake" "moofasa" "skeleton" "three-eyes" "supermilker" "tux" "vader" "www") cows=("actually" "alpaca" "bud-frogs" "daemon" "elephant-in-snake" "moofasa" "skeleton" "three-eyes" "supermilker" "tux" "vader" "www")
declare -a sentences=( declare -a sentences=(
"Sharing knowledge is the most fundamental act of friendship. Because it is a way you can give something without loosing something. -Richard Stallman" "Sharing knowledge is the most fundamental act of friendship. Because it is a way you can give something without loosing something. -Richard Stallman"
"Free software' is a matter of liberty, not price. To understand the concept, you should think of 'free' as in 'free speech,' not as in 'free beer'. -Richard Stallman" "Free software' is a matter of liberty, not price. To understand the concept, you should think of 'free' as in 'free speech,' not as in 'free beer'. -Richard Stallman"
"Programming is not a science. Programming is a craft. -Richard Stallman" "Programming is not a science. Programming is a craft. -Richard Stallman"
"I did write some code in Java once, but that was the island in Indonesia. -Richard Stallman" "I did write some code in Java once, but that was the island in Indonesia. -Richard Stallman"
"Facebook is not your friend, it is a surveillance engine. -Richard Stallman" "Facebook is not your friend, it is a surveillance engine. -Richard Stallman"
"People said I should accept the world. Bullshit! I don't accept the world. -Richard Stallman" "People said I should accept the world. Bullshit! I don't accept the world. -Richard Stallman"
"You can use any editor you want, but remember that vi vi vi is the text editor of the beast. -Richard Stallman" "You can use any editor you want, but remember that vi vi vi is the text editor of the beast. -Richard Stallman"
"The idea of copyright did not exist in ancient times, when authors frequently copied other authors at length in works of non-fiction. This practice was useful, and is the only way many authors' works have survived even in part. -Richard Stallman" "The idea of copyright did not exist in ancient times, when authors frequently copied other authors at length in works of non-fiction. This practice was useful, and is the only way many authors' works have survived even in part. -Richard Stallman"
"Idiots can be defeated but they never admit it. -Richard Stallman" "Idiots can be defeated but they never admit it. -Richard Stallman"
"Open source is a development methodology; free software is a social movement. -Richard Stallman" "Open source is a development methodology; free software is a social movement. -Richard Stallman"
"People sometimes ask me if it is a sin in the Church of Emacs to use vi. Using a free version of vi is not a sin; it is a penance. So happy hacking. -Richard Stallman" "People sometimes ask me if it is a sin in the Church of Emacs to use vi. Using a free version of vi is not a sin; it is a penance. So happy hacking. -Richard Stallman"
"A computer is like air conditioning - it becomes useless when you open Windows -Linus Torvald" "A computer is like air conditioning - it becomes useless when you open Windows -Linus Torvald"
"Intelligence is the ability to avoid doing work, yet getting the work done. -Linus Torvald" "Intelligence is the ability to avoid doing work, yet getting the work done. -Linus Torvald"
"Software is like sex: It's better when it's free. -Linus Torvald" "Software is like sex: It's better when it's free. -Linus Torvald"
"All operating systems sucks, but Linux just sucks less -Linus Torvald" "All operating systems sucks, but Linux just sucks less -Linus Torvald"
"I like offending people, because I think people who get offended should be offended. -Linus Torval" "I like offending people, because I think people who get offended should be offended. -Linus Torval"
"Talk is cheap. Show me the code. -Linus Torval" "Talk is cheap. Show me the code. -Linus Torval"
"Most of the good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program. -Linus Torvald" "Most of the good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program. -Linus Torvald"
"Bad programmers worry about the code. Good programmers worry about data structures and their relationships. -Linus Torvald" "Bad programmers worry about the code. Good programmers worry about data structures and their relationships. -Linus Torvald"
"If Microsoft ever does applications for Linux it means I've won. -Linus Torvald" "If Microsoft ever does applications for Linux it means I've won. -Linus Torvald"
"Avoiding complexity reduces bugs. -Linus Torvald" "Avoiding complexity reduces bugs. -Linus Torvald"
"Backups are for wimps. Real men upload their data to an FTP site and have everyone else mirror it. -Linus Torvald" "Backups are for wimps. Real men upload their data to an FTP site and have everyone else mirror it. -Linus Torvald"
"Nobody actually creates perfect code the first time around, except me. But there's only one of me. -Linus Torvald" "Nobody actually creates perfect code the first time around, except me. But there's only one of me. -Linus Torvald"
"Microsoft isn't evil, they just make really crappy operating systems. -Linus Torvald" "Microsoft isn't evil, they just make really crappy operating systems. -Linus Torvald"
"When you say 'I wrote a program that crashed Windows,' people just stare at you blankly and say 'Hey, I got those with the system, for free.' -Linus Torval" "When you say 'I wrote a program that crashed Windows,' people just stare at you blankly and say 'Hey, I got those with the system, for free.' -Linus Torval"
"C++ is a horrible language. It's made more horrible by the fact that a lot of substandard programmers use it, to the point where it's much much easier to generate total and utter crap with it. -Linus Torvald" "C++ is a horrible language. It's made more horrible by the fact that a lot of substandard programmers use it, to the point where it's much much easier to generate total and utter crap with it. -Linus Torvald"
"If you think your users are idiots, only idiots will use it. -Linus Torvald" "If you think your users are idiots, only idiots will use it. -Linus Torvald"
"My name is Linus, and I am your God. -Linus Torvald" "My name is Linus, and I am your God. -Linus Torvald"
"An infinite number of monkeys typing into GNU emacs would never make a good program. -Linus Torvald" "An infinite number of monkeys typing into GNU emacs would never make a good program. -Linus Torvald"
"Object-oriented programming is an exceptionally bad idea which could only have originated in California. -Edgser Dijkstra" "Object-oriented programming is an exceptionally bad idea which could only have originated in California. -Edgser Dijkstra"
"If debugging is the process of removing software bugs, then programming must be the process of putting them in. -Edgser Dijkstra" "If debugging is the process of removing software bugs, then programming must be the process of putting them in. -Edgser Dijkstra"
"The art of programming is the art of organizing complexity. -Edgser Dijkstra" "The art of programming is the art of organizing complexity. -Edgser Dijkstra"
"Program testing can be used to show the presence of bugs, but never to show their absence! -Edgser Dijkstra" "Program testing can be used to show the presence of bugs, but never to show their absence! -Edgser Dijkstra"
"It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. -Edgser Dijkstra" "It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. -Edgser Dijkstra"
"The effort of using machines to mimic the human mind has always struck me as rather silly. I would rather use them to mimic something better. -Edgser Dijkstra" "The effort of using machines to mimic the human mind has always struck me as rather silly. I would rather use them to mimic something better. -Edgser Dijkstra"
"Computer science is no more about computers than astronomy is about telescopes. -Edgser Dijkstra" "Computer science is no more about computers than astronomy is about telescopes. -Edgser Dijkstra"
"Programming in Basic causes brain damage. -Edgser Dijkstra" "Programming in Basic causes brain damage. -Edgser Dijkstra"
"The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague. -Edgser Dijkstra" "The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague. -Edgser Dijkstra"
"If in physics there's something you don't understand, you can always hide behind the uncharted depths of nature. You can always blame God. You didn't make it so complex yourself. But if your program doesn't work, there is no one to hide behind. You cannot hide behind an obstinate nature. If it doesn't work, you've messed up. -Edgser Dijkstra" "If in physics there's something you don't understand, you can always hide behind the uncharted depths of nature. You can always blame God. You didn't make it so complex yourself. But if your program doesn't work, there is no one to hide behind. You cannot hide behind an obstinate nature. If it doesn't work, you've messed up. -Edgser Dijkstra"
"Teaching COBOL ought to be regarded as a criminal act. -Edgser Dijkstra" "Teaching COBOL ought to be regarded as a criminal act. -Edgser Dijkstra"
"If you want more effective programmers, you will discover that they should not waste their time debugging, they should not introduce the bugs to start with. -Edgser Dijkstra" "If you want more effective programmers, you will discover that they should not waste their time debugging, they should not introduce the bugs to start with. -Edgser Dijkstra"
"If we wish to count lines of code, we should not regard them as 'lines produced' but as 'lines spent.' -Edgser Dijkstra" "If we wish to count lines of code, we should not regard them as 'lines produced' but as 'lines spent.' -Edgser Dijkstra"
"In almost every computation a great variety of arrangements for the succession of the processes is possible, and various considerations must influence the selections amongst them for the purposes of a calculating engine. One essential object is to choose that arrangement which shall tend to reduce to a minimum the time necessary for completing the calculation. -Ada Lovelace" "In almost every computation a great variety of arrangements for the succession of the processes is possible, and various considerations must influence the selections amongst them for the purposes of a calculating engine. One essential object is to choose that arrangement which shall tend to reduce to a minimum the time necessary for completing the calculation. -Ada Lovelace"
"Im making an operating system myself, so I know what its like to be God. -Terry Davis" "Im making an operating system myself, so I know what its like to be God. -Terry Davis"
"Im schizophrenic and so am I. -Terry Davis" "Im schizophrenic and so am I. -Terry Davis"
"If I was a dog, I would bark. -Terry Davis" "If I was a dog, I would bark. -Terry Davis"
"Who has a better kernel? Debian? No. -Terry Davis" "Who has a better kernel? Debian? No. -Terry Davis"
"Computers are fast, programmers keep it slow. -A random Reddit user" "Computers are fast, programmers keep it slow. -A random Reddit user"
"Before software can be reusable it first has to be usable. -Ralph Johnson" "Before software can be reusable it first has to be usable. -Ralph Johnson"
"The best thing about a Boolean is that even if you are wrong, you're only off by a bit. -Anonymous" "The best thing about a Boolean is that even if you are wrong, you're only off by a bit. -Anonymous"
"It's not a bug, it's a feature. -Programmers" "It's not a bug, it's a feature. -Programmers"
"NVIDIA, fuck you -Linus Torvald" "NVIDIA, fuck you -Linus Torvald"
) )
while true while true
do do
echo echo
echo echo
echo echo
echo echo
echo echo
echo echo
SIndex=$(( RANDOM % ''${#sentences[@]} )) SIndex=$(( RANDOM % ''${#sentences[@]} ))
index=$(( RANDOM % ''${#cows[@]} )) index=$(( RANDOM % ''${#cows[@]} ))
#cow="/usr/share/cowsay/cows/''${cows[index]}.cow" #cow="/usr/share/cowsay/cows/''${cows[index]}.cow"
cowsay -f "''${cows[index]}" "''${sentences[SIndex]}" cowsay -f "''${cows[index]}" "''${sentences[SIndex]}"
sleep 10 sleep 10
clear clear
done done
''; '';
# reduce terminal size for actually # reduce terminal size for actually
};
}; };
};} }
+28 -28
View File
@@ -1,34 +1,34 @@
{ ... }: { _: {
perSystem = { pkgs, ... }: { perSystem = {pkgs, ...}: {
# fzf librewolf profile selector # fzf librewolf profile selector
packages.custom-librewolfprofiles = pkgs.writeShellApplication { packages.custom-librewolfprofiles = pkgs.writeShellApplication {
name = "custom-librewolfprofiles"; name = "custom-librewolfprofiles";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
zsh zsh
fzf fzf
]; ];
text = '' text = ''
# List of profiles # List of profiles
profiles=("work" "other" "private window") profiles=("work" "other" "private window")
# Use fzf to select # Use fzf to select
selected=$(printf "%s\n" "''${profiles[@]}" | fzf --height 6 --reverse --prompt="Select LibreWolf profile:") selected=$(printf "%s\n" "''${profiles[@]}" | fzf --height 6 --reverse --prompt="Select LibreWolf profile:")
# If user cancels, exit # If user cancels, exit
[[ -z "$selected" ]] && exit 0 [[ -z "$selected" ]] && exit 0
# Launch LibreWolf detached, keeping environment # Launch LibreWolf detached, keeping environment
if [[ "$selected" == "private window" ]]; then if [[ "$selected" == "private window" ]]; then
setsid librewolf --private-window --no-remote >/dev/null 2>&1 & setsid librewolf --private-window --no-remote >/dev/null 2>&1 &
pkill -f "kitty.*Select LibreWolf profile" pkill -f "kitty.*Select LibreWolf profile"
else else
setsid librewolf -P "$selected" --no-remote >/dev/null 2>&1 & setsid librewolf -P "$selected" --no-remote >/dev/null 2>&1 &
pkill -f "kitty.*Select LibreWolf profile" pkill -f "kitty.*Select LibreWolf profile"
fi fi
# Exit the kitty terminal after selection # Exit the kitty terminal after selection
exit exit
''; '';
}; };
}; };
} }
+26 -25
View File
@@ -1,30 +1,31 @@
{ ... }: _: {
{ perSystem = {pkgs, ...}: {
perSystem = { pkgs, ... }: { # counts how many syllabes in a string.
# counts how many syllabes in a string. # not perfect. Does not handle silents e in french
# not perfect. Does not handle silents e in french # but that's what I use for writing poetry
# but that's what I use for writing poetry packages.custom-syllabes =
packages.custom-syllabes = pkgs.writers.writePython3Bin "custom-syllabes" { pkgs.writers.writePython3Bin "custom-syllabes" {
libraries = with pkgs; [ libraries = with pkgs; [
python3Packages.pyphen python3Packages.pyphen
]; ];
} '' } ''
import sys import sys
import pyphen import pyphen
dic = pyphen.Pyphen(lang="fr") dic = pyphen.Pyphen(lang="fr")
text = sys.stdin.read().strip() text = sys.stdin.read().strip()
chunks = [] chunks = []
total = 0 total = 0
for w in text.split(): for w in text.split():
hyphenated = dic.inserted(w) hyphenated = dic.inserted(w)
parts = hyphenated.split("-") parts = hyphenated.split("-")
chunks.append("/".join(parts)) chunks.append("/".join(parts))
total += len(parts) total += len(parts)
print(f"{total} ({'/'.join(chunks)})") print(f"{total} ({'/'.join(chunks)})")
''; '';
};} };
}
+12 -13
View File
@@ -1,15 +1,14 @@
{ ... }: _: {
{ perSystem = {pkgs, ...}: {
perSystem = { pkgs, ...}: { packages.custom-tomato = pkgs.writeShellApplication {
packages.custom-tomato = pkgs.writeShellApplication { name = "custom-tomato";
name = "custom-tomato"; runtimeInputs = with pkgs; [
runtimeInputs = with pkgs; [ kitty
kitty tomato-c
tomato-c ];
]; text = ''
text = '' kitty --class "custom-pomodoro" --name "custom-pomodoro" -e tomato
kitty --class "custom-pomodoro" --name "custom-pomodoro" -e tomato '';
''; };
}; };
};
} }
+15 -15
View File
@@ -1,16 +1,16 @@
{ ... }: _: {
{ perSystem = {pkgs, ...}: {
perSystem = { pkgs, ... }: { packages.custom-weather = pkgs.writeShellApplication {
packages.custom-weather = pkgs.writeShellApplication { name = "custom-weather";
name = "custom-weather"; runtimeInputs = with pkgs; [
runtimeInputs = with pkgs; [ curl
curl ];
]; text = ''
text = '' while true; do
while true; do curl "https://wttr.in/?0&d&q&F&lang=fr"
curl "https://wttr.in/?0&d&q&F&lang=fr" sleep 7200
sleep 7200 done
done '';
''; };
}; };
};} }
+35 -35
View File
@@ -1,41 +1,41 @@
{ self, ... }: { {self, ...}: {
perSystem = { pkgs, ...}: perSystem = {pkgs, ...}: let
let inherit (self) pkgs-unstable;
pkgs-unstable = self.pkgs-unstable; in {
in # perSystem doesnt like pkgs-unstable we must input it globally
{ # perSystem doesnt like pkgs-unstable we must input it globally packages.dejaManuallyDerived = pkgs-unstable.buildGoModule (finalAttrs: {
packages.dejaManuallyDerived = pkgs-unstable.buildGoModule (finalAttrs: { pname = "deja";
pname = "deja"; version = "0.2.6";
version = "0.2.6"; __structuredAttrs = true;
__structuredAttrs = true; src = pkgs.fetchFromGitHub {
src = pkgs.fetchFromGitHub { owner = "Giammarco-Ferranti";
owner = "Giammarco-Ferranti"; repo = "deja";
repo = "deja"; tag = "v${finalAttrs.version}";
tag = "v${finalAttrs.version}"; hash = "sha256-xxbClKhhSwo+jUjAZ2gS4yOS5sSI76dfPpDzA3qdV18=";
hash = "sha256-xxbClKhhSwo+jUjAZ2gS4yOS5sSI76dfPpDzA3qdV18="; };
};
vendorHash = "sha256-KmLdMK94cGOXMPJwWS6NgLB5OiNmJbszHdnLzauqJm8="; vendorHash = "sha256-KmLdMK94cGOXMPJwWS6NgLB5OiNmJbszHdnLzauqJm8=";
ldflags = [ ldflags = [
"-s" "-s"
"-w" "-w"
"-X main.version=${finalAttrs.version}" "-X main.version=${finalAttrs.version}"
]; ];
doCheck = true; doCheck = true;
nativeCheckInputs = [pkgs.versionCheckHook]; nativeCheckInputs = [pkgs.versionCheckHook];
passthru.updateScript = pkgs.nix-update-script {}; passthru.updateScript = pkgs.nix-update-script {};
meta = { meta = {
description = "Predictive inline shell autosuggestions for zsh"; description = "Predictive inline shell autosuggestions for zsh";
homepage = "https://github.com/Giammarco-Ferranti/deja"; homepage = "https://github.com/Giammarco-Ferranti/deja";
license = pkgs.lib.licenses.mit; license = pkgs.lib.licenses.mit;
platforms = pkgs.lib.platforms.unix; platforms = pkgs.lib.platforms.unix;
maintainers = with pkgs.lib.maintainers; [tomasrivera]; maintainers = with pkgs.lib.maintainers; [tomasrivera];
mainProgram = "deja"; mainProgram = "deja";
}; };
}); });
};} };
}
+37 -32
View File
@@ -1,39 +1,44 @@
{ ... }: { _: {
perSystem = { pkgs, pkgs-unstable, ... }: { perSystem = {
packages.sbb-tuiManuallyDerived = pkgs-unstable.buildGoModule (finalAttrs: { pkgs,
pname = "sbb-tui"; pkgs-unstable,
version = "1.14.2"; ...
__structuredAttrs = true; }: {
src = pkgs.fetchFromGitHub { packages.sbb-tuiManuallyDerived = pkgs-unstable.buildGoModule (finalAttrs: {
owner = "Necrom4"; pname = "sbb-tui";
repo = "sbb-tui"; version = "1.14.2";
tag = "v${finalAttrs.version}"; __structuredAttrs = true;
hash = pkgs.lib.fakeHash; src = pkgs.fetchFromGitHub {
}; owner = "Necrom4";
repo = "sbb-tui";
tag = "v${finalAttrs.version}";
hash = pkgs.lib.fakeHash;
};
vendorHash = "sha256-K4DOu3rfSlKAa5JNKCzWWpnWZlXXxtN5Po7p1Spqe1w="; vendorHash = "sha256-K4DOu3rfSlKAa5JNKCzWWpnWZlXXxtN5Po7p1Spqe1w=";
ldflags = [ ldflags = [
"-s" "-s"
"-w" "-w"
"-X main.version=${finalAttrs.version}" "-X main.version=${finalAttrs.version}"
]; ];
allowGoReference = true; allowGoReference = true;
doCheck = true; doCheck = true;
nativeCheckInputs = [pkgs.versionCheckHook]; nativeCheckInputs = [pkgs.versionCheckHook];
passthru.updateScript = pkgs.nix-update-script {}; passthru.updateScript = pkgs.nix-update-script {};
meta = { meta = {
description = "TUI client for Switzerland's public transport timetables, inspired by SBB/CFF/FFS app"; description = "TUI client for Switzerland's public transport timetables, inspired by SBB/CFF/FFS app";
homepage = "https://github.com/Necrom4/sbb-tui"; homepage = "https://github.com/Necrom4/sbb-tui";
license = pkgs.lib.licenses.mit; license = pkgs.lib.licenses.mit;
platforms = pkgs.lib.platforms.unix; platforms = pkgs.lib.platforms.unix;
maintainers = with pkgs.lib.maintainers; [tomasrivera]; maintainers = with pkgs.lib.maintainers; [tomasrivera];
mainProgram = "sbb-tui"; mainProgram = "sbb-tui";
}; };
}); });
}; } };
}
+72 -67
View File
@@ -1,78 +1,83 @@
{ ... }: { _: {
perSystem = { pkgs, nodejs, ... }: { perSystem = {
packages.vivifyManuallyDerived = pkgs.stdenv.mkDerivation (finalAttrs: { pkgs,
pname = "vivify"; nodejs,
version = "0.14.0"; ...
}: {
packages.vivifyManuallyDerived = pkgs.stdenv.mkDerivation (finalAttrs: {
pname = "vivify";
version = "0.14.0";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "jannis-baum"; owner = "jannis-baum";
repo = "Vivify"; repo = "Vivify";
tag = "v${finalAttrs.version}"; tag = "v${finalAttrs.version}";
hash = "sha256-CszMG+c0bNHfXWqcI3b4iGpeFJ+FmzHDzxflPS+wEe0="; hash = "sha256-CszMG+c0bNHfXWqcI3b4iGpeFJ+FmzHDzxflPS+wEe0=";
}; };
yarnOfflineCache = pkgs.fetchYarnDeps { yarnOfflineCache = pkgs.fetchYarnDeps {
yarnLock = "${finalAttrs.src}/yarn.lock"; yarnLock = "${finalAttrs.src}/yarn.lock";
hash = "sha256-svgEanFiBSQn0TdTuB0CnLR71lkANABEaDiKB+Vc0Rc="; hash = "sha256-svgEanFiBSQn0TdTuB0CnLR71lkANABEaDiKB+Vc0Rc=";
}; };
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
yarn install yarn install
substituteInPlace node_modules/.bin/tsc \ substituteInPlace node_modules/.bin/tsc \
--replace-fail '/usr/bin/env node' '${pkgs.lib.getExe nodejs}' --replace-fail '/usr/bin/env node' '${pkgs.lib.getExe nodejs}'
substituteInPlace node_modules/.bin/webpack \ substituteInPlace node_modules/.bin/webpack \
--replace-fail '/usr/bin/env node' '${pkgs.lib.getExe nodejs}' --replace-fail '/usr/bin/env node' '${pkgs.lib.getExe nodejs}'
substituteInPlace node_modules/.bin/postject \ substituteInPlace node_modules/.bin/postject \
--replace-fail '/usr/bin/env node' '${pkgs.lib.getExe nodejs}' --replace-fail '/usr/bin/env node' '${pkgs.lib.getExe nodejs}'
make VIV_VERSION=${finalAttrs.version} linux make VIV_VERSION=${finalAttrs.version} linux
mkdir -p $out/bin mkdir -p $out/bin
install -Dm755 ./build/linux/viv $out/bin/viv install -Dm755 ./build/linux/viv $out/bin/viv
install -Dm755 ./build/linux/vivify-server $out/bin/vivify-server install -Dm755 ./build/linux/vivify-server $out/bin/vivify-server
wrapProgram $out/bin/viv \ wrapProgram $out/bin/viv \
--prefix PATH : ${ --prefix PATH : ${
pkgs.lib.makeBinPath [ pkgs.lib.makeBinPath [
pkgs.nodejs pkgs.nodejs
pkgs.file pkgs.file
] ]
} }
'';
nativeBuildInputs = with pkgs; [
yarnConfigHook
npmHooks.npmInstallHook
zip
nodejs
file
];
# Stripping 'unneeded symbols' causes vivify-server executable to break
# (segmentation fault)
dontStrip = true;
passthru.updateScript = pkgs.nix-update-script {};
meta = {
description = "Live Markdown viewer";
longDescription = ''
Vivify brings your files to life in the browser!
Vivify is primarily made to render Markdown and Jupyter Notebooks, but will also
serve as a directory browser and let you view code files with syntax highlighting.
''; '';
homepage = "https://github.com/jannis-baum/Vivify";
changelog = "https://github.com/jannis-baum/Vivify/releases/tag/v${finalAttrs.src.tag}"; nativeBuildInputs = with pkgs; [
license = pkgs.lib.licenses.gpl3; yarnConfigHook
maintainers = with pkgs.lib.maintainers; [skohtv]; npmHooks.npmInstallHook
platforms = pkgs.lib.platforms.linux; zip
mainProgram = "viv";
}; nodejs
}); file
};} ];
# Stripping 'unneeded symbols' causes vivify-server executable to break
# (segmentation fault)
dontStrip = true;
passthru.updateScript = pkgs.nix-update-script {};
meta = {
description = "Live Markdown viewer";
longDescription = ''
Vivify brings your files to life in the browser!
Vivify is primarily made to render Markdown and Jupyter Notebooks, but will also
serve as a directory browser and let you view code files with syntax highlighting.
'';
homepage = "https://github.com/jannis-baum/Vivify";
changelog = "https://github.com/jannis-baum/Vivify/releases/tag/v${finalAttrs.src.tag}";
license = pkgs.lib.licenses.gpl3;
maintainers = with pkgs.lib.maintainers; [skohtv];
platforms = pkgs.lib.platforms.linux;
mainProgram = "viv";
};
});
};
}
+1 -1
View File
@@ -1,5 +1,5 @@
# see https://www.vimjoyer.com/nix/dendritic-home-manager # see https://www.vimjoyer.com/nix/dendritic-home-manager
{ inputs, ... }: { {inputs, ...}: {
imports = [ imports = [
# adds home-manager options to flake-parts # adds home-manager options to flake-parts
inputs.home-manager.flakeModules.home-manager inputs.home-manager.flakeModules.home-manager
+4 -3
View File
@@ -1,4 +1,4 @@
{ self, ... }: { {self, ...}: {
flake.nixosModules.audioAndMedia = {pkgs, ...}: { flake.nixosModules.audioAndMedia = {pkgs, ...}: {
# Enable sound with pipewire. # Enable sound with pipewire.
services.pulseaudio.enable = false; services.pulseaudio.enable = false;
@@ -41,7 +41,7 @@
source = "${pkgs.gpu-screen-recorder}/bin/gsr-kms-server"; source = "${pkgs.gpu-screen-recorder}/bin/gsr-kms-server";
}; };
}; };
perSystem = { pkgs, ...}: { perSystem = {pkgs, ...}: {
packages.custom-changeAudioOutput = pkgs.writeShellApplication { packages.custom-changeAudioOutput = pkgs.writeShellApplication {
name = "custom-changeAudioOutput"; name = "custom-changeAudioOutput";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
@@ -56,5 +56,6 @@
fi fi
pkill -f "kitty.*Select audio output" pkill -f "kitty.*Select audio output"
''; '';
};
}; };
};} }
+9 -4
View File
@@ -1,5 +1,9 @@
{ self, ... }: { {self, ...}: {
flake.nixosModules.autoCleanup-laptop = {pkgs, pkgs-unstable, ...}: { flake.nixosModules.autoCleanup-laptop = {
pkgs,
pkgs-unstable,
...
}: {
# Ensure your script is available system-wide # Ensure your script is available system-wide
environment.systemPackages = [ environment.systemPackages = [
self.packages.${pkgs.system}.custom-cleanNix-laptop self.packages.${pkgs.system}.custom-cleanNix-laptop
@@ -45,7 +49,7 @@
}; };
}; };
}; };
perSystem = { pkgs, ... }: { perSystem = {pkgs, ...}: {
packages.custom-cleanNix-laptop = pkgs.writeShellApplication { packages.custom-cleanNix-laptop = pkgs.writeShellApplication {
name = "custom-cleanNix"; name = "custom-cleanNix";
@@ -116,4 +120,5 @@
rm -f "$ERROR_FILE" rm -f "$ERROR_FILE"
''; '';
}; };
};} };
}
+3 -2
View File
@@ -1,4 +1,4 @@
{ self, ... }: { {self, ...}: {
flake.nixosModules.autoUpdate-laptop = {pkgs, ...}: { flake.nixosModules.autoUpdate-laptop = {pkgs, ...}: {
# Ensure your script is available system-wide # Ensure your script is available system-wide
environment.systemPackages = [ environment.systemPackages = [
@@ -106,4 +106,5 @@
rm -f "$ERROR_FILE" rm -f "$ERROR_FILE"
''; '';
}; };
};} };
}
@@ -1,5 +1,5 @@
{ self, ...}: { {self, ...}: {
flake.nixosModules.notifications = { pkgs, ... }: { flake.nixosModules.notifications = {pkgs, ...}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
libnotify # Library that sends desktop notifications to a notification daemon libnotify # Library that sends desktop notifications to a notification daemon
socat # Utility for bidirectional data transfer between two independent data channels (used to communicate between hyprland and swww to change wallpapers dinamically) socat # Utility for bidirectional data transfer between two independent data channels (used to communicate between hyprland and swww to change wallpapers dinamically)
@@ -13,7 +13,7 @@
self.packages.${pkgs.system}.custom-checkKdrive # check if kdrive is set up with rclone self.packages.${pkgs.system}.custom-checkKdrive # check if kdrive is set up with rclone
]; ];
}; };
perSystem = { pkgs, ...}: { perSystem = {pkgs, ...}: {
packages.custom-checkMatrix = pkgs.writeShellApplication { packages.custom-checkMatrix = pkgs.writeShellApplication {
name = "custom-checkMatrix"; name = "custom-checkMatrix";
@@ -32,30 +32,31 @@
"You are not logged in as @totorile1:unredacted.org\nLog:\n$current" "You are not logged in as @totorile1:unredacted.org\nLog:\n$current"
fi fi
''; '';
}; };
packages.custom-gitnotify = pkgs.writeShellApplication { packages.custom-gitnotify = pkgs.writeShellApplication {
name = "custom-gitnotify"; name = "custom-gitnotify";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
git git
libnotify libnotify
]; ];
text = '' text = ''
# Check if git is installed # Check if git is installed
if ! command -v git >/dev/null 2>&1; then if ! command -v git >/dev/null 2>&1; then
exit 0 exit 0
fi fi
NAME=$(git config --global user.name) NAME=$(git config --global user.name)
EMAIL=$(git config --global user.email) EMAIL=$(git config --global user.email)
if [[ -z "$NAME" || -z "$EMAIL" ]]; then if [[ -z "$NAME" || -z "$EMAIL" ]]; then
notify-send \ notify-send \
"Git not configured" \ "Git not configured" \
"Set your identity\n or remove this warning by removing the custom-gitnotify line in\n ~/nixos/modules/applications/hyprland.nix" "Set your identity\n or remove this warning by removing the custom-gitnotify line in\n ~/nixos/modules/applications/hyprland.nix"
matrix-commander-rs --verbose -m "Git not configured.<br>Set your identify or remove this warning by removing the custom-gitnotify in ~/nixos/modules/applications/hyprland.nix<br><a href=\"https://matrix.to/#/@notificationbot_0000:matrix.org\">@notificationbot_0000</a>" \ matrix-commander-rs --verbose -m "Git not configured.<br>Set your identify or remove this warning by removing the custom-gitnotify in ~/nixos/modules/applications/hyprland.nix<br><a href=\"https://matrix.to/#/@notificationbot_0000:matrix.org\">@notificationbot_0000</a>" \
--html \ --html \
-r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU" -r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU"
fi fi
''; '';
};
}; };
};} }
+6 -3
View File
@@ -1,6 +1,9 @@
{ ... }: _: {
{ flake.nixosModules.development = {
flake.nixosModules.development = { pkgs, pkgs-unstable, ... }: { pkgs,
pkgs-unstable,
...
}: {
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
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
gcc gcc
+37 -34
View File
@@ -1,5 +1,7 @@
{ self, ... }: let cacheTime = "10"; in { {self, ...}: let
flake.nixosModules.documentation = { pkgs, ... }: { cacheTime = "10";
in {
flake.nixosModules.documentation = {pkgs, ...}: {
# unfortunatly this adds a lot of computation when nix rebuilds # unfortunatly this adds a lot of computation when nix rebuilds
documentation.man.generateCaches = true; # used for the man script documentation.man.generateCaches = true; # used for the man script
@@ -14,7 +16,7 @@
self.packages.${pkgs.system}.custom-manix self.packages.${pkgs.system}.custom-manix
]; ];
}; };
perSystem = { pkgs, ... }: { perSystem = {pkgs, ...}: {
packages.custom-man = pkgs.writeShellApplication { packages.custom-man = pkgs.writeShellApplication {
name = "custom-man"; name = "custom-man";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
@@ -52,41 +54,42 @@
| xargs man | xargs man
''; '';
}; };
packages.custom-manix = pkgs.writeShellApplication { packages.custom-manix = pkgs.writeShellApplication {
name = "custom-manix"; name = "custom-manix";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
manix manix
ripgrep ripgrep
fzf fzf
]; ];
text = '' text = ''
CACHE_DIR="''${XDG_CACHE_HOME:-$HOME/.cache}" CACHE_DIR="''${XDG_CACHE_HOME:-$HOME/.cache}"
CACHE_FILE="$CACHE_DIR/custom-manix-options.txt" CACHE_FILE="$CACHE_DIR/custom-manix-options.txt"
mkdir -p "$CACHE_DIR" mkdir -p "$CACHE_DIR"
REGENERATE=0 REGENERATE=0
# check if -r flag was passed # check if -r flag was passed
if [ "''${1:-}" = "-r" ]; then if [ "''${1:-}" = "-r" ]; then
REGENERATE=1 REGENERATE=1
fi fi
# regenerate if file does not exist or is older than cacheTime days # regenerate if file does not exist or is older than cacheTime days
if [ ! -f "$CACHE_FILE" ] || [ "$(find "$CACHE_FILE" -mtime +${cacheTime} -print)" ]; then if [ ! -f "$CACHE_FILE" ] || [ "$(find "$CACHE_FILE" -mtime +${cacheTime} -print)" ]; then
REGENERATE=1 REGENERATE=1
fi fi
if [ $REGENERATE -eq 1 ]; then if [ $REGENERATE -eq 1 ]; then
echo "(Re)building custom-manix cache..." echo "(Re)building custom-manix cache..."
mkdir -p "$(dirname "$CACHE_FILE")" mkdir -p "$(dirname "$CACHE_FILE")"
manix "" | rg -N '^(?:\x1b\[[0-9;]*m)*# ' | sed 's/\x1b\[[0-9;]*m//g; s/^# //' | rg -Nv '^(<|.*https?://)' > "$CACHE_FILE" manix "" | rg -N '^(?:\x1b\[[0-9;]*m)*# ' | sed 's/\x1b\[[0-9;]*m//g; s/^# //' | rg -Nv '^(<|.*https?://)' > "$CACHE_FILE"
fi fi
# read from cache and pipe into fzf # read from cache and pipe into fzf
cat "$CACHE_FILE" \ cat "$CACHE_FILE" \
| fzf --preview "manix {}" \ | fzf --preview "manix {}" \
| xargs manix | xargs manix
''; '';
};
}; };
};} }
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.latex = {pkgs, ...}: { flake.nixosModules.latex = {pkgs, ...}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
texlab texlab
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.networking = {pkgs, ...}: { flake.nixosModules.networking = {pkgs, ...}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
wget wget
+247 -247
View File
@@ -1,12 +1,11 @@
{ inputs, ... }: {inputs, ...}: {
{ flake.nixosModules.nixUtils-laptop = _: {
flake.nixosModules.nixUtils-laptop = { ... }: {
# nixpkgs-review crashed my laptop multiple times. We must reduce how much ressources it can take. # nixpkgs-review crashed my laptop multiple times. We must reduce how much ressources it can take.
# for reference, my laptop is a 12 core ryzen 7 # for reference, my laptop is a 12 core ryzen 7
nix.settings.max-jobs = 6; nix.settings.max-jobs = 6;
nix.settings.cores = 6; nix.settings.cores = 6;
}; };
flake.nixosModules.nixUtils = { pkgs-unstable, ... }: { flake.nixosModules.nixUtils = {pkgs-unstable, ...}: {
# Garbage collector of generations # Garbage collector of generations
nix.gc = { nix.gc = {
automatic = true; automatic = true;
@@ -35,267 +34,268 @@
statix statix
]; ];
}; };
perSystem = { pkgs, ... }: { perSystem = {pkgs, ...}: {
# https://gist.github.com/MaxwellDupre/3077cd229490cf93ecab08ef2a79c852 # https://gist.github.com/MaxwellDupre/3077cd229490cf93ecab08ef2a79c852
# better garbage collector # better garbage collector
packages.custom-trimmer = pkgs.writeShellApplication { packages.custom-trimmer = pkgs.writeShellApplication {
name = "custom-trimmer"; name = "custom-trimmer";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
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;
fi fi
if [ "$1" = "--help" ]; then if [ "$1" = "--help" ]; then
usage usage
exit 2; exit 2;
fi fi
printf "Dont recognise your option exiting..\n\n" printf "Dont recognise your option exiting..\n\n"
usage usage
exit 3; exit 3;
elif [ $# -eq 0 ]; then # print the defaults elif [ $# -eq 0 ]; then # print the defaults
printf "The current defaults are:\n Keep-Gens=%d Keep-Days=%d \n\n" "$keepGensDef" "$keepDaysDef" printf "The current defaults are:\n Keep-Gens=%d Keep-Days=%d \n\n" "$keepGensDef" "$keepDaysDef"
read -r -p "Keep these defaults? (y/n):" answer read -r -p "Keep these defaults? (y/n):" answer
case "$answer" in case "$answer" in
[yY1] ) [yY1] )
printf "Using defaults..\n" printf "Using defaults..\n"
;; ;;
[nN0] ) printf "ok, doing nothing, exiting..\n" [nN0] ) printf "ok, doing nothing, exiting..\n"
exit 6; exit 6;
;; ;;
* ) printf "%b" "Doing nothing, exiting.." * ) printf "%b" "Doing nothing, exiting.."
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
profile="/nix/var/nix/profiles/default" profile="/nix/var/nix/profiles/default"
else 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
printf "%s" "$answer" printf "%s" "$answer"
case "$answer" in case "$answer" in
[yY1] ) [yY1] )
printf "ok, continuing..\n" printf "ok, continuing..\n"
;; ;;
[nN0] ) [nN0] )
printf "ok, doing nothing, exiting..\n" printf "ok, doing nothing, exiting..\n"
exit 6; exit 6;
;; ;;
* ) * )
printf "%b" "Doing nothing, exiting.." printf "%b" "Doing nothing, exiting.."
exit 7; exit 7;
;; ;;
esac esac
fi fi
if [ "$2" -lt 0 ]; then if [ "$2" -lt 0 ]; then
printf "using negative days number not recommended. Setting to min=0\n" printf "using negative days number not recommended. Setting to min=0\n"
read -r -p "is that ok? (y/n): " answer read -r -p "is that ok? (y/n): " answer
case "$answer" in case "$answer" in
[yY1] ) [yY1] )
printf "ok, continuing..\n" printf "ok, continuing..\n"
;; ;;
[nN0] ) [nN0] )
printf "ok, doing nothing, exiting..\n" printf "ok, doing nothing, exiting..\n"
exit 6; exit 6;
;; ;;
* ) * )
printf "%b" "Doing nothing, exiting.." printf "%b" "Doing nothing, exiting.."
exit 7; exit 7;
;; ;;
esac esac
fi fi
keepGens=$1; keepDays=$2; keepGens=$1; keepDays=$2;
(( keepGens < 1 )) && keepGens=1 (( keepGens < 1 )) && keepGens=1
(( keepDays < 0 )) && keepDays=0 (( keepDays < 0 )) && keepDays=0
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
if [[ $3 == "user" ]] || [[ $3 == "default" ]]; then if [[ $3 == "user" ]] || [[ $3 == "default" ]]; then
profile=$(readlink /home/"$USER"/.nix-profile) profile=$(readlink /home/"$USER"/.nix-profile)
elif [[ $3 == "home-manager" ]]; then elif [[ $3 == "home-manager" ]]; then
# home-manager defaults to $XDG_STATE_HOME; otherwise, use # home-manager defaults to $XDG_STATE_HOME; otherwise, use
# `home-manager generations` and `nix-store --query --roots # `home-manager generations` and `nix-store --query --roots
# /nix/store/...` to figure out what reference is keeping the old # /nix/store/...` to figure out what reference is keeping the old
# generations alive. # generations alive.
profile="''${XDG_STATE_HOME:-$HOME/.local/state}/nix/profiles/home-manager" profile="''${XDG_STATE_HOME:-$HOME/.local/state}/nix/profiles/home-manager"
elif [[ $3 == "channels" ]]; then elif [[ $3 == "channels" ]]; then
profile="/nix/var/nix/profiles/per-user/$USER/channels" profile="/nix/var/nix/profiles/per-user/$USER/channels"
else else
printf "\nError: Do not understand your third argument. Should be one of: (user / home-manager/ channels)\n\n" printf "\nError: Do not understand your third argument. Should be one of: (user / home-manager/ channels)\n\n"
usage usage
exit 3 exit 3
fi fi
else else
if [[ $3 == "system" ]]; then if [[ $3 == "system" ]]; then
profile="/nix/var/nix/profiles/system" profile="/nix/var/nix/profiles/system"
elif [[ $3 == "user" ]] || [[ $3 == "default" ]]; then elif [[ $3 == "user" ]] || [[ $3 == "default" ]]; then
profile="/nix/var/nix/profiles/default" profile="/nix/var/nix/profiles/default"
else else
printf "\nError: Do not understand your third argument. Should be one of: (user / system)\n\n" printf "\nError: Do not understand your third argument. Should be one of: (user / system)\n\n"
usage usage
exit 3 exit 3
fi fi
fi fi
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
read -r -p "$prompt" answer read -r -p "$prompt" answer
[ -z "$answer" ] && answer="$default" [ -z "$answer" ] && answer="$default"
case "$answer" in case "$answer" in
[yY1] ) #printf "answered yes!\n" [yY1] ) #printf "answered yes!\n"
nix-env --delete-generations -p "$profile" "''${!gens[@]}" nix-env --delete-generations -p "$profile" "''${!gens[@]}"
exit 0 exit 0
;; ;;
[nN0] ) printf "Ok doing nothing exiting..\n" [nN0] ) printf "Ok doing nothing exiting..\n"
exit 6; exit 6;
;; ;;
* ) printf "%b" "Unexpected answer '$answer'!" >&2 * ) printf "%b" "Unexpected answer '$answer'!" >&2
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]}
if [[ "$i" =~ current ]]; then if [[ "$i" =~ current ]]; then
currentGen=$genNumber currentGen=$genNumber
printf "%-30s %s\n" "current generation:" "$currentGen" printf "%-30s %s\n" "current generation:" "$currentGen"
currentDate=$genDate currentDate=$genDate
printf "%-30s %s\n" "current generation created:" "$currentDate" printf "%-30s %s\n" "current generation created:" "$currentDate"
currentTime=$(date -d "$currentDate" +%s) currentTime=$(date -d "$currentDate" +%s)
currentElapsedSecs=$((timeNow-currentTime)) currentElapsedSecs=$((timeNow-currentTime))
currentElapsedMins=$((currentElapsedSecs/60)) currentElapsedMins=$((currentElapsedSecs/60))
currentElapsedHours=$((currentElapsedMins/60)) currentElapsedHours=$((currentElapsedMins/60))
currentElapsedDays=$((currentElapsedHours/24)) currentElapsedDays=$((currentElapsedHours/24))
printf "%-30s %s\n" "minutes before now:" "$currentElapsedMins" printf "%-30s %s\n" "minutes before now:" "$currentElapsedMins"
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
IFS=' ' read -r -a iGenArr <<< "$i" IFS=' ' read -r -a iGenArr <<< "$i"
genNumber=''${iGenArr[0]} genNumber=''${iGenArr[0]}
genDiff=$((currentGen-genNumber)) genDiff=$((currentGen-genNumber))
genDate=''${iGenArr[1]} genDate=''${iGenArr[1]}
genTime=$(date -d "$genDate" +%s) genTime=$(date -d "$genDate" +%s)
elapsedSecs=$((timeNow-genTime)) elapsedSecs=$((timeNow-genTime))
genDaysOld=$((elapsedSecs/60/60/24)) genDaysOld=$((elapsedSecs/60/60/24))
if [[ genDaysOld -gt keepDays ]] && [[ genDiff -ge keepGens ]]; then if [[ genDaysOld -gt keepDays ]] && [[ genDiff -ge keepGens ]]; then
gens["$genNumber"]="$genDate, $genDaysOld day(s) old" gens["$genNumber"]="$genDate, $genDaysOld day(s) old"
fi fi
done done
printf "\nFound the following generation(s) to delete:\n" printf "\nFound the following generation(s) to delete:\n"
for K in "''${!gens[@]}"; do for K in "''${!gens[@]}"; do
printf "generation %d \t ''${gens[$K]}\n" "$K" printf "generation %d \t ''${gens[$K]}\n" "$K"
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
''; '';
};
}; };
};} }
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.office = {pkgs, ...}: { flake.nixosModules.office = {pkgs, ...}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
libreoffice libreoffice
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.ollama = {pkgs-unstable, ...}: { flake.nixosModules.ollama = {pkgs-unstable, ...}: {
services.ollama = { services.ollama = {
enable = true; enable = true;
+28 -27
View File
@@ -1,28 +1,29 @@
{ self, ... }: { {self, ...}: {
flake.nixosModules.otherUtils = # try to keep packages here at a minium. Preferably use a dedicated file flake.nixosModules.otherUtils =
{ # try to keep packages here at a minium. Preferably use a dedicated file
pkgs, {
pkgs-unstable, pkgs,
... pkgs-unstable,
}: { ...
environment.systemPackages = with pkgs; [ }: {
gnome-calculator environment.systemPackages = with pkgs; [
snapshot gnome-calculator
gnome-characters snapshot
#tree # shows dir in tree # we use eza now gnome-characters
brightnessctl # control brightness #tree # shows dir in tree # we use eza now
powertop brightnessctl # control brightness
fzf powertop
bottom # Cross-platform graphical process/system monitor with a customizable interface fzf
tomato-c # pomodoro timer bottom # Cross-platform graphical process/system monitor with a customizable interface
#hyprshot tomato-c # pomodoro timer
mailcap #hyprshot
fuzzel mailcap
usbutils # used for lsusb fuzzel
self.packages.${pkgs.system}.custom-tomato usbutils # used for lsusb
self.packages.${pkgs.system}.custom-syllabes self.packages.${pkgs.system}.custom-tomato
pkgs-unstable.bitwarden-desktop self.packages.${pkgs.system}.custom-syllabes
fluffychat # matrix client pkgs-unstable.bitwarden-desktop
]; fluffychat # matrix client
}; ];
};
} }