Skip to content

Commit

Permalink
feat: prototype ifwifi performance for larva
Browse files Browse the repository at this point in the history
  • Loading branch information
blaggacao committed Nov 6, 2022
1 parent 1328b09 commit e9e3980
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
28 changes: 28 additions & 0 deletions comb/_QUEEN/nixosProfiles.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ in {
bootstrap = {
config,
options,
pkgs,
...
}: {
imports = [
Expand All @@ -20,6 +21,33 @@ in {

networking.domain = "local";

# Provide networkmanager for easy wireless configuration.
networking.networkmanager.enable = true;
networking.wireless.enable = l.mkForce false;
services.getty.helpLine =
''
The "nixos" and "root" accounts have empty passwords.
An ssh daemon is running. You then must set a password
for either "root" or "nixos" with `passwd` or add an ssh key
to /home/nixos/.ssh/authorized_keys be able to login.
If you need a wireless connection, type
``sudo systemctl start NetworkManager` and configure a
network using `sudo ifwifi scan` & `sudo ifwifi connect`.
See the NixOS manual for details.
''
+ l.optionalString config.services.xserver.enable ''
Type `sudo systemctl start display-manager' to
start the graphical user interface.
'';
environment.systemPackages = [
(pkgs.callPackage ./nixosProfiles/ifwifi {
inherit (pkgs.darwin.apple_sdk.frameworks) Security;
})
];

isoImage = {
isoBaseName = "bootstrap-hive-from-queen";
contents = [
Expand Down
58 changes: 58 additions & 0 deletions comb/_QUEEN/nixosProfiles/ifwifi/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
lib,
stdenv,
fetchFromGitHub,
rustPlatform,
darwin,
iw,
networkmanager,
Security,
makeWrapper,
}:
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];
platforms = platforms.linux;
};
}

0 comments on commit e9e3980

Please sign in to comment.