diff --git a/.gitignore b/.gitignore index 48a6888..addac83 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ secrets/keys/pubring.kbx secrets/keys/private-keys-v1.d/ +result diff --git a/SwarselSystems.org b/SwarselSystems.org index aae7b71..5968ef7 100644 --- a/SwarselSystems.org +++ b/SwarselSystems.org @@ -4147,6 +4147,7 @@ As such, I also define three additional overlays: waybarupdate = callPackage ./waybarupdate { }; opacitytoggle = callPackage ./opacitytoggle { }; fs-diff = callPackage ./fs-diff { }; + update-checker = callPackage ./update-checker { }; } #+end_src @@ -4558,35 +4559,80 @@ done } #+end_src +**** update-checker + +#+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')" + + 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' ) + fi + + echo "{ \"text\":\"$updates\", \"alt\":\"$alt\", \"tooltip\":\"$tooltip\" }" + +#+end_src + +#+begin_src nix :tangle pkgs/update-checker/default.nix + { writeShellApplication, sway}: + + writeShellApplication { + name = "update-checker"; + text = builtins.readFile ../../scripts/update-checker.sh; + } +#+end_src + *** Overlays #+begin_src nix :tangle overlays/default.nix - { inputs, ... }: { - additions = final: _prev: import ../pkgs { pkgs = final; }; - modifications = final: _prev: { - # example = prev.example.overrideAttrs (oldAttrs: rec { - # ... - # }); + { inputs, ... }: { + additions = final: _prev: import ../pkgs { pkgs = final; }; + modifications = final: _prev: { + vesktop = _prev.vesktop.override { + withSystemVencord = true; + }; - # river = prev.river.overrideAttrs (oldAttrs: rec { - # pname = "river"; - # version = "git"; - # src = prev.fetchFromGitHub { - # owner = "riverwm"; - # repo = pname; - # rev = "c16628c7f57c51d50f2d10a96c265fb0afaddb02"; - # hash = "sha256-E3Xtv7JeCmafiNmpuS5VuLgh1TDAbibPtMo6A9Pz6EQ="; - # fetchSubmodules = true; - # }; - # }); - }; + nerdfonts = _prev.nerdfonts.override { + fonts = [ "FiraMono" "FiraCode" "NerdFontsSymbolsOnly" ]; + }; - nixpkgs-stable = final: _prev: { - stable = import inputs.nixpkgs-stable { inherit (final) system; }; - }; -} + firefox = _prev.firefox.override { + nativeMessagingHosts = [ + _prev.tridactyl-native + _prev.browserpass + _prev.plasma5Packages.plasma-browser-integration + ]; + }; + + prismlauncher = _prev.prismlauncher.override { + glfw = _prev.glfw-wayland-minecraft; + }; + + # river = prev.river.overrideAttrs (oldAttrs: rec { + # pname = "river"; + # version = "git"; + # src = prev.fetchFromGitHub { + # owner = "riverwm"; + # repo = pname; + # rev = "c16628c7f57c51d50f2d10a96c265fb0afaddb02"; + # hash = "sha256-E3Xtv7JeCmafiNmpuS5VuLgh1TDAbibPtMo6A9Pz6EQ="; + # fetchSubmodules = true; + # }; + # }); + }; + + nixpkgs-stable = final: _prev: { + stable = import inputs.nixpkgs-stable { inherit (final) system; }; + }; + } #+end_src @@ -6609,6 +6655,7 @@ Programming languages and default lsp's are defined here: [[#h:0e7e8bea-ec58-499 waybarupdate opacitytoggle fs-diff + update-checker (pkgs.writeScriptBin "project" '' #! ${pkgs.bash}/bin/bash @@ -7593,6 +7640,19 @@ The rest of this configuration is found here: interval = 60; }; + "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 = "{} {icon} ?"; + format-icons = { + has-updates = ""; + updated= ""; + }; + }; + "group/hardware" = { orientation = "inherit"; drawer = { @@ -7603,6 +7663,8 @@ The rest of this configuration is found here: "temperature" "power-profiles-daemon" "custom/left-arrow-light" + "custom/left-arrow-dark" + "custom/left-arrow-light" "disk" "custom/left-arrow-dark" "memory" @@ -8408,10 +8470,12 @@ This tangles the flake.nix file; This block only needs to be touched when updati nixConfig = { extra-substituters = [ "https://nix-community.cachix.org" + "https://cache.ngi0.nixos.org/" ]; extra-trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "cache.ngi0.nixos.org-1:KqH5CBLNSyX184S9BKZJo1LxrxJ9ltnY2uAs5c/f1MA=" ]; }; diff --git a/flake.nix b/flake.nix index 4bb22ef..da1ab4b 100644 --- a/flake.nix +++ b/flake.nix @@ -4,10 +4,12 @@ nixConfig = { extra-substituters = [ "https://nix-community.cachix.org" + "https://cache.ngi0.nixos.org/" ]; extra-trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "cache.ngi0.nixos.org-1:KqH5CBLNSyX184S9BKZJo1LxrxJ9ltnY2uAs5c/f1MA=" ]; }; diff --git a/pkgs/default.nix b/pkgs/default.nix index a273952..63a4457 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -14,4 +14,5 @@ in waybarupdate = callPackage ./waybarupdate { }; opacitytoggle = callPackage ./opacitytoggle { }; fs-diff = callPackage ./fs-diff { }; + update-checker = callPackage ./update-checker { }; } diff --git a/pkgs/update-checker/default.nix b/pkgs/update-checker/default.nix new file mode 100644 index 0000000..6dd7d35 --- /dev/null +++ b/pkgs/update-checker/default.nix @@ -0,0 +1,6 @@ +{ writeShellApplication, sway }: + +writeShellApplication { + name = "update-checker"; + text = builtins.readFile ../../scripts/update-checker.sh; +} diff --git a/profiles/common/home/waybar.nix b/profiles/common/home/waybar.nix index 70b85e3..721dc67 100644 --- a/profiles/common/home/waybar.nix +++ b/profiles/common/home/waybar.nix @@ -29,6 +29,19 @@ interval = 60; }; + "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 = "{} {icon} ?"; + format-icons = { + has-updates = ""; + updated = ""; + }; + }; + "group/hardware" = { orientation = "inherit"; drawer = { @@ -39,6 +52,8 @@ "temperature" "power-profiles-daemon" "custom/left-arrow-light" + "custom/left-arrow-dark" + "custom/left-arrow-light" "disk" "custom/left-arrow-dark" "memory" @@ -159,6 +174,13 @@ on-click-right = "kitty -o confirm_os_window_close=0 btm"; }; + "custom/vpn" = { + format = "VPN "; + exec = "echo '{\"class\": \"connected\"}'"; + exec-if = "test -d /proc/sys/net/ipv4/conf/tun0"; + return-type = "json"; + interval = 5; + }; battery = { states = { "warning" = 60; diff --git a/programs/waybar/style.css b/programs/waybar/style.css index a7bed51..b8a2dc4 100644 --- a/programs/waybar/style.css +++ b/programs/waybar/style.css @@ -65,6 +65,11 @@ window#waybar.hidden { animation-direction: alternate; } +#custom-nix-updates { + color: white; + padding: 0 3px; +} + #custom-outer-right-arrow-dark, #custom-outer-left-arrow-dark { color: @background; @@ -95,16 +100,17 @@ window#waybar.hidden { #power-profiles-daemon, #mpris, #tray { - background: @background; + background: @background; } #network, +#custom-vpn, #clock.2, #battery, #cpu, #custom-pseudobat, #disk { - background: @background-alt; + background: @background-alt; } @@ -130,6 +136,7 @@ window#waybar.hidden { background: @foreground-critical; } +#custom-vpn, #network { color: #cc99c9; } @@ -220,6 +227,7 @@ window#waybar.hidden { #temperature, #power-profiles-daemon, #network, +#custom-vpn, #mpris, #battery, #custom-pseudobat, diff --git a/scripts/update-checker.sh b/scripts/update-checker.sh new file mode 100644 index 0000000..3126d13 --- /dev/null +++ b/scripts/update-checker.sh @@ -0,0 +1,13 @@ +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')" + +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' ) +fi + +echo "{ \"text\":\"$updates\", \"alt\":\"$alt\", \"tooltip\":\"$tooltip\" }"