about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Arnold <david.arnold@iohk.io>2022-11-05 17:28:29 -0500
committerDavid Arnold <david.arnold@iohk.io>2022-11-05 20:02:40 -0500
commit455ea2e5e53714352022c951e4a3aeb2d7f2883a (patch)
tree99b0ac1fb628d54675792d2b14fa4651239d983f
parent6a6b2482438c47c5af1bee65d1d86d854b480762 (diff)
iwifi: init at 1.0.3
-rw-r--r--pkgs/tools/networking/ifwifi/default.nix49
-rw-r--r--pkgs/top-level/all-packages.nix4
2 files changed, 53 insertions, 0 deletions
diff --git a/pkgs/tools/networking/ifwifi/default.nix b/pkgs/tools/networking/ifwifi/default.nix
new file mode 100644
index 0000000000000..795731db5a676
--- /dev/null
+++ b/pkgs/tools/networking/ifwifi/default.nix
@@ -0,0 +1,49 @@
+{ lib, stdenv, fetchFromGitHub, rustPlatform, makeWrapper, darwin, networkmanager, iw, Security }:
+
+rustPlatform.buildRustPackage rec {
+  pname = "ifwifi";
+  version = "1.0.3";
+
+  src = fetchFromGitHub {
+    owner = "araujobsd";
+    repo = "ifwifi";
+    rev = "${version}";
+    sha256 = "sha256-RYxBlqG8yV7ZhqTkWbzrGI/ZJRF55JN+kUlqFj/Bs7s=";
+  };
+
+  cargoSha256 = "sha256-ys4tXP46pTXj9LSVISBRX+9xj7ijJddS86YzHHzK+jQ=";
+
+  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;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 940fd7e78cfe9..962381a785453 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -7936,6 +7936,10 @@ with pkgs;
 
   iftop = callPackage ../tools/networking/iftop { };
 
+  ifwifi = callPackage ../tools/networking/ifwifi {
+    inherit (darwin.apple_sdk.frameworks) Security;
+  };
+
   ifuse = callPackage ../tools/filesystems/ifuse { };
   ideviceinstaller = callPackage ../tools/misc/ideviceinstaller { };
   idevicerestore = callPackage ../tools/misc/idevicerestore { };