Compare commits

...

4 Commits

Author SHA1 Message Date
Lennart J. Kurzweg (Nx2)
bb773f0dee flake bump 2025-07-21 00:03:36 +02:00
Lennart J. Kurzweg (Nx2)
35ad7c04e9 caldav_event fix 2025-07-21 00:03:17 +02:00
Lennart J. Kurzweg (Nx2)
31ef18fc34 opencode latest 2025-07-21 00:02:36 +02:00
Lennart J. Kurzweg (Nx2)
9cb47d96d9 move python to python 2025-07-21 00:02:28 +02:00
5 changed files with 96 additions and 89 deletions

98
flake.lock generated
View File

@@ -20,11 +20,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1751740947, "lastModified": 1752743471,
"narHash": "sha256-35040CHH7P3JGmhGVfEb2oJHL/A5mI2IXumhkxrBnao=", "narHash": "sha256-4izhj1j7J4mE8LgljCXSIUDculqOsxxhdoC81VhqizM=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "aquamarine", "repo": "aquamarine",
"rev": "dfc1db15a08c4cd234288f66e1199c653495301f", "rev": "e31b575d19e7cf8a8f4398e2f9cffe27a1332506",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -186,11 +186,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1752544374, "lastModified": 1752780124,
"narHash": "sha256-ReX0NG6nIAEtQQjLqeu1vUU2jjZuMlpymNtb4VQYeus=", "narHash": "sha256-5dn97vIYxn6VozKePOQSDxVCsrl38nDdMJXx86KIJH0=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "2e00ed310c218127e02ffcf28ddd4e0f669fde3e", "rev": "c718918222bdb104397762dea67e6b397a7927fe",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -245,11 +245,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1751808145, "lastModified": 1752149140,
"narHash": "sha256-OXgL0XaKMmfX2rRQkt9SkJw+QNfv0jExlySt1D6O72g=", "narHash": "sha256-gbh1HL98Fdqu0jJIWN4OJQN7Kkth7+rbkFpSZLm/62A=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "hyprgraphics", "repo": "hyprgraphics",
"rev": "b841473a0bd4a1a74a0b64f1ec2ab199035c349f", "rev": "340494a38b5ec453dfc542c6226481f736cc8a9a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -274,11 +274,11 @@
"xdph": "xdph" "xdph": "xdph"
}, },
"locked": { "locked": {
"lastModified": 1752611080, "lastModified": 1753033360,
"narHash": "sha256-KSilz1CULyQlhEYIuGuEqSO9tbMxSsSAHEEWZxvF6jg=", "narHash": "sha256-iIiD0KTmJSxo66VvwpL8YbQA/SvGc8DasSfdXOCRXQc=",
"ref": "refs/heads/main", "ref": "refs/heads/main",
"rev": "8453fbf4eb0af2e3265fd34a693b7d0e9167f4d2", "rev": "462729d8655a3a37ba19fe254d8ecb6677963563",
"revCount": 6276, "revCount": 6302,
"submodules": true, "submodules": true,
"type": "git", "type": "git",
"url": "https://github.com/hyprwm/Hyprland" "url": "https://github.com/hyprwm/Hyprland"
@@ -306,11 +306,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1752254688, "lastModified": 1753028264,
"narHash": "sha256-XJJ+frO4NOxVkoSGc1Mag8ESumzx2FmVRspOgFlMqF8=", "narHash": "sha256-GbfsRZWW5uBAOeddLkmrYV2XmAbI0etVUTBXFH5thcw=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "hyprland-plugins", "repo": "hyprland-plugins",
"rev": "d723e5b153b7990d36e62a425bda3768c41dd9eb", "rev": "14f9a444793d6dd78c29033acf9c3c974ded708d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -449,11 +449,11 @@
"systems": "systems_2" "systems": "systems_2"
}, },
"locked": { "locked": {
"lastModified": 1751272032, "lastModified": 1752663231,
"narHash": "sha256-493llKN7yyLkKlz8uYVAyvXH261IpDzuVA+TnewFIAg=", "narHash": "sha256-rTItuAWpzICMREF8Ww8cK4hYgNMRXJ4wjkN0akLlaWE=",
"owner": "KZDKM", "owner": "KZDKM",
"repo": "Hyprspace", "repo": "Hyprspace",
"rev": "847a770436e1ecebdbe5ed006a93db7666937ff2", "rev": "0a82e3724f929de8ad8fb04d2b7fa128493f24f7",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -474,11 +474,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1751888065, "lastModified": 1752252310,
"narHash": "sha256-F2SV9WGqgtRsXIdUrl3sRe0wXlQD+kRRZcSfbepjPJY=", "narHash": "sha256-06i1pIh6wb+sDeDmWlzuPwIdaFMxLlj1J9I5B9XqSeo=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "hyprutils", "repo": "hyprutils",
"rev": "a8229739cf36d159001cfc203871917b83fdf917", "rev": "bcabcbada90ed2aacb435dc09b91001819a6dc82",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -499,11 +499,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1751881472, "lastModified": 1751897909,
"narHash": "sha256-meB0SnXbwIe2trD041MLKEv6R7NZ759QwBcVIhlSBfE=", "narHash": "sha256-FnhBENxihITZldThvbO7883PdXC/2dzW4eiNvtoV5Ao=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "hyprwayland-scanner", "repo": "hyprwayland-scanner",
"rev": "8fb426b3e5452fd9169453fd6c10f8c14ca37120", "rev": "fcca0c61f988a9d092cbb33e906775014c61579d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -542,11 +542,11 @@
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
"lastModified": 1752199438, "lastModified": 1752682362,
"narHash": "sha256-xSBMmGtq8K4Qv80TMqREmESCAsRLJRHAbFH2T/2Bf1Y=", "narHash": "sha256-ZNIpqCG/CfhmV+TgIeyO/XbhDjSWpwWokHM44j0Mn0w=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NixOS-WSL", "repo": "NixOS-WSL",
"rev": "d34d9412556d3a896e294534ccd25f53b6822e80", "rev": "20001f9bf0aaf2b1c307e43a5eec8cf8f800fe14",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -558,11 +558,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1751792365, "lastModified": 1752687322,
"narHash": "sha256-J1kI6oAj25IG4EdVlg2hQz8NZTBNYvIS0l4wpr9KcUo=", "narHash": "sha256-RKwfXA4OZROjBTQAl9WOZQFm7L8Bo93FQwSJpAiSRvo=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "1fd8bada0b6117e6c7eb54aad5813023eed37ccb", "rev": "6e987485eb2c77e5dcc5af4e3c70843711ef9251",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -574,11 +574,11 @@
}, },
"nixpkgs-latest": { "nixpkgs-latest": {
"locked": { "locked": {
"lastModified": 1752614774, "lastModified": 1753047113,
"narHash": "sha256-HD5CuswJyMHtnu3qfy+ZXL31UiUv1He/P3PkcCFKsGE=", "narHash": "sha256-3/8rVDPoYDxi69Ea+m3plWS4d5hdQw3TSWkT8Px/SYQ=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "bcf19e8298233816810cefc84c95b1616c531ade", "rev": "728cf36ba13356f600ed0dd57cfec21dc9db9c40",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -606,11 +606,11 @@
}, },
"nixpkgs-unstable": { "nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1752480373, "lastModified": 1752950548,
"narHash": "sha256-JHQbm+OcGp32wAsXTE/FLYGNpb+4GLi5oTvCxwSoBOA=", "narHash": "sha256-NS6BLD0lxOrnCiEOcvQCDVPXafX1/ek1dfJHX1nUIzc=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "62e0f05ede1da0d54515d4ea8ce9c733f12d9f08", "rev": "c87b95e25065c028d31a94f06a62927d18763fdf",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -653,11 +653,11 @@
}, },
"nixpkgs_4": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1752436162, "lastModified": 1752866191,
"narHash": "sha256-Kt1UIPi7kZqkSc5HVj6UY5YLHHEzPBkgpNUByuyxtlw=", "narHash": "sha256-NV4S2Lf2hYmZQ3Qf4t/YyyBaJNuxLPyjzvDma0zPp/M=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "dfcd5b901dbab46c9c6e80b265648481aafb01f8", "rev": "f01fe91b0108a7aff99c99f2e9abbc45db0adc2a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -668,11 +668,11 @@
}, },
"nixpkgs_5": { "nixpkgs_5": {
"locked": { "locked": {
"lastModified": 1747312588, "lastModified": 1752596105,
"narHash": "sha256-MmJvj6mlWzeRwKGLcwmZpKaOPZ5nJb/6al5CXqJsgjo=", "narHash": "sha256-lFNVsu/mHLq3q11MuGkMhUUoSXEdQjCHvpReaGP1S2k=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "b1bebd0fe266bbd1820019612ead889e96a8fa2d", "rev": "dab3a6e781554f965bde3def0aa2fda4eb8f1708",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -776,11 +776,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1747363019, "lastModified": 1752633862,
"narHash": "sha256-N4dwkRBmpOosa4gfFkFf/LTD8oOcNkAyvZ07JvRDEf0=", "narHash": "sha256-Bj7ozT1+5P7NmvDcuAXJvj56txcXuAhk3Vd9FdWFQzk=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "0e624f2b1972a34be1a9b35290ed18ea4b419b6f", "rev": "8668ca94858206ac3db0860a9dec471de0d995f8",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -902,11 +902,11 @@
"rust-overlay": "rust-overlay_2" "rust-overlay": "rust-overlay_2"
}, },
"locked": { "locked": {
"lastModified": 1752505691, "lastModified": 1752991917,
"narHash": "sha256-kc52obJrTpkXIjT/r0f4Be78gy0QqbrzX7sTyrETirk=", "narHash": "sha256-6lPpUv6Iqb29ir7g1ImWk8MzSEzhyEbHw0k0z6AMQG8=",
"owner": "sxyazi", "owner": "sxyazi",
"repo": "yazi", "repo": "yazi",
"rev": "60a2382087f2327e4e48f662b71a862886a06423", "rev": "74bd98031e04b0455f83bed8b7970967a3ec9a1e",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -7,10 +7,7 @@
# nixd # specified in nixd.nix # nixd # specified in nixd.nix
gopls gopls
delve delve
python311Packages.python-lsp-server
jdt-language-server jdt-language-server
ruff
pyright
lldb # debugger for llvm stuff lldb # debugger for llvm stuff
yaml-language-server # yaml yaml-language-server # yaml
marksman # markdown marksman # markdown

View File

@@ -1,7 +1,7 @@
{ pkgs, ... }@all: with all; { { pkgs, ... }@all: with all; {
home = { home = {
packages = with pkgs; [ packages = with pkgs; [
unstable.opencode latest.opencode
]; ];
file.".config/opencode/opencode.json".text = let file.".config/opencode/opencode.json".text = let
model = "qwen2.5-coder:7b"; model = "qwen2.5-coder:7b";

View File

@@ -10,7 +10,11 @@
in { in {
packages = [ packages = [
python-with-packages python-with-packages
]; ] ++ (with pkgs; [
python311Packages.python-lsp-server
ruff
pyright
]);
sessionVariables = { sessionVariables = {
PYTHONPATH = "${python-with-packages}/${python-with-packages.sitePackages}"; PYTHONPATH = "${python-with-packages}/${python-with-packages.sitePackages}";
}; };

View File

@@ -4,8 +4,8 @@ in {
sops.secrets = { sops.secrets = {
"nx2site/radicale/password" = { }; "nx2site/radicale/password" = { };
}; };
home.packages = with pkgs; [ home.packages = [
(writeShellApplication { name = "waybar_mode"; text = /*bash*/ '' (pkgs.writeShellApplication { name = "waybar_mode"; text = /*bash*/ ''
print_help() { print_help() {
echo "Usage: waybar_mode {set <string>|unset}" echo "Usage: waybar_mode {set <string>|unset}"
} }
@@ -36,7 +36,7 @@ in {
esac esac
exit 0 exit 0
'';}) '';})
(writeShellApplication { name = "cclock"; text = /*bash*/ '' (pkgs.writeShellApplication { name = "cclock"; text = /*bash*/ ''
ord=$(date +"%e" | awk '{printf("%d%s\n", $1, ($1==11||$1==12||$1==13)?"th":((($1%10)==1)?"st":((($1%10)==2)?"nd":((($1%10)==3)?"rd":"th"))))}') ord=$(date +"%e" | awk '{printf("%d%s\n", $1, ($1==11||$1==12||$1==13)?"th":((($1%10)==1)?"st":((($1%10)==2)?"nd":((($1%10)==3)?"rd":"th"))))}')
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
echo "󰃮${sep}$(date +'%A the')" "$ord" "of" "$(date +'%B')" " ${sep}$(date +'%R')" echo "󰃮${sep}$(date +'%A the')" "$ord" "of" "$(date +'%B')" " ${sep}$(date +'%R')"
@@ -44,9 +44,9 @@ in {
echo "$(date +'%A the')" "$ord" "of" "$(date +'%B')" "$(date +'%R')" echo "$(date +'%A the')" "$ord" "of" "$(date +'%B')" "$(date +'%R')"
fi fi
'';}) '';})
(writers.writePython3Bin "caldav_event" { (pkgs.writers.writePython3Bin "caldav_event" {
libraries = with pkgs.python3Packages; [ caldav ics pytz ]; libraries = with pkgs.python3Packages; [ caldav ics pytz ];
flakeIgnore = [ "E302" "E305""E501" "E261" ]; flakeIgnore = [ "E302" "E305" "E501" "E261" ];
} /* python */ '' } /* python */ ''
import os import os
import json import json
@@ -81,7 +81,7 @@ def load_cache(cache_file):
def save_cache(cache_file, data): def save_cache(cache_file, data):
with open(cache_file, "w") as file: with open(cache_file, "w") as file:
json.dump(data, file, default=datetime_converter) json.dump(data, file, default=datetime_converter, indent=4)
def get_ongoing_or_next_event(url, username, password): def get_ongoing_or_next_event(url, username, password):
@@ -117,44 +117,50 @@ def get_ongoing_or_next_event(url, username, password):
print(f"Error accessing {url}: {e}") print(f"Error accessing {url}: {e}")
return None return None
def is_expired(event_dict: dict):
now = datetime.now(timezone.utc).timestamp()
event_start = event_dict['event_begin'].timestamp()
event_end = event_dict['event_end'].timestamp()
return not (event_start <= now <= event_end)
if __name__ == "__main__": if __name__ == "__main__":
password_file = "/home/nx2/.config/sops-nix/secrets/nx2site/radicale/password" # Path to password file password_file = "${config.sops.secrets."nx2site/radicale/password".path}" # Path to password file
cache_file = "/tmp/caldav_event_cache.json" # Path to cache file cache_file = "/tmp/caldav_event_cache.json" # Path to cache file
url = "https://dav.${hyper.domain}/" url = "https://dav.${hyper.domain}/"
username = "${hyper.user}" username = "nx2"
password = get_password(password_file) password = get_password(password_file)
event_dict = load_cache(cache_file)
now = datetime.now(timezone.utc).timestamp() now = datetime.now(timezone.utc).timestamp()
if event_dict is None or event_dict['event_begin'].timestamp() <= now and now < event_dict['event_end'].timestamp(): event_dict = load_cache(cache_file)
event_dict = get_ongoing_or_next_event(url, username, password)
if event_dict is None: if (event_dict is None) or (is_expired(event_dict)):
print("No upcoming events found.") event_dict = get_ongoing_or_next_event(url, username, password)
exit(0) save_cache(cache_file, event_dict)
cache_data = {
"event_name": event_dict['event_name'] if event_dict is not None else None, if event_dict is None: # none were found
"event_begin": event_dict['event_begin'] if event_dict is not None else None, print("* zen *")
"event_end": event_dict['event_end'] if event_dict is not None else None exit(0)
}
save_cache(cache_file, cache_data)
if event_dict:
event_start = event_dict['event_begin'].timestamp() event_start = event_dict['event_begin'].timestamp()
event_end = event_dict['event_end'].timestamp() event_end = event_dict['event_end'].timestamp()
if event_start <= now <= event_end: if event_start <= now <= event_end: # is currently ongoing
time_remaining = event_end - now action_string = "ends"
hours, rem = divmod(int(time_remaining), 3600) t = event_end - now # time_remaining
else: # is in the future
action_string = "starts"
t = event_start - now # time_remaining
hours, rem = divmod(int(t), 3600)
minutes, _ = divmod(rem, 60) minutes, _ = divmod(rem, 60)
print(f"{event_dict['event_name']} ends in {hours} hour{'s ' if hours != 1 else ' '}and {minutes} minute{'s ' if minutes != 1 else ' '}") hour_string = f"{hours} hour{'s ' if hours != 1 else ' '}and " if hours > 0 else ""
minu_string = f"{minutes} minute{'s ' if minutes != 1 else ' '}" if minutes > 0 else ""
if hour_string == "" and minu_string == "":
time_string = "now"
else: else:
time_until_start = event_start - now time_string = "in " + hour_string + minu_string
hours, rem = divmod(int(time_until_start), 3600)
minutes, _ = divmod(rem, 60) print(f"{event_dict['event_name']} {action_string} {time_string}")
print(f"{event_dict['event_name']} starts in {hours} hour{'s ' if hours != 1 else ' '}and {minutes} minute{'s ' if minutes != 1 else ' '}")
else:
print("No upcoming events found.")
'') '')
]; ];