From f8b452901fe7e34190acdd007a6cb0f65ab918a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Sun, 4 Apr 2021 11:12:17 +0200 Subject: [PATCH] feat: openweathermap tool and i3status block --- configs/default.nix | 1 + configs/openweathermap.nix | 19 +++++++++++++++++++ lib/i3status-rust.nix | 15 +++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 configs/openweathermap.nix diff --git a/configs/default.nix b/configs/default.nix index 153b230..09a3bfe 100644 --- a/configs/default.nix +++ b/configs/default.nix @@ -229,6 +229,7 @@ in { ./packages ./power-action.nix ./printing.nix + ./openweathermap.nix ./wallpaper.nix ./redshift.nix ./retiolum.nix diff --git a/configs/openweathermap.nix b/configs/openweathermap.nix new file mode 100644 index 0000000..fa11ff4 --- /dev/null +++ b/configs/openweathermap.nix @@ -0,0 +1,19 @@ +{ pkgs, lib, ... }: +let + openweathermap-repo = pkgs.fetchFromGitHub { + owner = "ip1981"; + repo = "openweathermap"; + rev = "9cfef7b14ac5af7109449b54b1cb352b4c76167a"; + sha256 = "0sm43wicvw2fy7nq65s8vch6jjb5bszqr4ilnhibayamj4jcpw53"; + }; + openweathermap = pkgs.haskellPackages.callCabal2nix "openweathermap" openweathermap-repo {}; + openweathermap-key = lib.strings.fileContents ; +in { + nixpkgs.config.packageOverrides = pkgs: { + weather = pkgs.writers.writeDashBin "weather" '' + ${openweathermap}/bin/openweathermap --api-key ${openweathermap-key} "$@" + ''; + }; + + environment.systemPackages = [ pkgs.weather ]; +} diff --git a/lib/i3status-rust.nix b/lib/i3status-rust.nix index 3393286..dc69559 100644 --- a/lib/i3status-rust.nix +++ b/lib/i3status-rust.nix @@ -71,9 +71,24 @@ in { volume_full = "🔊 "; volume_half = "🔉 "; volume_muted = "🔇"; + weather_sun = "🌣"; + weather_clouds = "🌥"; + weather_rain = "🌧"; + weather_snow = "🌨"; + weather_default = "🌡"; + weather_thunder = "🌩"; }; }; block = [ + { + block = "weather"; + service = { + name = "openweathermap"; + api_key = lib.strings.fileContents ; + city_id = "2950159"; + units = "metric"; + }; + } { block = "custom"; interval = 20;