From 1ae3be96fa9bf81ddc5157da405055d97db38157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20Schwarz=C3=A4ugl?= Date: Sat, 22 Mar 2025 22:37:05 +0100 Subject: [PATCH] chore: remove updatechecker, lidChange apci script --- SwarselSystems.org | 127 ++++++----------------- pkgs/update-checker/default.nix | 6 -- profiles/home/common/custom-packages.nix | 1 - profiles/home/common/waybar.nix | 13 --- profiles/nixos/common/lid.nix | 16 --- scripts/update-checker.sh | 14 --- 6 files changed, 32 insertions(+), 145 deletions(-) delete mode 100644 pkgs/update-checker/default.nix delete mode 100644 scripts/update-checker.sh diff --git a/SwarselSystems.org b/SwarselSystems.org index 7d26abb..0be3d5a 100644 --- a/SwarselSystems.org +++ b/SwarselSystems.org @@ -2600,39 +2600,6 @@ This utility is used to compare the current state of the root directory with the } #+end_src -**** update-checker -:PROPERTIES: -:CUSTOM_ID: h:4d864147-f9ef-46da-9b4f-4e7996a65157 -:END: - -This utility checks if there are updated packages in nixpkgs-unstable. It does so by fully building the most recent configuration, which I do not love, but it has its merits once I am willing to switch to the newer version. - -#+begin_src shell :tangle scripts/update-checker.sh - updates="$({ cd /home/swarsel/.dotfiles && nix flake lock --update-input nixpkgs && nix build .#nixosConfigurations."$(eval hostname)".config.system.build.toplevel && nvd diff /run/current-system ./result | grep -c '\[U'; } || true)" - - alt="has-updates" - if [[ $updates -eq 0 ]]; then - alt="updated" - fi - - tooltip="System updated" - if [[ $updates != 0 ]]; then - tooltip=$(cd ~/.dotfiles && nvd diff /run/current-system ./result | grep -e '\[U' | awk '{ for (i=3; i= 3) print $NF; }' ORS='\\n') - echo "{ \"text\":\"$updates\", \"alt\":\"$alt\", \"tooltip\":\"$tooltip\" }" - else - echo "{ \"text\":\"\", \"alt\":\"$alt\", \"tooltip\":\"\" }" - fi -#+end_src - -#+begin_src nix :tangle pkgs/update-checker/default.nix - { self, name, writeShellApplication, nvd }: - writeShellApplication { - inherit name; - runtimeInputs = [ nvd ]; - text = builtins.readFile "${self}/scripts/${name}.sh"; - } -#+end_src - **** github-notifications :PROPERTIES: :CUSTOM_ID: h:a9398c4e-4d3b-4942-b03c-192f9c0517e5 @@ -6258,56 +6225,40 @@ I am using distrobox to quickly circumvent isses that I cannot immediately solve This turns off the display when the lid is closed. #+begin_src nix :tangle profiles/nixos/common/lid.nix -_: -{ - services.logind = { - lidSwitch = "suspend"; - lidSwitchDocked = "ignore"; - }; - services.acpid = { - enable = true; - handlers.lidClosed = { - event = "button/lid \\w+ close"; - action = '' - cat /sys/class/backlight/amdgpu_bl1/device/enabled - if grep -Fxq disabled /sys/class/backlight/amdgpu_bl1/device/enabled - then - echo "Lid closed. Disabling fprintd." - systemctl stop fprintd - ln -s /dev/null /run/systemd/transient/fprintd.service - systemctl daemon-reload - fi - ''; + _: + { + services.logind = { + lidSwitch = "suspend"; + lidSwitchDocked = "ignore"; }; - handlers.lidOpen = { - event = "button/lid \\w+ open"; - action = '' - if ! $(systemctl is-active --quiet fprintd); then - echo "Lid open. Enabling fprintd." - rm -f /run/systemd/transient/fprintd.service - systemctl daemon-reload - systemctl start fprintd - fi - ''; + services.acpid = { + enable = true; + handlers.lidClosed = { + event = "button/lid \\w+ close"; + action = '' + cat /sys/class/backlight/amdgpu_bl1/device/enabled + if grep -Fxq disabled /sys/class/backlight/amdgpu_bl1/device/enabled + then + echo "Lid closed. Disabling fprintd." + systemctl stop fprintd + ln -s /dev/null /run/systemd/transient/fprintd.service + systemctl daemon-reload + fi + ''; + }; + handlers.lidOpen = { + event = "button/lid \\w+ open"; + action = '' + if ! $(systemctl is-active --quiet fprintd); then + echo "Lid open. Enabling fprintd." + rm -f /run/systemd/transient/fprintd.service + systemctl daemon-reload + systemctl start fprintd + fi + ''; + }; }; - lidEventCommands = - '' - export PATH=$PATH:/run/current-system/sw/bin - export WAYLAND_DISPLAY=wayland-1 - export XDG_RUNTIME_DIR=/run/user/1000 - export SWAYSOCK=$(ls /run/user/1000/sway-ipc.* | head -n 1) - - LID_STATE=$(cat /proc/acpi/button/lid/*/state | grep -q closed && echo "closed" || echo "open") - DOCKED=$(swaymsg -t get_outputs | grep -q 'HDMI\|DP' && echo "docked" || echo "undocked") - - if [ "$LID_STATE" == "closed" ] && [ "$DOCKED" == "docked" ]; then - swaymsg output eDP-2 disable - else - swaymsg output eDP-2 enable - fi - ''; - }; -} + } #+end_src **** Low battery notification @@ -8846,7 +8797,6 @@ This is just a separate container for derivations defined in [[#h:64a5cc16-6b16- waybarupdate opacitytoggle fs-diff - update-checker github-notifications screenshare hm-specialisation @@ -10068,19 +10018,6 @@ The rest of the related configuration is found here: on-click = "xdg-open https://github.com/notifications"; }; - # "custom/nix-updates" = { - # exec = "update-checker"; - # on-click = "update-checker && notify-send 'The system has been updated'"; - # interval = "once"; - # tooltip = true; - # return-type = "json"; - # format = "{} {icon}"; - # format-icon = { - # "has-updates" = ""; - # "updated" = " "; - # }; - # }; - idle_inhibitor = { format = "{icon}"; format-icons = { diff --git a/pkgs/update-checker/default.nix b/pkgs/update-checker/default.nix deleted file mode 100644 index 7d15257..0000000 --- a/pkgs/update-checker/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ self, name, writeShellApplication, nvd }: -writeShellApplication { - inherit name; - runtimeInputs = [ nvd ]; - text = builtins.readFile "${self}/scripts/${name}.sh"; -} diff --git a/profiles/home/common/custom-packages.nix b/profiles/home/common/custom-packages.nix index b765461..0b09b1a 100644 --- a/profiles/home/common/custom-packages.nix +++ b/profiles/home/common/custom-packages.nix @@ -13,7 +13,6 @@ waybarupdate opacitytoggle fs-diff - update-checker github-notifications screenshare hm-specialisation diff --git a/profiles/home/common/waybar.nix b/profiles/home/common/waybar.nix index b32ac4b..45de59e 100644 --- a/profiles/home/common/waybar.nix +++ b/profiles/home/common/waybar.nix @@ -47,19 +47,6 @@ on-click = "xdg-open https://github.com/notifications"; }; - # "custom/nix-updates" = { - # exec = "update-checker"; - # on-click = "update-checker && notify-send 'The system has been updated'"; - # interval = "once"; - # tooltip = true; - # return-type = "json"; - # format = "{} {icon}"; - # format-icon = { - # "has-updates" = ""; - # "updated" = " "; - # }; - # }; - idle_inhibitor = { format = "{icon}"; format-icons = { diff --git a/profiles/nixos/common/lid.nix b/profiles/nixos/common/lid.nix index 2382db3..824f29b 100644 --- a/profiles/nixos/common/lid.nix +++ b/profiles/nixos/common/lid.nix @@ -30,21 +30,5 @@ _: fi ''; }; - lidEventCommands = - '' - export PATH=$PATH:/run/current-system/sw/bin - export WAYLAND_DISPLAY=wayland-1 - export XDG_RUNTIME_DIR=/run/user/1000 - export SWAYSOCK=$(ls /run/user/1000/sway-ipc.* | head -n 1) - - LID_STATE=$(cat /proc/acpi/button/lid/*/state | grep -q closed && echo "closed" || echo "open") - DOCKED=$(swaymsg -t get_outputs | grep -q 'HDMI\|DP' && echo "docked" || echo "undocked") - - if [ "$LID_STATE" == "closed" ] && [ "$DOCKED" == "docked" ]; then - swaymsg output eDP-2 disable - else - swaymsg output eDP-2 enable - fi - ''; }; } diff --git a/scripts/update-checker.sh b/scripts/update-checker.sh deleted file mode 100644 index 2a052b3..0000000 --- a/scripts/update-checker.sh +++ /dev/null @@ -1,14 +0,0 @@ -updates="$({ cd /home/swarsel/.dotfiles && nix flake lock --update-input nixpkgs && nix build .#nixosConfigurations."$(eval hostname)".config.system.build.toplevel && nvd diff /run/current-system ./result | grep -c '\[U'; } || true)" - -alt="has-updates" -if [[ $updates -eq 0 ]]; then - alt="updated" -fi - -tooltip="System updated" -if [[ $updates != 0 ]]; then - tooltip=$(cd ~/.dotfiles && nvd diff /run/current-system ./result | grep -e '\[U' | awk '{ for (i=3; i= 3) print $NF; }' ORS='\\n') - echo "{ \"text\":\"$updates\", \"alt\":\"$alt\", \"tooltip\":\"$tooltip\" }" -else - echo "{ \"text\":\"\", \"alt\":\"$alt\", \"tooltip\":\"\" }" -fi