added a user service that tracks new updates for packages that I maintain, also moved the login sound from the hyprland config to a systemd service that triggers after graphical-session.target
This commit is contained in:
BIN
assets/images/nixos-icon-generic.png
Normal file
BIN
assets/images/nixos-icon-generic.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 68 KiB |
@@ -3,6 +3,7 @@
|
|||||||
./gtk.nix
|
./gtk.nix
|
||||||
./spicetify.nix
|
./spicetify.nix
|
||||||
./stylixhome.nix
|
./stylixhome.nix
|
||||||
|
./userservices.nix
|
||||||
./starship.nix
|
./starship.nix
|
||||||
./userpkgs.nix
|
./userpkgs.nix
|
||||||
./zshell.nix
|
./zshell.nix
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ in {
|
|||||||
"systemctl --user import-environment &"
|
"systemctl --user import-environment &"
|
||||||
"hash dbus-update-activation-environment 2>/dev/null &"
|
"hash dbus-update-activation-environment 2>/dev/null &"
|
||||||
"dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP &"
|
"dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP &"
|
||||||
"aplay ${self}/assets/sound/login.wav &"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
workspace = if (config.movOpts.envConfig.hyprlandConfig.workspaceLayout
|
workspace = if (config.movOpts.envConfig.hyprlandConfig.workspaceLayout
|
||||||
|
|||||||
@@ -134,7 +134,7 @@
|
|||||||
color: @text;
|
color: @text;
|
||||||
/* color: @theme_text_color; */
|
/* color: @theme_text_color; */
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
padding: 0px;
|
padding-left: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.time {
|
.time {
|
||||||
@@ -154,10 +154,12 @@
|
|||||||
/* color: alpha(@theme_text_color, 0.9); */
|
/* color: alpha(@theme_text_color, 0.9); */
|
||||||
text-shadow: none;
|
text-shadow: none;
|
||||||
margin: 0px 0px 0px 0px;
|
margin: 0px 0px 0px 0px;
|
||||||
|
padding-left: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.body-image {
|
.body-image {
|
||||||
border-radius: 4px;
|
border-radius: 2px;
|
||||||
|
padding-right: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The "Notifications" and "Do Not Disturb" text widget */
|
/* The "Notifications" and "Do Not Disturb" text widget */
|
||||||
|
|||||||
108
modules/home/environment/userservices.nix
Normal file
108
modules/home/environment/userservices.nix
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
{ pkgs, self, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
check_updates = pkgs.stdenv.mkDerivation {
|
||||||
|
pname = "pkg_maintenance_check";
|
||||||
|
version = "1.0";
|
||||||
|
src = ./.;
|
||||||
|
buildPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
cat > $out/bin/checkupdates.py <<- EOF
|
||||||
|
import os, re, json, requests, subprocess
|
||||||
|
root_dir = '/home/pagedmov/Nix/nixpkgs/pkgs'
|
||||||
|
target_maintainer = 'pagedMov'
|
||||||
|
packages = []
|
||||||
|
pname_pattern = re.compile(r'pname\s*=\s*"([^"]+)"')
|
||||||
|
version_pattern = re.compile(r'version\s*=\s*"([^"]+)"')
|
||||||
|
maintainer_pattern = re.compile(r'maintainers\s*=\s*with\s*lib\.maintainers;\s*\[([^\]]+)\]')
|
||||||
|
repo_pattern = re.compile(r'homepage\s*=\s*"([^"]+)"')
|
||||||
|
for dirpath, _, filenames in os.walk(root_dir):
|
||||||
|
for filename in filenames:
|
||||||
|
file_path = os.path.join(dirpath, filename)
|
||||||
|
try:
|
||||||
|
with open(file_path, 'r', encoding='utf-8') as file:
|
||||||
|
content = file.read()
|
||||||
|
pname_match = pname_pattern.search(content)
|
||||||
|
version_match = version_pattern.search(content)
|
||||||
|
maintainer_match = maintainer_pattern.search(content)
|
||||||
|
repo_match = repo_pattern.search(content)
|
||||||
|
if pname_match and version_match and maintainer_match and repo_match:
|
||||||
|
maintainers = maintainer_match.group(1).split()
|
||||||
|
if target_maintainer in maintainers:
|
||||||
|
package_info = {'pname': pname_match.group(1), 'version': version_match.group(1), 'repo': repo_match.group(1)}
|
||||||
|
packages.append(package_info)
|
||||||
|
except (UnicodeDecodeError, IOError):
|
||||||
|
pass
|
||||||
|
print(json.dumps(packages, indent=2))
|
||||||
|
github_api_template = "https://api.github.com/repos/{owner}/{repo}/releases/latest"
|
||||||
|
updates = []
|
||||||
|
for package in packages:
|
||||||
|
repo_url = package["repo"]
|
||||||
|
current_version = package["version"]
|
||||||
|
if "github.com" in repo_url:
|
||||||
|
owner_repo = repo_url.split("github.com/")[1]
|
||||||
|
if owner_repo.endswith("/"):
|
||||||
|
owner_repo = owner_repo[:-1]
|
||||||
|
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})
|
||||||
|
else:
|
||||||
|
print(f"{package['pname']} is up to date.\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 = '''
|
||||||
|
for update in updates:
|
||||||
|
update_string += f" {update['pkg']} -> {update['version']}\n"
|
||||||
|
subprocess.run(["notify-send", "--icon=/home/pagedmov/.sysflake/assets/images/nixos-icon-generic.png", "Maintenance Update", f"Updates found:\n{update_string}"])
|
||||||
|
subprocess.run(["aplay", "-q", "-N", "/home/pagedmov/.sysflake/assets/sound/login.wav"])
|
||||||
|
EOF
|
||||||
|
'';
|
||||||
|
buildInputs = with pkgs; [ python3Packages.requests ];
|
||||||
|
installPhase = ":";
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
systemd.user = {
|
||||||
|
timers = {
|
||||||
|
maintenanceCheck = {
|
||||||
|
Unit = { Description = "Timer for package maintenance check"; };
|
||||||
|
Timer = {
|
||||||
|
OnCalendar = "hourly";
|
||||||
|
Persistent = true;
|
||||||
|
};
|
||||||
|
Install = { WantedBy = [ "timers.target" ]; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
services = {
|
||||||
|
loginSound = {
|
||||||
|
Unit= {
|
||||||
|
description = "Plays a sound on login";
|
||||||
|
After = [ "graphical-session.target" ];
|
||||||
|
WantedBy = [ "graphical-session.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
Service = {
|
||||||
|
ExecStart = "${pkgs.alsa-utils}/bin/aplay -qN ${self}/assets/sound/login.wav";
|
||||||
|
Type = "simple";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
maintenanceCheck = {
|
||||||
|
Unit = {
|
||||||
|
description = "Check for updates in my maintained packages";
|
||||||
|
};
|
||||||
|
|
||||||
|
Service = {
|
||||||
|
ExecStart = "${pkgs.nix}/bin/nix-shell -p python3Packages.requests --run '${pkgs.python311}/bin/python ${check_updates}/bin/checkupdates.py'";
|
||||||
|
Type = "simple";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
programs.nixvim.plugins.chatgpt = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
api_key_cmd = "pass keys/openai/apikey";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
# ./coq.nix
|
# ./coq.nix
|
||||||
./barbar.nix
|
./barbar.nix
|
||||||
./cmp.nix
|
./cmp.nix
|
||||||
./chatgpt.nix
|
|
||||||
./lsp.nix
|
./lsp.nix
|
||||||
./fidget.nix
|
./fidget.nix
|
||||||
./lualine.nix
|
./lualine.nix
|
||||||
|
|||||||
Reference in New Issue
Block a user