mirror of
https://github.com/tomasriveral/nixos.git
synced 2026-08-11 18:18:37 +02:00
Merge pull request #31 from tomasriveral/laptop
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
# Ignore build outputs from performing a nix-build or `nix build` command
|
||||||
|
result
|
||||||
|
result-*
|
||||||
|
|
||||||
|
# Ignore automatically generated direnv output
|
||||||
|
.direnv
|
||||||
|
|
||||||
|
# Ignore NixOS interactive test driver history
|
||||||
|
**/.nixos-test-history
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-26.05";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-26.05";
|
||||||
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable"; # used for some packages
|
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable"; # used for some packages
|
||||||
|
|
||||||
# Only uncomment when needed. This uses a lot of space and compute ressources for sometimes not that much. If not used, make it follow unstable
|
# Only uncomment when needed. This uses a lot of space and compute ressources for sometimes not that much. If not used, make it follow unstable
|
||||||
nixpkgs-master.follows = "nixpkgs-unstable";
|
nixpkgs-master.follows = "nixpkgs-unstable";
|
||||||
#nixpkgs-master.url = "github:nixos/nixpkgs/master"; # used with precaution as they are untested and not cached
|
#nixpkgs-master.url = "github:nixos/nixpkgs/master"; # used with precaution as they are untested and not cached
|
||||||
|
|||||||
@@ -198,8 +198,8 @@
|
|||||||
"$mod_SHIFT, S, exec, caelestia shell picker open"
|
"$mod_SHIFT, S, exec, caelestia shell picker open"
|
||||||
# framework 16 rgb macropad
|
# framework 16 rgb macropad
|
||||||
"Ctrl+$mod, 6, exec, custom-killall" # pos 1 1 killall apps except focused one
|
"Ctrl+$mod, 6, exec, custom-killall" # pos 1 1 killall apps except focused one
|
||||||
#"Ctrl+Alt, 7, exec, custom-performance" # pos 2 1 start performance mode
|
"Ctrl+Alt, 7, exec, custom-performance" # pos 2 1 start performance mode
|
||||||
"Ctrl+Alt, 7, exec, caelestia shell gameMode toggle"
|
#"Ctrl+Alt, 7, exec, caelestia shell gameMode toggle"
|
||||||
# reloads the autostart programs # pos 3 1
|
# reloads the autostart programs # pos 3 1
|
||||||
# we passed to caelestia-shell and stoped using that
|
# we passed to caelestia-shell and stoped using that
|
||||||
/*
|
/*
|
||||||
@@ -211,7 +211,9 @@
|
|||||||
#"Ctrl+Alt, 1, exec, swaync-client -t" # pos 4 1 notification center
|
#"Ctrl+Alt, 1, exec, swaync-client -t" # pos 4 1 notification center
|
||||||
"Ctrl+Alt, 1, exec, qs ipc call notifications toggle"
|
"Ctrl+Alt, 1, exec, qs ipc call notifications toggle"
|
||||||
*/
|
*/
|
||||||
|
# pos 4 1 notification center.
|
||||||
"Ctrl+Alt, 1, exec, caelestia shell drawers toggle sidebar"
|
"Ctrl+Alt, 1, exec, caelestia shell drawers toggle sidebar"
|
||||||
|
"Ctrl+Alt, 1, exec, [[ -f ~/.cache/hypr-battery-saver ]] || swaync-client -t"
|
||||||
"Ctrl+$mod, 4, exec, caelestia shell notifs toggleDnd"
|
"Ctrl+$mod, 4, exec, caelestia shell notifs toggleDnd"
|
||||||
"Ctrl+$mod, 3, exec, pavucontrol" # pos 1 2 audiocontrol
|
"Ctrl+$mod, 3, exec, pavucontrol" # pos 1 2 audiocontrol
|
||||||
"Ctrl+Shift+Alt, 0, exec, kitty --hold --class \"custom-changeAudioOutput\" --name \"Select audio output\" zsh -c \"custom-changeAudioOutput\"" # pos 2 2 change audio output fzf
|
"Ctrl+Shift+Alt, 0, exec, kitty --hold --class \"custom-changeAudioOutput\" --name \"Select audio output\" zsh -c \"custom-changeAudioOutput\"" # pos 2 2 change audio output fzf
|
||||||
@@ -279,6 +281,8 @@
|
|||||||
#"QS-notifycache" # builds the cache that will be used for the notification history
|
#"QS-notifycache" # builds the cache that will be used for the notification history
|
||||||
"sleep 4 & caelestia-shell" #works better if it sleeps a bit before
|
"sleep 4 & caelestia-shell" #works better if it sleeps a bit before
|
||||||
"sleep 20 && ngcp pull --automatic" # see github.com/tomasriveral/nix-git-cherry-picker
|
"sleep 20 && ngcp pull --automatic" # see github.com/tomasriveral/nix-git-cherry-picker
|
||||||
|
"rm ~/.cache/hypr-battery-saver"
|
||||||
|
"rm ~/.cache/hypr-battery-saver.brightness"
|
||||||
/*
|
/*
|
||||||
We stopped using that ######################### maybe we should desactivate those scripts
|
We stopped using that ######################### maybe we should desactivate those scripts
|
||||||
# login autostart
|
# login autostart
|
||||||
|
|||||||
@@ -3,5 +3,5 @@ _: {
|
|||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
elan
|
elan
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ _: {
|
|||||||
pkgs-unstable.vimPlugins.nvim-treesitter-parsers.nix
|
pkgs-unstable.vimPlugins.nvim-treesitter-parsers.nix
|
||||||
pkgs-unstable.vimPlugins.nvim-treesitter-parsers.printf
|
pkgs-unstable.vimPlugins.nvim-treesitter-parsers.printf
|
||||||
pkgs-unstable.vimPlugins.nvim-treesitter-parsers.python
|
pkgs-unstable.vimPlugins.nvim-treesitter-parsers.python
|
||||||
|
pkgs-unstable.vimPlugins.nvim-treesitter-parsers.sparql
|
||||||
pkgs-unstable.vimPlugins.telescope-nvim
|
pkgs-unstable.vimPlugins.telescope-nvim
|
||||||
pkgs-unstable.vimPlugins.nvim-scrollbar
|
pkgs-unstable.vimPlugins.nvim-scrollbar
|
||||||
pkgs-unstable.vimPlugins.promise-async
|
pkgs-unstable.vimPlugins.promise-async
|
||||||
|
|||||||
@@ -1,4 +1,32 @@
|
|||||||
_: {
|
_: {
|
||||||
|
flake.homeModules.waybar-minimal = _: {
|
||||||
|
programs.waybar = {
|
||||||
|
enable = true;
|
||||||
|
settings = [
|
||||||
|
{
|
||||||
|
layer = "top";
|
||||||
|
modules-left = [];
|
||||||
|
modules-center = [];
|
||||||
|
modules-right = [
|
||||||
|
"battery"
|
||||||
|
"clock"
|
||||||
|
];
|
||||||
|
|
||||||
|
battery = {
|
||||||
|
format = "{capacity}% {icon}";
|
||||||
|
states = {
|
||||||
|
warning = 30;
|
||||||
|
critical = 15;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
clock = {
|
||||||
|
format = "{:%H:%M}";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
flake.homeModules.waybar = _: {
|
flake.homeModules.waybar = _: {
|
||||||
# replaced by caelestia
|
# replaced by caelestia
|
||||||
programs.waybar = {
|
programs.waybar = {
|
||||||
|
|||||||
@@ -2,8 +2,25 @@ _: {
|
|||||||
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 = ''
|
||||||
snrs = "git -C ~/nixos add -A && time sudo nixos-rebuild switch --flake ~/nixos/#laptop && pkill shell || true && pkill caelestia-shell || true && caelestia-shell -n > /dev/null 2>&1 & disown";
|
git -C ~/nixos add -A &&
|
||||||
|
time sudo nixos-rebuild test --flake ~/nixos/#laptop &&
|
||||||
|
pkill shell || true &&
|
||||||
|
if [ ! -f ~/.cache/hypr-battery-saver ]; then
|
||||||
|
pkill caelestia-shell || true &&
|
||||||
|
caelestia-shell -n > /dev/null 2>&1 & disown
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
|
||||||
|
snrs = ''
|
||||||
|
git -C ~/nixos add -A &&
|
||||||
|
time sudo nixos-rebuild switch --flake ~/nixos/#laptop &&
|
||||||
|
pkill shell || true &&
|
||||||
|
if [ ! -f ~/.cache/hypr-battery-saver ]; then
|
||||||
|
pkill caelestia-shell || true &&
|
||||||
|
caelestia-shell -n > /dev/null 2>&1 & disown
|
||||||
|
fi
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -33,7 +50,7 @@ _: {
|
|||||||
command cat "$@"
|
command cat "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
custom-eza() { # behaves differently if we just call it or if we pipe initContent
|
custom-eza() { # behaves differently if we just call it or if we pipe initContent
|
||||||
if [[ -t 1 ]]; then
|
if [[ -t 1 ]]; then
|
||||||
eza -hlF -aa --color=always --hyperlink --group-directories-first --show-symlinks --icons=always --git --no-permissions "$@"
|
eza -hlF -aa --color=always --hyperlink --group-directories-first --show-symlinks --icons=always --git --no-permissions "$@"
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
_: {
|
{
|
||||||
flake.nixosModules.battery-laptop = {
|
self,
|
||||||
lib,
|
inputs,
|
||||||
config,
|
...
|
||||||
...
|
}: {
|
||||||
}:
|
flake.nixosModules.battery-laptop = {pkgs, ...}:
|
||||||
# https://discourse.nixos.org/t/what-is-the-best-option-for-power-management/63406/2
|
# https://discourse.nixos.org/t/what-is-the-best-option-for-power-management/63406/2
|
||||||
# we just activate tlp unconditonally
|
# we just activate tlp unconditonally
|
||||||
#let
|
#let
|
||||||
@@ -22,7 +22,8 @@ _: {
|
|||||||
# };
|
# };
|
||||||
|
|
||||||
# config = lib.mkIf cfg.battery.enable {
|
# config = lib.mkIf cfg.battery.enable {
|
||||||
powerManagement.powertop.enable = true; # enable powertop auto tuning on startup.
|
/*
|
||||||
|
powerManagement.powertop.enable = true; # enable powertop auto tuning on startup.
|
||||||
# Acording to https://community.frame.work/t/solved-keys-stick-and-repeat-after-being-released/51153/12
|
# Acording to https://community.frame.work/t/solved-keys-stick-and-repeat-after-being-released/51153/12
|
||||||
# Some powertop bug is responsable for the problem of the random keypress being stuck
|
# Some powertop bug is responsable for the problem of the random keypress being stuck
|
||||||
# fix: from https://git.gabbie.blue/blue/nixconf/src/commit/2d1bc6dad4684c019b6b3e894408e76e2734806c/hosts/gabbielaptop/configuration.nix#L68
|
# fix: from https://git.gabbie.blue/blue/nixconf/src/commit/2d1bc6dad4684c019b6b3e894408e76e2734806c/hosts/gabbielaptop/configuration.nix#L68
|
||||||
@@ -31,10 +32,11 @@ _: {
|
|||||||
# Retrigger macropad udev rules
|
# Retrigger macropad udev rules
|
||||||
${lib.getExe' config.systemd.package "udevadm"} trigger -c bind -s usb -a idVendor=32ac -a idProduct=0013
|
${lib.getExe' config.systemd.package "udevadm"} trigger -c bind -s usb -a idVendor=32ac -a idProduct=0013
|
||||||
'';
|
'';
|
||||||
|
*/
|
||||||
services.system76-scheduler.settings.cfsProfiles.enable = true; # Better scheduling for CPU cycles - thanks System76!!!
|
services.system76-scheduler.settings.cfsProfiles.enable = true; # Better scheduling for CPU cycles - thanks System76!!!
|
||||||
services.thermald.enable = true; # Enable thermald, the temperature management daemon. (only necessary if on Intel CPUs)
|
services.thermald.enable = false; # Enable thermald, the temperature management daemon. (only necessary if on Intel CPUs)
|
||||||
services.power-profiles-daemon.enable = false; # Disable GNOMEs power management
|
services.power-profiles-daemon.enable = true; # ppd is recommended over tlp for framework 16
|
||||||
services.tlp = {
|
/*services.tlp = {
|
||||||
enable = true; # Enable TLP (better than gnomes internal power manager)
|
enable = true; # Enable TLP (better than gnomes internal power manager)
|
||||||
settings = {
|
settings = {
|
||||||
CPU_BOOST_ON_AC = 1;
|
CPU_BOOST_ON_AC = 1;
|
||||||
@@ -47,11 +49,12 @@ _: {
|
|||||||
CPU_ENERGY_PERF_POLICY_ON_BAT = "powersave";
|
CPU_ENERGY_PERF_POLICY_ON_BAT = "powersave";
|
||||||
PLATFORM_PROFILE_ON_AC = "balanced";
|
PLATFORM_PROFILE_ON_AC = "balanced";
|
||||||
PLATFORM_PROFILE_ON_BAT = "powersave";
|
PLATFORM_PROFILE_ON_BAT = "powersave";
|
||||||
START_CHARGE_THRESH_BAT1 = 40;
|
|
||||||
STOP_CHARGE_THRESH_BAT1 = 80;
|
STOP_CHARGE_THRESH_BAT1 = 80;
|
||||||
};
|
};
|
||||||
};
|
};*/
|
||||||
# };
|
environment.systemPackages = [
|
||||||
|
self.packages.${pkgs.system}.custom-performance
|
||||||
|
];
|
||||||
};
|
};
|
||||||
perSystem = {pkgs, ...}: let
|
perSystem = {pkgs, ...}: let
|
||||||
NotifySound = ../../assets/battery_notify.mp3;
|
NotifySound = ../../assets/battery_notify.mp3;
|
||||||
@@ -336,28 +339,97 @@ _: {
|
|||||||
name = "custom-performance";
|
name = "custom-performance";
|
||||||
runtimeInputs = with pkgs; [
|
runtimeInputs = with pkgs; [
|
||||||
hyprland
|
hyprland
|
||||||
gawk
|
brightnessctl
|
||||||
|
swaynotificationcenter
|
||||||
|
self.packages.${pkgs.system}.custom-wallpaper
|
||||||
libnotify
|
libnotify
|
||||||
|
inputs.caelestia-shell.packages.${pkgs.system}.default
|
||||||
];
|
];
|
||||||
text = ''
|
text = ''
|
||||||
HYPRGAMEMODE=$(hyprctl getoption animations:enabled | awk 'NR==1{print $2}')
|
STATE="$HOME/.cache/hypr-battery-saver"
|
||||||
if [ "$HYPRGAMEMODE" = 1 ] ; then
|
|
||||||
|
enable() {
|
||||||
|
mkdir -p "$(dirname "$STATE")"
|
||||||
|
|
||||||
|
echo "Enabling battery saver mode..."
|
||||||
|
|
||||||
|
# Save brightness
|
||||||
|
brightnessctl get > "''${STATE}.brightness" 2>/dev/null || true
|
||||||
|
|
||||||
|
# Kill heavy UI components
|
||||||
|
pkill -f caelestia-shell || true
|
||||||
|
pkill -f caelestia || true
|
||||||
|
pkill shell || true
|
||||||
|
pkill -f custom-wallpaper || true
|
||||||
|
|
||||||
|
# Start lightweight notifications
|
||||||
|
pkill swaync || true
|
||||||
|
swaync & disown
|
||||||
|
|
||||||
|
# Start lightweight waybar
|
||||||
|
pkill waybar || true
|
||||||
|
waybar & disown
|
||||||
|
|
||||||
|
# Lower refresh rate (BIGGEST win)
|
||||||
|
hyprctl keyword monitor "eDP-1,2560x1600@60,0x0,1"
|
||||||
|
|
||||||
|
# Core performance toggles
|
||||||
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:rounding 0;\
|
||||||
|
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:active_opacity 1;\
|
||||||
notify-send -u critical -t 5000 "Performance mode [ON]"
|
keyword decoration:inactive_opacity 1;\
|
||||||
exit
|
keyword misc:vfr true"
|
||||||
else
|
|
||||||
notify-send -u critical -t 5000 "Performance mode [OFF]"
|
# Lower brightness
|
||||||
|
brightnessctl set 5% 2>/dev/null || true
|
||||||
|
|
||||||
|
touch "$STATE"
|
||||||
|
|
||||||
|
notify-send "Battery Saver" "Enabled"
|
||||||
|
}
|
||||||
|
|
||||||
|
disable() {
|
||||||
|
echo "Disabling battery saver mode..."
|
||||||
|
|
||||||
|
# Restore refresh rate
|
||||||
|
hyprctl keyword monitor "eDP-1,2560x1600@165,0x0,1"
|
||||||
|
|
||||||
|
# Restore Caelestia
|
||||||
|
pkill swaync || true
|
||||||
|
pkill waybar || true
|
||||||
|
caelestia shell -d >/dev/null 2>&1 &
|
||||||
|
disown
|
||||||
|
|
||||||
|
|
||||||
|
# Restart wallpaper
|
||||||
|
custom-wallpaper >/dev/null 2>&1 &
|
||||||
|
disown
|
||||||
|
|
||||||
|
# Restore full UI via reload (safe here on exit)
|
||||||
hyprctl reload
|
hyprctl reload
|
||||||
exit 0
|
|
||||||
|
# Restore brightness
|
||||||
|
if [[ -f "''${STATE}.brightness" ]]; then
|
||||||
|
brightnessctl set "$(cat "''${STATE}.brightness")" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f "$STATE" "''${STATE}.brightness"
|
||||||
|
|
||||||
|
notify-send "Battery Saver" "Disabled"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ -f "$STATE" ]]; then
|
||||||
|
disable
|
||||||
|
else
|
||||||
|
enable
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{self, ...}: {
|
||||||
|
flake.nixosModules.performance-desktop = {pkgs,...}: {
|
||||||
|
environment.systemPackages = [
|
||||||
|
self.packages.${pkgs.system}.custom-performance
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -44,6 +44,7 @@
|
|||||||
office
|
office
|
||||||
#ollama
|
#ollama
|
||||||
otherUtils
|
otherUtils
|
||||||
|
performance-desktop
|
||||||
printer
|
printer
|
||||||
rss
|
rss
|
||||||
udev
|
udev
|
||||||
@@ -74,15 +75,17 @@
|
|||||||
rofi
|
rofi
|
||||||
sbb-tui
|
sbb-tui
|
||||||
ssh
|
ssh
|
||||||
|
swaync # used in performance mode
|
||||||
thunderbird
|
thunderbird
|
||||||
tomasr
|
tomasr
|
||||||
vivify
|
vivify
|
||||||
|
waybar-minimal # used in performance mode
|
||||||
zoxide
|
zoxide
|
||||||
zsh
|
zsh
|
||||||
zsh-desktop
|
zsh-desktop
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
flake.nixosModules.desktop = _: {
|
flake.nixosModules.desktop = {pkgs, ...}: {
|
||||||
# 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. It‘s perfectly fine and recommended to leave
|
# on your system were taken. It‘s perfectly fine and recommended to leave
|
||||||
@@ -94,6 +97,9 @@
|
|||||||
"nix-command"
|
"nix-command"
|
||||||
"flakes"
|
"flakes"
|
||||||
];
|
];
|
||||||
|
environment.systemPackages = [
|
||||||
|
self.packages.${pkgs.system}.custom-performance
|
||||||
|
];
|
||||||
};
|
};
|
||||||
flake.nixosModules.home-manager-desktop = {pkgs, ...}: {
|
flake.nixosModules.home-manager-desktop = {pkgs, ...}: {
|
||||||
imports = [
|
imports = [
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
audioAndMedia
|
audioAndMedia
|
||||||
autoCleanup-laptop
|
autoCleanup-laptop
|
||||||
autoUpdate-laptop
|
autoUpdate-laptop
|
||||||
#battery-laptop
|
battery-laptop
|
||||||
bluetooth
|
bluetooth
|
||||||
bootloader
|
bootloader
|
||||||
browsers
|
browsers
|
||||||
@@ -76,9 +76,11 @@
|
|||||||
rofi
|
rofi
|
||||||
sbb-tui
|
sbb-tui
|
||||||
ssh
|
ssh
|
||||||
|
swaync # used in performance mode
|
||||||
thunderbird
|
thunderbird
|
||||||
tomasr
|
tomasr
|
||||||
vivify
|
vivify
|
||||||
|
waybar-minimal # used in performance mode
|
||||||
zoxide
|
zoxide
|
||||||
zsh
|
zsh
|
||||||
zsh-laptop
|
zsh-laptop
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
{inputs, self, ...}: {
|
{
|
||||||
|
inputs,
|
||||||
|
self,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user