base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / ni / nix-weather / package.nix
blob02f31ee19739e3e1e85f18288c0b22e51d07fdc3
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   rustPlatform,
6   pkg-config,
7   openssl,
8   darwin,
9   libiconv,
10   installShellFiles,
11   nix-update-script,
14 rustPlatform.buildRustPackage rec {
15   pname = "nix-weather";
16   version = "0.0.4";
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-15FUA4fszbAVXop3IyOHfxroyTt9/SkWZsSTUh9RtwY=";
25   };
27   cargoHash = "sha256-vMeljXNWfFRyeQ4ZQ/Qe1vcW5bg5Y14aEH5HgEwOX3Q=";
28   cargoExtraArgs = "-p nix-weather";
30   nativeBuildInputs = [ pkg-config ];
31   buildInputs =
32     [
33       openssl
34       installShellFiles
35     ]
36     ++ lib.optionals stdenv.hostPlatform.isDarwin [
37       libiconv
38       darwin.apple_sdk.frameworks.Security
39       darwin.apple_sdk.frameworks.SystemConfiguration
40     ];
42   outputs = [
43     "out"
44     "man"
45   ];
47   # This is where `build.rs` puts manpages
48   MAN_OUT = "./man";
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   '';
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 { };
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.
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   };