about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/networking/ifwifi/default.nix
blob: f04c3369bacf9cad08991b49b4b0db312489e399 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{ lib, stdenv, fetchFromGitHub, rustPlatform, makeWrapper, networkmanager, iw, Security }:

rustPlatform.buildRustPackage rec {
  pname = "ifwifi";
  version = "1.2.0";

  src = fetchFromGitHub {
    owner = "araujobsd";
    repo = "ifwifi";
    rev = version;
    sha256 = "sha256-DPMCwyKqGJrav0wASBky9bS1bvJ3xaGsDzsk1bKaH1U=";
  };

  cargoHash = "sha256-TL7ZsRbpRdYymJHuoCUCqe/U3Vacb9mtKFh85IOl+PA=";

  nativeBuildInputs = [ makeWrapper ];
  buildInputs = lib.optional stdenv.isDarwin Security;

  postInstall = ''
    wrapProgram "$out/bin/ifwifi" \
      --prefix PATH : "${lib.makeBinPath (
        # `ifwifi` runtime dep
        [ networkmanager ]
        # `wifiscanner` crate's runtime deps
        ++ (lib.optional stdenv.isLinux iw)
        # ++ (lib.optional stdenv.isDarwin airport) # airport isn't packaged
      )}"
  '';

  doCheck = true;

  meta = with lib; {
    description = "A simple wrapper over nmcli using wifiscanner made in rust";
    longDescription = ''
      In the author's words:

      I felt bothered because I never remember the long and tedious command
      line to setup my wifi interface. So, I wanted to develop something
      using rust to simplify the usage of nmcli, and I met the wifiscanner
      project that gave me almost everything I wanted to create this tool.
    '';
    homepage = "https://github.com/araujobsd/ifwifi";
    license = with licenses; [ bsd2 ];
    maintainers = with maintainers; [ blaggacao ];
    # networkmanager doesn't work on darwin
    # even though the `wifiscanner` crate would work
    platforms = with platforms; linux; # ++ darwin;
  };
}