From 227afc48a21338210db6ff24945f926076a1bff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Sun, 8 Sep 2024 15:35:28 +0200 Subject: [PATCH] nix-weather: init at 0.0.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog: https://git.fem.gg/cafkafk/nix-weather/releases/tag/v0.0.3 https://git.fem.gg/cafkafk/nix-weather/releases/tag/v0.0.2 Signed-off-by: Christina Sørensen Co-authored-by: Freya Arbjerg --- pkgs/by-name/ni/nix-weather/package.nix | 84 +++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 pkgs/by-name/ni/nix-weather/package.nix diff --git a/pkgs/by-name/ni/nix-weather/package.nix b/pkgs/by-name/ni/nix-weather/package.nix new file mode 100644 index 000000000000..bd11ba3d624b --- /dev/null +++ b/pkgs/by-name/ni/nix-weather/package.nix @@ -0,0 +1,84 @@ +{ + lib, + stdenv, + fetchFromGitHub, + rustPlatform, + pkg-config, + openssl, + darwin, + libiconv, + installShellFiles, + nix-update-script, +}: + +rustPlatform.buildRustPackage rec { + pname = "nix-weather"; + version = "0.0.3"; + + # fetch from GitHub and not upstream forgejo because cafkafk doesn't want to + # pay for bandwidth + src = fetchFromGitHub { + owner = "cafkafk"; + repo = "nix-weather"; + rev = "v${version}"; + hash = "sha256-deVgDYYIv5SyKrkPAfPgbmQ/n4hYSrK2dohaiR5O0QE="; + }; + + cargoHash = "sha256-QJybGxqOJid1D6FTy7lvrakkB/Ss3P3JnXtU1UlGlW0="; + cargoExtraArgs = "-p nix-weather"; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = + [ + openssl + installShellFiles + ] + ++ lib.optionals stdenv.isDarwin [ + libiconv + darwin.apple_sdk.frameworks.Security + darwin.apple_sdk.frameworks.SystemConfiguration + ]; + + outputs = [ + "out" + "man" + ]; + + # This is where `build.rs` puts manpages + MAN_OUT = "./man"; + + postInstall = '' + cd crates/nix-weather + installManPage man/nix-weather.1 + installShellCompletion \ + --fish man/nix-weather.fish \ + --bash man/nix-weather.bash \ + --zsh man/_nix-weather + mkdir -p $out + cd ../.. + ''; + + # We are the only distro that will ever package this, thus ryanbot will not + # be able to find updates through repology and we need this. + passthru.updateScript = nix-update-script { }; + + meta = with lib; { + description = "Check Cache Availablility of NixOS Configurations"; + longDescription = '' + Fast rust tool to check availability of your entire system in caches. It + so to speak "checks the weather" before going to update. Useful for + debugging cache utilization and timing updates and deployments. + + Heavily inspired by guix weather. + ''; + homepage = "https://git.fem.gg/cafkafk/nix-weather"; + changelog = "https://git.fem.gg/cafkafk/nix-weather/releases/tag/v${version}"; + license = licenses.eupl12; + mainProgram = "nix-weather"; + maintainers = with maintainers; [ + cafkafk + freyacodes + ]; + platforms = platforms.all; + }; +}