|
| 1 | +{ |
| 2 | + lib, |
| 3 | + stdenv, |
| 4 | + fetchFromGitHub, |
| 5 | + rustPlatform, |
| 6 | + pkg-config, |
| 7 | + openssl, |
| 8 | + darwin, |
| 9 | + libiconv, |
| 10 | + installShellFiles, |
| 11 | + nix-update-script, |
| 12 | +}: |
| 13 | + |
| 14 | +rustPlatform.buildRustPackage rec { |
| 15 | + pname = "nix-weather"; |
| 16 | + version = "0.0.3"; |
| 17 | + |
| 18 | + # fetch from GitHub and not upstream forgejo because cafkafk doesn't want to |
| 19 | + # pay for bandwidth |
| 20 | + src = fetchFromGitHub { |
| 21 | + owner = "cafkafk"; |
| 22 | + repo = "nix-weather"; |
| 23 | + rev = "v${version}"; |
| 24 | + hash = "sha256-deVgDYYIv5SyKrkPAfPgbmQ/n4hYSrK2dohaiR5O0QE="; |
| 25 | + }; |
| 26 | + |
| 27 | + cargoHash = "sha256-QJybGxqOJid1D6FTy7lvrakkB/Ss3P3JnXtU1UlGlW0="; |
| 28 | + cargoExtraArgs = "-p nix-weather"; |
| 29 | + |
| 30 | + nativeBuildInputs = [ pkg-config ]; |
| 31 | + buildInputs = |
| 32 | + [ |
| 33 | + openssl |
| 34 | + installShellFiles |
| 35 | + ] |
| 36 | + ++ lib.optionals stdenv.isDarwin [ |
| 37 | + libiconv |
| 38 | + darwin.apple_sdk.frameworks.Security |
| 39 | + darwin.apple_sdk.frameworks.SystemConfiguration |
| 40 | + ]; |
| 41 | + |
| 42 | + outputs = [ |
| 43 | + "out" |
| 44 | + "man" |
| 45 | + ]; |
| 46 | + |
| 47 | + # This is where `build.rs` puts manpages |
| 48 | + MAN_OUT = "./man"; |
| 49 | + |
| 50 | + postInstall = '' |
| 51 | + cd crates/nix-weather |
| 52 | + installManPage man/nix-weather.1 |
| 53 | + installShellCompletion \ |
| 54 | + --fish man/nix-weather.fish \ |
| 55 | + --bash man/nix-weather.bash \ |
| 56 | + --zsh man/_nix-weather |
| 57 | + mkdir -p $out |
| 58 | + cd ../.. |
| 59 | + ''; |
| 60 | + |
| 61 | + # We are the only distro that will ever package this, thus ryanbot will not |
| 62 | + # be able to find updates through repology and we need this. |
| 63 | + passthru.updateScript = nix-update-script { }; |
| 64 | + |
| 65 | + meta = with lib; { |
| 66 | + description = "Check Cache Availablility of NixOS Configurations"; |
| 67 | + longDescription = '' |
| 68 | + Fast rust tool to check availability of your entire system in caches. It |
| 69 | + so to speak "checks the weather" before going to update. Useful for |
| 70 | + debugging cache utilization and timing updates and deployments. |
| 71 | +
|
| 72 | + Heavily inspired by guix weather. |
| 73 | + ''; |
| 74 | + homepage = "https://git.fem.gg/cafkafk/nix-weather"; |
| 75 | + changelog = "https://git.fem.gg/cafkafk/nix-weather/releases/tag/v${version}"; |
| 76 | + license = licenses.eupl12; |
| 77 | + mainProgram = "nix-weather"; |
| 78 | + maintainers = with maintainers; [ |
| 79 | + cafkafk |
| 80 | + freyacodes |
| 81 | + ]; |
| 82 | + platforms = platforms.all; |
| 83 | + }; |
| 84 | +} |
0 commit comments