mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2025-12-06 09:07:21 +01:00
feat: finish nix-update, add idle/github/bright.
This commit is contained in:
parent
40ccc0a9e9
commit
220451e8ac
9 changed files with 377 additions and 218 deletions
|
|
@ -3850,6 +3850,7 @@ This is the central station for self-defined packages. These are all referenced
|
|||
opacitytoggle = callPackage ./opacitytoggle { };
|
||||
fs-diff = callPackage ./fs-diff { };
|
||||
update-checker = callPackage ./update-checker { };
|
||||
github-notifications = callPackage ./github-notifications { };
|
||||
}
|
||||
|
||||
#+end_src
|
||||
|
|
@ -4324,14 +4325,21 @@ This utility checks if there are updated packages in nixpkgs-unstable. It does s
|
|||
|
||||
#+begin_src shell :tangle scripts/update-checker.sh
|
||||
|
||||
updates="$(cd ~/.dotfiles && nix flake lock --update-input nixpkgs && nix build .#nixosConfigurations."$HOSTNAME".config.system.build.toplevel && nvd diff /run/current-system ./result | grep -c '\[U')"
|
||||
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<NF; i++) printf $i " "; if (NF >= 3) print $NF; }' ORS='\\n' )
|
||||
echo "{ \"text\":\"$updates\", \"alt\":\"$alt\", \"tooltip\":\"$tooltip\" }"
|
||||
else
|
||||
echo "{ \"text\":\"\", \"alt\":\"$alt\", \"tooltip\":\"\" }"
|
||||
fi
|
||||
|
||||
echo "{ \"text\":\"$updates\", \"tooltip\":\"$tooltip\" }"
|
||||
|
||||
#+end_src
|
||||
|
||||
|
|
@ -4345,6 +4353,27 @@ This utility checks if there are updated packages in nixpkgs-unstable. It does s
|
|||
}
|
||||
#+end_src
|
||||
|
||||
**** github-notifications
|
||||
|
||||
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 nix :tangle pkgs/github-notifications/default.nix
|
||||
{ writeShellApplication, jq }:
|
||||
|
||||
writeShellApplication {
|
||||
name = "github-notifications";
|
||||
runtimeInputs = [ jq ];
|
||||
text = ''
|
||||
count=$(curl -u Swarsel:"$(cat /run/user/1000/secrets/github_notif)" https://api.github.com/notifications | jq '. | length')
|
||||
|
||||
if [[ "$count" != "0" ]]; then
|
||||
echo "{\"text\":\"$count\"}"
|
||||
fi
|
||||
'';
|
||||
}
|
||||
#+end_src
|
||||
|
||||
|
||||
*** Overlays (additions, overrides, nixpkgs-stable)
|
||||
:PROPERTIES:
|
||||
|
|
@ -6630,6 +6659,7 @@ This is just a separate container for derivations defined in [[#h:64a5cc16-6b16-
|
|||
opacitytoggle
|
||||
fs-diff
|
||||
update-checker
|
||||
github-notifications
|
||||
|
||||
(pkgs.writeScriptBin "project" ''
|
||||
#! ${pkgs.bash}/bin/bash
|
||||
|
|
@ -6701,6 +6731,7 @@ I use sops-nix to handle secrets that I want to have available on my machines at
|
|||
nautilus = { path = "/run/user/1000/secrets/nautilus"; };
|
||||
leon = { path = "/run/user/1000/secrets/leon"; };
|
||||
swarselmail = { path = "/run/user/1000/secrets/swarselmail"; };
|
||||
github_notif = { path = "/run/user/1000/secrets/github_notif"; };
|
||||
caldav = { path = "${config.home.homeDirectory}/.emacs.d/.caldav"; };
|
||||
};
|
||||
};
|
||||
|
|
@ -7583,7 +7614,7 @@ The rest of the related configuration is found here:
|
|||
layer = "top";
|
||||
position = "top";
|
||||
modules-left = [ "sway/workspaces" "custom/outer-right-arrow-dark" "sway/window" ];
|
||||
modules-center = [ "sway/mode" "custom/configwarn" "custom/nix-updates" ];
|
||||
modules-center = [ "sway/mode" "privacy" "custom/github" "custom/configwarn" "custom/nix-updates" ];
|
||||
"sway/mode" = {
|
||||
format = "<span style=\"italic\" font-weight=\"bold\">{}</span>";
|
||||
};
|
||||
|
|
@ -7600,13 +7631,41 @@ The rest of the related configuration is found here:
|
|||
interval = 60;
|
||||
};
|
||||
|
||||
"custom/scratchpad-indicator" = {
|
||||
interval = 3;
|
||||
exec = "swaymsg -t get_tree | jq 'recurse(.nodes[]) | first(select(.name==\"__i3_scratch\")) | .floating_nodes | length | select(. >= 1)'";
|
||||
format = "{} ";
|
||||
on-click = "swaymsg 'scratchpad show'";
|
||||
on-click-right = "swaymsg 'move scratchpad'";
|
||||
};
|
||||
|
||||
"custom/github" = {
|
||||
format = "{} ";
|
||||
return-type = "json";
|
||||
interval = 60;
|
||||
exec = "github-notifications";
|
||||
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 = 3600;
|
||||
tooltip = true;
|
||||
return-type = "json";
|
||||
format = "{} ";
|
||||
format = "{} {icon}";
|
||||
format-icon = {
|
||||
"has-updates" = "";
|
||||
"updated" = " ";
|
||||
};
|
||||
};
|
||||
|
||||
idle_inhibitor = {
|
||||
format = "{icon}";
|
||||
format-icons = {
|
||||
activated = "";
|
||||
deactivated = "";
|
||||
};
|
||||
};
|
||||
|
||||
"group/hardware" = {
|
||||
|
|
@ -7620,6 +7679,7 @@ The rest of the related configuration is found here:
|
|||
"power-profiles-daemon"
|
||||
"custom/left-arrow-light"
|
||||
"custom/left-arrow-dark"
|
||||
"custom/scratchpad-indicator"
|
||||
"custom/left-arrow-light"
|
||||
"disk"
|
||||
"custom/left-arrow-dark"
|
||||
|
|
@ -7627,9 +7687,18 @@ The rest of the related configuration is found here:
|
|||
"custom/left-arrow-light"
|
||||
"cpu"
|
||||
"custom/left-arrow-dark"
|
||||
"backlight/slider"
|
||||
"idle_inhibitor"
|
||||
];
|
||||
};
|
||||
|
||||
"backlight/slider" = {
|
||||
min = 0;
|
||||
max = 100;
|
||||
orientation = "horizontal";
|
||||
device = "intel_backlight";
|
||||
};
|
||||
|
||||
power-profiles-daemon = {
|
||||
format = "{icon}";
|
||||
tooltip-format = "Power profile: {profile}\nDriver: {driver}";
|
||||
|
|
|
|||
|
|
@ -15,4 +15,5 @@ in
|
|||
opacitytoggle = callPackage ./opacitytoggle { };
|
||||
fs-diff = callPackage ./fs-diff { };
|
||||
update-checker = callPackage ./update-checker { };
|
||||
github-notifications = callPackage ./github-notifications { };
|
||||
}
|
||||
|
|
|
|||
13
pkgs/github-notifications/default.nix
Normal file
13
pkgs/github-notifications/default.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{ writeShellApplication, jq }:
|
||||
|
||||
writeShellApplication {
|
||||
name = "github-notifications";
|
||||
runtimeInputs = [ jq ];
|
||||
text = ''
|
||||
count=$(curl -u Swarsel:"$(cat /run/user/1000/secrets/github_notif)" https://api.github.com/notifications | jq '. | length')
|
||||
|
||||
if [[ "$count" != "0" ]]; then
|
||||
echo "{\"text\":\"$count\"}"
|
||||
fi
|
||||
'';
|
||||
}
|
||||
|
|
@ -14,6 +14,7 @@
|
|||
opacitytoggle
|
||||
fs-diff
|
||||
update-checker
|
||||
github-notifications
|
||||
|
||||
(pkgs.writeScriptBin "project" ''
|
||||
#! ${pkgs.bash}/bin/bash
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ in
|
|||
nautilus = { path = "/run/user/1000/secrets/nautilus"; };
|
||||
leon = { path = "/run/user/1000/secrets/leon"; };
|
||||
swarselmail = { path = "/run/user/1000/secrets/swarselmail"; };
|
||||
github_notif = { path = "/run/user/1000/secrets/github_notif"; };
|
||||
caldav = { path = "${config.home.homeDirectory}/.emacs.d/.caldav"; };
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
layer = "top";
|
||||
position = "top";
|
||||
modules-left = [ "sway/workspaces" "custom/outer-right-arrow-dark" "sway/window" ];
|
||||
modules-center = [ "sway/mode" "custom/configwarn" "custom/nix-updates" ];
|
||||
modules-center = [ "sway/mode" "privacy" "custom/github" "custom/configwarn" "custom/nix-updates" ];
|
||||
"sway/mode" = {
|
||||
format = "<span style=\"italic\" font-weight=\"bold\">{}</span>";
|
||||
};
|
||||
|
|
@ -29,13 +29,41 @@
|
|||
interval = 60;
|
||||
};
|
||||
|
||||
"custom/scratchpad-indicator" = {
|
||||
interval = 3;
|
||||
exec = "swaymsg -t get_tree | jq 'recurse(.nodes[]) | first(select(.name==\"__i3_scratch\")) | .floating_nodes | length | select(. >= 1)'";
|
||||
format = "{} ";
|
||||
on-click = "swaymsg 'scratchpad show'";
|
||||
on-click-right = "swaymsg 'move scratchpad'";
|
||||
};
|
||||
|
||||
"custom/github" = {
|
||||
format = "{} ";
|
||||
return-type = "json";
|
||||
interval = 60;
|
||||
exec = "github-notifications";
|
||||
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 = 3600;
|
||||
tooltip = true;
|
||||
return-type = "json";
|
||||
format = "{} ";
|
||||
format = "{} {icon}";
|
||||
format-icon = {
|
||||
"has-updates" = "";
|
||||
"updated" = " ";
|
||||
};
|
||||
};
|
||||
|
||||
idle_inhibitor = {
|
||||
format = "{icon}";
|
||||
format-icons = {
|
||||
activated = "";
|
||||
deactivated = "";
|
||||
};
|
||||
};
|
||||
|
||||
"group/hardware" = {
|
||||
|
|
@ -49,6 +77,7 @@
|
|||
"power-profiles-daemon"
|
||||
"custom/left-arrow-light"
|
||||
"custom/left-arrow-dark"
|
||||
"custom/scratchpad-indicator"
|
||||
"custom/left-arrow-light"
|
||||
"disk"
|
||||
"custom/left-arrow-dark"
|
||||
|
|
@ -56,9 +85,18 @@
|
|||
"custom/left-arrow-light"
|
||||
"cpu"
|
||||
"custom/left-arrow-dark"
|
||||
"backlight/slider"
|
||||
"idle_inhibitor"
|
||||
];
|
||||
};
|
||||
|
||||
"backlight/slider" = {
|
||||
min = 0;
|
||||
max = 100;
|
||||
orientation = "horizontal";
|
||||
device = "intel_backlight";
|
||||
};
|
||||
|
||||
power-profiles-daemon = {
|
||||
format = "{icon}";
|
||||
tooltip-format = "Power profile: {profile}\nDriver: {driver}";
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ window#waybar.hidden {
|
|||
padding: 0 3px;
|
||||
}
|
||||
|
||||
#privacy,
|
||||
#custom-configwarn {
|
||||
color: black;
|
||||
padding: 0 3px;
|
||||
|
|
@ -97,7 +98,10 @@ window#waybar.hidden {
|
|||
#memory,
|
||||
#cpu,
|
||||
#temperature,
|
||||
#custom-scratchpad-indicator,
|
||||
#power-profiles-daemon,
|
||||
#idle_inhibitor,
|
||||
#backlight-slider,
|
||||
#mpris,
|
||||
#tray {
|
||||
background: @background;
|
||||
|
|
@ -151,6 +155,10 @@ window#waybar.hidden {
|
|||
color: #9ee09e;
|
||||
}
|
||||
|
||||
#custom-scratchpad-indicator {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
#disk.warning {
|
||||
color: @foreground-error;
|
||||
background-color: @background-error;
|
||||
|
|
@ -213,6 +221,26 @@ window#waybar.hidden {
|
|||
animation-direction: alternate;
|
||||
}
|
||||
|
||||
#backlight-slider slider {
|
||||
min-height: 0px;
|
||||
min-width: 0px;
|
||||
opacity: 0;
|
||||
background-image: none;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
#backlight-slider trough {
|
||||
min-height: 5px;
|
||||
min-width: 80px;
|
||||
border-radius: 5px;
|
||||
background-color: black;
|
||||
}
|
||||
#backlight-slider highlight {
|
||||
min-width: 0px;
|
||||
border-radius: 5px;
|
||||
background-color: grey;
|
||||
}
|
||||
|
||||
#clock.1,
|
||||
#clock.2,
|
||||
#clock.3 {
|
||||
|
|
@ -230,6 +258,7 @@ window#waybar.hidden {
|
|||
#custom-vpn,
|
||||
#mpris,
|
||||
#battery,
|
||||
#custom-scratchpad-indicator,
|
||||
#custom-pseudobat,
|
||||
#disk {
|
||||
padding: 0 3px;
|
||||
|
|
|
|||
12
scripts/update-checker.sh
Normal file → Executable file
12
scripts/update-checker.sh
Normal file → Executable file
|
|
@ -1,8 +1,14 @@
|
|||
updates="$(cd ~/.dotfiles && nix flake lock --update-input nixpkgs && nix build .#nixosConfigurations."$HOSTNAME".config.system.build.toplevel && nvd diff /run/current-system ./result | grep -c '\[U')"
|
||||
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<NF; i++) printf $i " "; if (NF >= 3) print $NF; }' ORS='\\n' )
|
||||
echo "{ \"text\":\"$updates\", \"alt\":\"$alt\", \"tooltip\":\"$tooltip\" }"
|
||||
else
|
||||
echo "{ \"text\":\"\", \"alt\":\"$alt\", \"tooltip\":\"\" }"
|
||||
fi
|
||||
|
||||
echo "{ \"text\":\"$updates\", \"tooltip\":\"$tooltip\" }"
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ edupass: ENC[AES256_GCM,data:StcWMBpiRQk4tro=,iv:RGQ0i27eErOaTvHJINSgCh/sO48IJWo
|
|||
handyhotspot: ENC[AES256_GCM,data:6XS3MI1sFbQ=,iv:2QQDbWre66cZxcQJqjMfYC6Uxfw6RBcgypWb31uJJxU=,tag:2gbd3tdFlSTv84GpTMQHiQ==,type:str]
|
||||
vpnuser: ENC[AES256_GCM,data:/fRpq/wyKuM=,iv:er+BKrfzihyRNzyTx3LIlecpyXlelh8OE8LZrGw6PNg=,tag:h7weTZXh43myaf35UwW0ZQ==,type:str]
|
||||
vpnpass: ENC[AES256_GCM,data:Vrhex2J5MmGdxw==,iv:rauPM5/cGfj5btQaUVIeMpr/hjKInl31+semAfZchCQ=,tag:3hshXzNp9rtp2en1lxi5mg==,type:str]
|
||||
github_notif: ENC[AES256_GCM,data:1E4/5leailXfftRIs2iIW+FJV291R1QbbVD+M//e1HRLGSF1GG/7Ww==,iv:hQ3u0KRssbIWoM3+t3VFGJ9YRLhLZIBYN3bC2JKj7nE=,tag:eOIodKAjVPtmDOeIXw4UIw==,type:str]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
|
|
@ -64,8 +65,8 @@ sops:
|
|||
cUxsRjB5MUVkQk14Mng5bEk2eW8xY0UKFcPwc3iVpmjPwogW2t48IdKOc/AiN+r1
|
||||
AJryUc2CZ3PK/njAnIxKqkCwsR527Txn0ulpaimqfv9nyJSVdbVXIQ==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2024-08-02T00:34:14Z"
|
||||
mac: ENC[AES256_GCM,data:vI3IAz0MQF9Ub1KQmHDuDSvoUaPlBhZjE66pS9ZWT5wsLKOjSdbFbXvpGGieUh9MdgALNPSXqDvNMExsiRHNTgbQHf0yA2Esni5WoHVgXDPRiq9dB6ixJwsO8UlygIsdQyKJo+DdbXRA15hR2I1xDpY6YnhdIOCDI/fyD95Nlt4=,iv:Vi/RDx1BPmSKnihP0NtkCf+GukeQojxhGtoSLH7fOtA=,tag:4MEZjDELRHlVxV/Kk1a0rA==,type:str]
|
||||
lastmodified: "2024-08-10T20:57:39Z"
|
||||
mac: ENC[AES256_GCM,data:unhftEeB+SE4lmTiJxfEGsiuBSPw2ClfGVvsNHWtVfjnkAJ0T6lQbFuxsuid0z6C5wvwabX1lFlzh5rilYyWZhWC58YTLa9RBigK07fq3y620JuOkczZ0puq9NOOv2+Uymp2k0R6B0VUJmIzKqDs4uIgwj4Jxged6m8B/FkDsc0=,iv:z1jeY2LoBtOZ9F56NGVgY+FytcIohD92oFLUempxUrg=,tag:kusyZHdKjCxhLv+U1P6cPg==,type:str]
|
||||
pgp:
|
||||
- created_at: "2024-08-02T00:34:07Z"
|
||||
enc: |-
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue