From 3c2fe7775ba0a85ba52595c3c4d32b8890c896a5 Mon Sep 17 00:00:00 2001 From: kenny Date: Tue, 17 Feb 2026 11:20:57 +0200 Subject: [PATCH] Added weathr app support + added to utils --- modules/common/weathr.nix | 72 ++++++++++++++++++++++++++++++++++++++ modules/userapps/utils.nix | 2 ++ 2 files changed, 74 insertions(+) create mode 100644 modules/common/weathr.nix diff --git a/modules/common/weathr.nix b/modules/common/weathr.nix new file mode 100644 index 0000000..9e5ff1d --- /dev/null +++ b/modules/common/weathr.nix @@ -0,0 +1,72 @@ +{ lib +, rustPlatform +, fetchFromGitHub +, pkg-config +, installShellFiles +, # Add any other dependencies weathr might need here +}: + +rustPlatform.buildRustPackage rec { + pname = "weathr"; + version = "1.3.0"; # Use the latest version from the repository + + src = fetchFromGitHub { + owner = "veirt"; + repo = "weathr"; + rev = "v${version}"; # Tags are in the format "v1.3.0" + hash = "sha256-JwI5a+O5Nu39Nr0st5yBLTM5kPLC8UIGAoBMqxnOOl4="; # Replace with the actual hash after the first build attempt + }; + + # Use this for the initial build to let Nix tell you the correct hash + cargoHash = "sha256-Yj1WxpOLL8GiVpCebPZQgdw+L9g+4CNY7n2z8PJQz4k="; + + # If the project has a Cargo.lock, buildRustPackage will use it. + # If you need to vendor dependencies manually, you can use cargoDeps instead. + # cargoDeps = rustPlatform.importCargoLock { + # lockFile = ./Cargo.lock; # Not applicable when fetching from GitHub + # }; + + nativeBuildInputs = [ + pkg-config + installShellFiles + ]; + + # Add any necessary build inputs here. + # Based on the repository, it seems like a standard Rust terminal application. + # It might not have external C library dependencies, but if it does, add them here. + buildInputs = [ + # Example: dbus, openssl, etc. + ]; + + # If the project has tests that require network access or other special setup, + # you might need to disable them or modify checkFlags. + # checkFlags = [ + # # Add flags to skip problematic tests if necessary + # ]; + + doCheck = false; + + postInstall = '' + # Install shell completions if the application generates them. + # Check if weathr supports a command like `weathr completions bash`. + # Based on the README, it doesn't mention shell completion installation. + # If it does, you can uncomment and adapt the logic below. + # compdir=$(mktemp -d) + # $out/bin/weathr completions bash > $compdir/weathr.bash + # $out/bin/weathr completions zsh > $compdir/_weathr + # $out/bin/weathr completions fish > $compdir/weathr.fish + # installShellCompletion --cmd weathr \ + # --bash $compdir/weathr.bash \ + # --zsh $compdir/_weathr \ + # --fish $compdir/weathr.fish + ''; + + meta = with lib; { + description = "A terminal weather app with ASCII animations driven by real-time weather data"; + homepage = "https://github.com/veirt/weathr"; + #changelog = "https://github.com/veirt/weathr/blob/v${version}/CHANGELOG.md"; # Check if a CHANGELOG.md exists + license = licenses.gpl3Only; + # maintainers = with maintainers; [ ]; # Add your handle if you plan to upstream + mainProgram = "weathr"; + }; +} diff --git a/modules/userapps/utils.nix b/modules/userapps/utils.nix index 428b749..70d6043 100644 --- a/modules/userapps/utils.nix +++ b/modules/userapps/utils.nix @@ -4,6 +4,7 @@ ... }: let rustnet = pkgs.callPackage ../../modules/common/rustnet.nix {}; + weathr = pkgs.callPackafe ../common/weathr.nix {}; in { programs.neovim = {defaultEditor = true;}; environment.systemPackages = with pkgs; [ @@ -30,5 +31,6 @@ in { nh tty-clock rustnet + weathr ]; }