time zone and weather is now location based!!
This commit is contained in:
parent
696e37e35c
commit
72f438bdae
4 changed files with 55 additions and 16 deletions
27
default.nix
27
default.nix
|
@ -50,28 +50,43 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
system.stateVersion = mkDefault "23.11";
|
||||
system.stateVersion = "23.11";
|
||||
system.configurationRevision = with inputs; mkIf (self ? rev) self.rev;
|
||||
hm.home.stateVersion = config.system.stateVersion;
|
||||
|
||||
boot = {
|
||||
kernelPackages = mkDefault pkgs.linuxPackages_latest;
|
||||
kernelParams = ["pci_aspm.policy=performance"];
|
||||
kernelParams = [ "pci_aspm.policy=performance" ];
|
||||
};
|
||||
|
||||
# configure keymap in x11
|
||||
services.xserver.xkb = {
|
||||
layout = "us";
|
||||
# i need to learn this sometime
|
||||
# variant = "workman";
|
||||
variant = "qwerty";
|
||||
};
|
||||
console = {
|
||||
useXkbConfig = mkDefault true;
|
||||
};
|
||||
|
||||
time.timeZone = mkDefault "America/Los_Angeles";
|
||||
# set the time zone
|
||||
services.automatic-timezoned.enable = mkDefault true;
|
||||
time.timeZone = mkDefault null; # handled by automatic-timezoned
|
||||
|
||||
i18n.defaultLocale = mkDefault "en_US.UTF-8";
|
||||
i18n = mkDefault {
|
||||
defaultLocale = "en_US.UTF-8";
|
||||
supportedLocales = [ "en_US.UTF-8/UTF-8" ];
|
||||
};
|
||||
|
||||
# set the location
|
||||
location.provider = mkDefault "geoclue2";
|
||||
services.geoclue2 = {
|
||||
enable = mkDefault true;
|
||||
|
||||
# the default provider is Geeked
|
||||
geoProviderUrl = "https://beacondb.net/v1/geolocate";
|
||||
submissionUrl = "https://beacondb.net/v2/geosubmit";
|
||||
submissionNick = "geoclue";
|
||||
};
|
||||
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
|
||||
|
|
|
@ -21,14 +21,14 @@
|
|||
# compatibility
|
||||
wineWowPackages.waylandFull winetricks
|
||||
# misc
|
||||
bat file which packwiz yt-dlp fastfetch hyfetch
|
||||
bat file which packwiz yt-dlp fastfetch hyfetch trashy
|
||||
# games
|
||||
prismlauncher
|
||||
] ++ (with pkgs.my; [
|
||||
# none yet
|
||||
]) ++ (with pkgs.gnome; [
|
||||
# yay gnomeware!!!!!!!!!!!!!! yum
|
||||
nautilus gnome-disk-utility ghex pkgs.gnome-text-editor pkgs.baobab file-roller gnome-system-monitor loupe
|
||||
nautilus gnome-disk-utility ghex pkgs.gnome-text-editor pkgs.baobab file-roller gnome-system-monitor loupe pkgs.gnome-weather
|
||||
]);
|
||||
|
||||
modules = {
|
||||
|
|
|
@ -13,10 +13,7 @@ in {
|
|||
enable = true;
|
||||
tray = true;
|
||||
|
||||
# portland, oregon
|
||||
latitude = 45.3112;
|
||||
longitude = -122.4055;
|
||||
provider = "manual";
|
||||
provider = "geoclue2";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ in {
|
|||
];
|
||||
};
|
||||
"custom/power" = let
|
||||
powerSelect = pkgs.writeShellScript "power-menu" ''
|
||||
powerMenuScript = pkgs.writeShellScript "power-menu" ''
|
||||
cmd=$(echo '⏻ shutdown|↻ reboot| lock|⎋ exit desktop environment' | ${lib.getExe pkgs.rofi-wayland} -dmenu -sep '|' -i -p 'what to do ?' -theme-str 'window { height: 132px; }')
|
||||
case "$cmd" in
|
||||
"⏻ shutdown")
|
||||
|
@ -96,7 +96,7 @@ in {
|
|||
format = "⏻";
|
||||
tooltip = true;
|
||||
tooltip-format = "Power menu";
|
||||
on-click = "${powerSelect}";
|
||||
on-click = "${powerMenuScript}";
|
||||
};
|
||||
"custom/wallpaper" = {
|
||||
format = "";
|
||||
|
@ -258,12 +258,39 @@ in {
|
|||
icon-size = 16;
|
||||
spacing = 4;
|
||||
};
|
||||
"custom/weather" = {
|
||||
"custom/weather" = let
|
||||
# this *should* be from coordinates, but we have to make it city because...
|
||||
# https://github.com/chubin/wttr.in/issues/795
|
||||
# i was NOT going to let ip-based location be a thing. i was suprisingly medicated when i wrote this
|
||||
locationScript = pkgs.writeShellScript "location" ''
|
||||
lon=""
|
||||
lat=""
|
||||
|
||||
while IFS= read -r line; do
|
||||
if [[ "$line" == *"Latitude"* ]]; then
|
||||
lat=$(echo "$line" | awk '{ gsub(/[" ]/, "", $2); printf("%.2f", $2) }')
|
||||
elif [[ "$line" == *"Longitude"* ]]; then
|
||||
lon=$(echo "$line" | awk '{ gsub(/[" ]/, "", $2); printf("%.2f", $2) }')
|
||||
fi
|
||||
if [[ -n "$lat" && -n "$lon" ]]; then
|
||||
break
|
||||
fi
|
||||
# -a 4 -- set accuracy to city
|
||||
done < <(${pkgs.geoclue2}/libexec/geoclue-2.0/demos/where-am-i -a 4)
|
||||
|
||||
# i've had issues including country *and* state here, so state has higher priority and falls back to country. works fine for my current place and home town, so good enough <3
|
||||
# zoom=10 -- set zoom to city
|
||||
# addressdetails=1 -- get address details, includes neighborhood (if requested) to city
|
||||
echo $(curl "https://nominatim.openstreetmap.org/reverse?lat=''${lat}&lon=''${lon}&addressdetails=1&zoom=10&format=json" | ${lib.getExe pkgs.jq} -r '.address | "\((to_entries[0].value)), \(.state // "\(.country)")"')
|
||||
'';
|
||||
in {
|
||||
format = "{}°";
|
||||
tooltip = true;
|
||||
on-click = "${lib.getExe pkgs.gnome-weather}";
|
||||
interval = 3600;
|
||||
# doxxing live stream
|
||||
exec = "${lib.getExe pkgs.wttrbar} --location 'Corvallis, Oregon, United States' --hide-conditions --fahrenheit --mph";
|
||||
# edit: no longer doxxing, you will be remembered
|
||||
exec = ''${lib.getExe pkgs.wttrbar} --location "$(${locationScript})" --hide-conditions --fahrenheit --mph'';
|
||||
return-type = "json";
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue