From 2431e4361bc59c7a238d8e1810b0e2bf292fd9c5 Mon Sep 17 00:00:00 2001 From: pagedmov Date: Fri, 15 Nov 2024 12:10:21 -0500 Subject: [PATCH] Adapted hyprland configurations for new breaking changes, and some misc adjustments adjusted hyprland config for new breaking changes capitalized 'Description' keys in userservices altered shell aliases and added missing autosuggest option in zsh/options.nix rebuild now has dry run flags added hyprpaper to packages.nix updated check_updates service to check the upstream nixpkgs channel instead of my local flake pkgs --- flake.lock | 143 +++++++++++----------- modules/home/environment/hyprland.nix | 8 -- modules/home/environment/userservices.nix | 4 +- modules/home/environment/zsh/aliases.nix | 1 - modules/home/environment/zsh/options.nix | 5 + modules/home/scripts/nix/rebuild.nix | 7 +- modules/sys/software/packages.nix | 1 + overlay/check_updates/package.nix | 122 ++++++++++-------- 8 files changed, 156 insertions(+), 135 deletions(-) diff --git a/flake.lock b/flake.lock index b09005c..5a7e915 100755 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ ] }, "locked": { - "lastModified": 1729527199, - "narHash": "sha256-D5/YksfRga8Akd04ZtIkuYSIOjXVrAzQIQBSeplokzU=", + "lastModified": 1731496216, + "narHash": "sha256-nlQrNN+tmJ+iP6Ck/czwZI0Hxz3oNvUyGkVruxJwgwA=", "owner": "hyprwm", "repo": "aquamarine", - "rev": "8d732fa8aff8b12ef2b1e2f00fc8153e41312b72", + "rev": "3b00e96f90cb0040de6d88ad99bf5f4d443f0c59", "type": "github" }, "original": { @@ -190,11 +190,11 @@ ] }, "locked": { - "lastModified": 1727826117, - "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", + "lastModified": 1730504689, + "narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", + "rev": "506278e768c2a08bec68eb62932193e341f55c90", "type": "github" }, "original": { @@ -275,11 +275,11 @@ ] }, "locked": { - "lastModified": 1730302582, - "narHash": "sha256-W1MIJpADXQCgosJZT8qBYLRuZls2KSiKdpnTVdKBuvU=", + "lastModified": 1731363552, + "narHash": "sha256-vFta1uHnD29VUY4HJOO/D6p6rxyObnf+InnSMT4jlMU=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "af8a16fe5c264f5e9e18bcee2859b40a656876cf", + "rev": "cd1af27aa85026ac759d5d3fccf650abe7e1bbf0", "type": "github" }, "original": { @@ -356,11 +356,11 @@ ] }, "locked": { - "lastModified": 1730490306, - "narHash": "sha256-AvCVDswOUM9D368HxYD25RsSKp+5o0L0/JHADjLoD38=", + "lastModified": 1731604581, + "narHash": "sha256-Qq2YZZaDTB3FZLWU/Hgh1uuWlUBl3cMLGB99bm7rFUM=", "owner": "nix-community", "repo": "home-manager", - "rev": "1743615b61c7285976f85b303a36cdf88a556503", + "rev": "1d0862ee2d7c6f6cd720d6f32213fa425004be10", "type": "github" }, "original": { @@ -377,11 +377,11 @@ ] }, "locked": { - "lastModified": 1730016908, - "narHash": "sha256-bFCxJco7d8IgmjfNExNz9knP8wvwbXU4s/d53KOK6U0=", + "lastModified": 1731535640, + "narHash": "sha256-2EckCJn4wxran/TsRiCOFcmVpep2m9EBKl99NBh2GnM=", "owner": "nix-community", "repo": "home-manager", - "rev": "e83414058edd339148dc142a8437edb9450574c8", + "rev": "35b055009afd0107b69c286fca34d2ad98940d57", "type": "github" }, "original": { @@ -416,11 +416,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1729224425, - "narHash": "sha256-w9dNUedNe2qnhHuhcRf7A1l29+/6DxdMfwN6g4U3c/w=", + "lastModified": 1730743354, + "narHash": "sha256-gU4NySYyXeAzVaF5bI6BKmj2CdgiwGFnuPjXUId3Dx0=", "owner": "hyprwm", "repo": "contrib", - "rev": "d72bc8b1cd30d448bd438e8328f8eeb4c0f2ddb6", + "rev": "792f6b83dc719214e0e2a0b380c34f147b28ece2", "type": "github" }, "original": { @@ -472,11 +472,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1730499652, - "narHash": "sha256-De3YRKpowtm15xN7hK0PdBpu96wwSyQE+qFoq9Gi6lM=", + "lastModified": 1731631654, + "narHash": "sha256-a6gy39yki4mX/Oj83aG08nNntXxXhM1wjksNXGZ8x5c=", "ref": "refs/heads/main", - "rev": "32b18179dd789cde948c97eb3c2ebbdd6af36bf7", - "revCount": 5402, + "rev": "098e491a43e8b26f4382b48651a4131464bf6a2f", + "revCount": 5456, "submodules": true, "type": "git", "url": "https://github.com/hyprwm/Hyprland" @@ -549,11 +549,11 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1729810282, - "narHash": "sha256-ARBFaV1LtNfdvosdMuhVKX+q11JTx59Ed7/QK+BFmMc=", + "lastModified": 1731193353, + "narHash": "sha256-oiNuCxbwtfLOPGEoXjsojdVOXNEL5aFPtdELdaz65hw=", "owner": "hyprwm", "repo": "hyprpicker", - "rev": "89b9352d26cc0fd13cd6dc0a77ac18c795a44e59", + "rev": "4e8837ddabf669600c9571189e8a6a7937ba336a", "type": "github" }, "original": { @@ -574,11 +574,11 @@ ] }, "locked": { - "lastModified": 1728941256, - "narHash": "sha256-WRypmcZ2Bw94lLmcmxYokVOHPJSZ7T06V49QZ4tkZeQ=", + "lastModified": 1731518387, + "narHash": "sha256-aZZw1ZvTMLkcA6udlvkA3hrCkuipoWLy8s/JNnIclxY=", "owner": "hyprwm", "repo": "hyprutils", - "rev": "fd4be8b9ca932f7384e454bcd923c5451ef2aa85", + "rev": "315fba5d21d87ddb756d4bebdb49f99d86b0ffe8", "type": "github" }, "original": { @@ -676,16 +676,16 @@ ] }, "locked": { - "lastModified": 1729544999, - "narHash": "sha256-YcyJLvTmN6uLEBGCvYoMLwsinblXMkoYkNLEO4WnKus=", + "lastModified": 1729958008, + "narHash": "sha256-EiOq8jF4Z/zQe0QYVc3+qSKxRK//CFHMB84aYrYGwEs=", "owner": "NuschtOS", "repo": "ixx", - "rev": "65c207c92befec93e22086da9456d3906a4e999c", + "rev": "9fd01aad037f345350eab2cd45e1946cc66da4eb", "type": "github" }, "original": { "owner": "NuschtOS", - "ref": "v0.0.5", + "ref": "v0.0.6", "repo": "ixx", "type": "github" } @@ -698,11 +698,11 @@ ] }, "locked": { - "lastModified": 1730184279, - "narHash": "sha256-6OB+WWR6gnaWiqSS28aMJypKeK7Pjc2Wm6L0MtOrTuA=", + "lastModified": 1731454423, + "narHash": "sha256-TtwvgFxUa0wyptLhQbKaixgNW1UXf3+TDqfX3Kp63oM=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "b379bd4d872d159e5189053ce9a4adf86d56db4b", + "rev": "6c71c49e2448e51ad830ed211024e6d0edc50116", "type": "github" }, "original": { @@ -729,11 +729,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1720386169, - "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", + "lastModified": 1730741070, + "narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "194846768975b7ad2c4988bdb82572c00222c0d7", + "rev": "d063c1dd113c91ab27959ba540c0d9753409edf3", "type": "github" }, "original": { @@ -745,11 +745,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1729413321, - "narHash": "sha256-I4tuhRpZFa6Fu6dcH9Dlo5LlH17peT79vx1y1SpeKt0=", + "lastModified": 1731139594, + "narHash": "sha256-IigrKK3vYRpUu+HEjPL/phrfh7Ox881er1UEsZvw9Q4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1997e4aa514312c1af7e2bda7fad1644e778ff26", + "rev": "76612b17c0ce71689921ca12d9ffdc9c23ce40b2", "type": "github" }, "original": { @@ -777,11 +777,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1730200266, - "narHash": "sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU=", + "lastModified": 1731319897, + "narHash": "sha256-PbABj4tnbWFMfBp6OcUK5iGy1QY+/Z96ZcLpooIbuEI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "807e9154dcb16384b1b765ebe9cd2bba2ac287fd", + "rev": "dc460ec76cbff0e66e269457d7b728432263166c", "type": "github" }, "original": { @@ -793,11 +793,11 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1725194671, - "narHash": "sha256-tLGCFEFTB5TaOKkpfw3iYT9dnk4awTP/q4w+ROpMfuw=", + "lastModified": 1731531548, + "narHash": "sha256-sz8/v17enkYmfpgeeuyzniGJU0QQBfmAjlemAUYhfy8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b833ff01a0d694b910daca6e2ff4a3f26dee478c", + "rev": "24f0d4acd634792badd6470134c387a3b039dace", "type": "github" }, "original": { @@ -822,11 +822,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1730499477, - "narHash": "sha256-olt0Sx4alDxv3ko9BgbV3SsE2KQ/Tf0/Az1Fr9s2Y6U=", + "lastModified": 1731675303, + "narHash": "sha256-Pd0ZZICCwwDIE+ruHTDg8Oaizna5bJrdw5BSTht+Pdc=", "owner": "nix-community", "repo": "nixvim", - "rev": "356896f58dde22ee16481b7c954e340dceec340d", + "rev": "46e574d4ea1642dd87a6bfb162053c52b2e4878b", "type": "github" }, "original": { @@ -837,11 +837,11 @@ }, "nur": { "locked": { - "lastModified": 1730540878, - "narHash": "sha256-JYfoVW5lsfv4bo87U6mqbC3Jh+EBImU5iUsHJlOkyAI=", + "lastModified": 1731682507, + "narHash": "sha256-1gZCrmPQ3mWwXl3b3KM53DuS0SVpvZB+qwJcMT1qDB8=", "owner": "nix-community", "repo": "NUR", - "rev": "57df81c2bcabc503171defb232a0e11710ddaaf9", + "rev": "dd830ca21979e6566596d7acaa5d761d4421c278", "type": "github" }, "original": { @@ -860,11 +860,11 @@ ] }, "locked": { - "lastModified": 1730337772, - "narHash": "sha256-uTxvqDohfG85+zldO5Tf1B+fuAF8ZhMouNwG5S6OAnA=", + "lastModified": 1731347683, + "narHash": "sha256-BcSWCEUBShuB32LPif+EG0XGXyUi2jyjCSpGE1rbOws=", "owner": "NuschtOS", "repo": "search", - "rev": "4e0a7a95a3df3333771abc4df6a656e7baf67106", + "rev": "135d202e032be70c93b6d7d53592ef4799d6efde", "type": "github" }, "original": { @@ -884,11 +884,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1729104314, - "narHash": "sha256-pZRZsq5oCdJt3upZIU4aslS9XwFJ+/nVtALHIciX/BI=", + "lastModified": 1731363552, + "narHash": "sha256-vFta1uHnD29VUY4HJOO/D6p6rxyObnf+InnSMT4jlMU=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "3c3e88f0f544d6bb54329832616af7eb971b6be6", + "rev": "cd1af27aa85026ac759d5d3fccf650abe7e1bbf0", "type": "github" }, "original": { @@ -918,11 +918,11 @@ ] }, "locked": { - "lastModified": 1730521028, - "narHash": "sha256-vZtg4J+jOADDKgS+s821PeJiTXfawan8mzX3JM3xjqc=", + "lastModified": 1731644206, + "narHash": "sha256-J4HjGCDIJTBjlzhHDjQpbci/fMIE8eNcgOAKbDJUlBs=", "owner": "gerg-l", "repo": "spicetify-nix", - "rev": "191323d81e19efa0be5071e17263851e62f35685", + "rev": "f8f8cac5aabb30009610e7ee4b56f04291577a12", "type": "github" }, "original": { @@ -948,11 +948,11 @@ "tinted-tmux": "tinted-tmux" }, "locked": { - "lastModified": 1729963473, - "narHash": "sha256-uGjTjvvlGQfQ0yypVP+at0NizI2nrb6kz4wGAqzRGbY=", + "lastModified": 1731657386, + "narHash": "sha256-Mm/JL8tFUS1SOmmZDPcswExUxzw0VpHcEyZI1h58CGA=", "owner": "danth", "repo": "stylix", - "rev": "04afcfc0684d9bbb24bb1dc77afda7c1843ec93b", + "rev": "5ab1207b2fdeb5a022f2dd7cccf6be760f1b150f", "type": "github" }, "original": { @@ -1024,16 +1024,17 @@ "tinted-foot": { "flake": false, "locked": { - "lastModified": 1696725948, - "narHash": "sha256-65bz2bUL/yzZ1c8/GQASnoiGwaF8DczlxJtzik1c0AU=", + "lastModified": 1726913040, + "narHash": "sha256-+eDZPkw7efMNUf3/Pv0EmsidqdwNJ1TaOum6k7lngDQ=", "owner": "tinted-theming", "repo": "tinted-foot", - "rev": "eedbcfa30de0a4baa03e99f5e3ceb5535c2755ce", + "rev": "fd1b924b6c45c3e4465e8a849e67ea82933fcbe4", "type": "github" }, "original": { "owner": "tinted-theming", "repo": "tinted-foot", + "rev": "fd1b924b6c45c3e4465e8a849e67ea82933fcbe4", "type": "github" } }, @@ -1119,11 +1120,11 @@ ] }, "locked": { - "lastModified": 1728166987, - "narHash": "sha256-w6dVTguAn9zJ+7aPOhBQgDz8bn6YZ7b56cY8Kg5HJRI=", + "lastModified": 1730743262, + "narHash": "sha256-iTLqj3lU8kFehPm5tXpctzkD274t/k1nwSSq3qCWXeg=", "owner": "hyprwm", "repo": "xdg-desktop-portal-hyprland", - "rev": "fb9c8d665af0588bb087f97d0f673ddf0d501787", + "rev": "09b23cef06fe248e61cec8862c04b9bcb62f4b6d", "type": "github" }, "original": { diff --git a/modules/home/environment/hyprland.nix b/modules/home/environment/hyprland.nix index acea048..ce1c6f1 100755 --- a/modules/home/environment/hyprland.nix +++ b/modules/home/environment/hyprland.nix @@ -125,7 +125,6 @@ in { }; dwindle = { - no_gaps_when_only = false; force_split = 0; special_scale_factor = 1.0; split_width_multiplier = 1.0; @@ -137,7 +136,6 @@ in { master = { new_status = "master"; special_scale_factor = 1; - no_gaps_when_only = false; }; decoration = { @@ -158,12 +156,6 @@ in { xray = true; }; - drop_shadow = true; - - shadow_ignore_window = true; - shadow_offset = "0 2"; - shadow_range = 20; - shadow_render_power = 3; }; animations = { diff --git a/modules/home/environment/userservices.nix b/modules/home/environment/userservices.nix index 7b338cc..026d012 100644 --- a/modules/home/environment/userservices.nix +++ b/modules/home/environment/userservices.nix @@ -15,7 +15,7 @@ services = { loginSound = { Unit= { - description = "Plays a sound on login"; + Description = "Plays a sound on login"; After = [ "graphical-session.target" ]; WantedBy = [ "graphical-session.target" ]; }; @@ -27,7 +27,7 @@ }; maintenanceCheck = { Unit = { - description = "Check for updates in my maintained packages"; + Description = "Check for updates in my maintained packages"; }; Service = { diff --git a/modules/home/environment/zsh/aliases.nix b/modules/home/environment/zsh/aliases.nix index 0ad8c9f..e1df0c1 100644 --- a/modules/home/environment/zsh/aliases.nix +++ b/modules/home/environment/zsh/aliases.nix @@ -23,7 +23,6 @@ iv = "invoke"; cfgfilecount = ''find $FLAKEPATH -name "*.nix" | wc -l | toilet -f 3d | lolcat''; - #git ga = "playshellsound ${self}/assets/sound/gitadd.wav; git add"; gcomm = "gitcommit_sfx"; diff --git a/modules/home/environment/zsh/options.nix b/modules/home/environment/zsh/options.nix index 5f1c801..a22d1f2 100644 --- a/modules/home/environment/zsh/options.nix +++ b/modules/home/environment/zsh/options.nix @@ -25,6 +25,11 @@ size = 10000; share = true; }; + + autosuggestion = { + enable = true; + highlight = "fg=#4C566A,underline"; + }; }; }; } diff --git a/modules/home/scripts/nix/rebuild.nix b/modules/home/scripts/nix/rebuild.nix index 16b755b..49dc40c 100755 --- a/modules/home/scripts/nix/rebuild.nix +++ b/modules/home/scripts/nix/rebuild.nix @@ -4,13 +4,16 @@ pkgs.writeShellApplication { text = '' hooray() { scheck && runbg aplay ${self}/assets/sound/update.wav; } damn() { scheck && runbg aplay ${self}/assets/sound/error.wav; } - [ $# -eq 0 ] && echo -e "\033[1;4;38;2;243;139;168mUsage\033[0m: rebuild -h for home config, rebuild -s for sys config, rebuild -a for both" && damn && exit 1 + [ $# -eq 0 ] && echo -e "\033[1;4;38;2;243;139;168mUsage\033[0m: rebuild -h for home config, rebuild -s for sys config, rebuild -a for both. Adding 'n' before the flag does a dry run, i.e. rebuild -nh" && damn && exit 1 scheck && runbg aplay ${self}/assets/sound/nixswitch-start.wav case $1 in "-h" ) if nh home switch -c ${host}Home "$FLAKEPATH"; then hooray; else damn; fi;; "-s" ) if nh os switch -H ${host} "$FLAKEPATH"; then hooray; else damn; fi;; "-a" ) if sudo sleep 0.1 && nh os switch -H ${host} "$FLAKEPATH" && nh home switch -c ${host}Home "$FLAKEPATH"; then hooray; else damn; fi;; - * ) echo -e "\033[1;4;38;2;243;139;168mUsage\033[0m: rebuild -h for home config, rebuild -s for sys config";; + "-nh" ) if nh home switch -n -c ${host}Home "$FLAKEPATH"; then hooray; else damn; fi;; + "-ns" ) if nh os switch -n -H ${host} "$FLAKEPATH"; then hooray; else damn; fi;; + "-na" ) if sudo sleep 0.1 && nh os switch -n -H ${host} "$FLAKEPATH" && nh home switch -n -c ${host}Home "$FLAKEPATH"; then hooray; else damn; fi;; + * ) echo -e "\033[1;4;38;2;243;139;168mUsage\033[0m: rebuild -h for home config, rebuild -s for sys config. Adding 'n' before the flag does a dry run, i.e. rebuild -nh" && damn && exit 1;; esac ''; } diff --git a/modules/sys/software/packages.nix b/modules/sys/software/packages.nix index d21e003..c009b3a 100755 --- a/modules/sys/software/packages.nix +++ b/modules/sys/software/packages.nix @@ -13,6 +13,7 @@ fail2ban git hyprland-workspaces + hyprpaper hyprpicker inetutils kitty diff --git a/overlay/check_updates/package.nix b/overlay/check_updates/package.nix index b0cd8ba..6092659 100644 --- a/overlay/check_updates/package.nix +++ b/overlay/check_updates/package.nix @@ -7,65 +7,85 @@ pkgs.stdenv.mkDerivation { buildPhase = '' mkdir -p $out/bin cat > $out/bin/checkupdates.py <<- EOF -import os, re, json, requests, subprocess -flakePath = os.getenv('FLAKEPATH') -def nix_eval(expr): +import json +import subprocess +import requests +def get_packages_by_maintainer(target_maintainer): try: + nix_env_command = [ + "nix-env", "--meta", "--json", "-qaP" + ] + jq_query = ( + 'to_entries[] | select(.value.meta.maintainers? // [] | ' + f'any(.github == "{target_maintainer}")) | .value' + ) result = subprocess.run( - ["nix", "eval", "--json", expr], + nix_env_command, capture_output=True, text=True, - check=True) - return json.loads(result.stdout) + check=True + ) + filtered_packages = subprocess.run( + ["jq", "-r", "-c", jq_query], + input=result.stdout, + capture_output=True, + text=True, + check=True + ) + return [json.loads(pkg) for pkg in filtered_packages.stdout.strip().split('\n') if pkg] except subprocess.CalledProcessError as e: - print(f"Error running 'nix eval' for {expr}: {e}") - return {} -packages = nix_eval(f"{flakePath}#pkgs.myPkgs") -target_maintainer = 'pagedMov' -maintained_packages = [] -for pname in packages.keys(): - maintainers_info = nix_eval(f"{flakePath}#pkgs.myPkgs.{pname}.meta.maintainers") - for maintainer in maintainers_info: - if maintainer.get('github') == target_maintainer: - # Collect relevant package details - version = nix_eval(f"{flakePath}#pkgs.myPkgs.{pname}.version") or "unknown" - repo_url = nix_eval(f"{flakePath}#pkgs.myPkgs.{pname}.meta.homepage") or "" - maintained_packages.append({ - 'pname': pname, - 'version': version, - 'repo': repo_url, - 'maintainers': maintainers_info - }) - break -print(json.dumps(maintained_packages, indent=2)) -github_api_template = "https://api.github.com/repos/{owner}/{repo}/releases/latest" -updates = [] -for package in maintained_packages: - repo_url = package["repo"] - current_version = package["version"] - if "github.com" in repo_url: - owner_repo = repo_url.split("github.com/")[1].rstrip('/') - owner, repo = owner_repo.split('/') - api_url = github_api_template.format(owner=owner, repo=repo) - response = requests.get(api_url) - if response.status_code == 200: - latest_release = response.json() - latest_version = latest_release.get("tag_name", "").lstrip('v') - if latest_version and latest_version != current_version: - updates.append({"pkg": package["pname"], "version": latest_version}) + print(f"Error running nix-env or jq: {e}") + return [] + +def check_github_releases(maintained_packages): + github_api_template = "https://api.github.com/repos/{owner}/{repo}/releases/latest" + updates = [] + + for package in maintained_packages: + pname = package.get("pname", "unknown") + repo_url = package.get("meta", {}).get("homepage", "") + current_version = package.get("version", "unknown") + + if "github.com" in repo_url: + owner_repo = repo_url.split("github.com/")[1].rstrip('/') + owner, repo = owner_repo.split('/') + api_url = github_api_template.format(owner=owner, repo=repo) + + response = requests.get(api_url) + if response.status_code == 200: + latest_release = response.json() + latest_version = latest_release.get("tag_name", "").lstrip('v') + if latest_version and latest_version != current_version: + updates.append({"pkg": pname, "version": latest_version}) + else: + print(f"{pname} is up to date.\n") else: - print(f"{package['pname']} is up to date.\n") + print(f"Failed to check version for {pname} (HTTP {response.status_code}).\n") else: - print(f"Failed to check version for {package['pname']} (HTTP {response.status_code}).\n") - else: - print(f"Skipping non-GitHub repository for {package['pname']}.\n") -if updates: - update_string = '\n'.join([f" {update['pkg']} -> {update['version']}" for update in updates]) - subprocess.run(["notify-send", "--icon=/home/pagedmov/.sysflake/assets/images/nixos-icon-generic.png", - "Maintenance Update", f"Package updates found:\n{update_string}"]) - subprocess.run(["aplay", "-q", "-N", "/home/pagedmov/.sysflake/assets/sound/login.wav"]) + print(f"Skipping non-GitHub repository for {pname}.\n") + return updates + +def notify_updates(updates): + if updates: + update_string = '\n'.join([f" {update['pkg']} -> {update['version']}" for update in updates]) + subprocess.run([ + "notify-send", + "--icon=/home/pagedmov/.sysflake/assets/images/nixos-icon-generic.png", + "Maintenance Update", + f"Package updates found:\n{update_string}" + ]) + subprocess.run(["aplay", "-q", "-N", "/home/pagedmov/.sysflake/assets/sound/login.wav"]) + +target_maintainer = "pagedMov" +maintained_packages = get_packages_by_maintainer(target_maintainer) + +if maintained_packages: + updates = check_github_releases(maintained_packages) + notify_updates(updates) +else: + print(f"No packages maintained by {target_maintainer} were found.") EOF ''; - buildInputs = with pkgs; [ python3Packages.requests ]; + buildInputs = with pkgs; [ python3Packages.requests jq ]; installPhase = ":"; }