Hi there,
i think i made it happen to
- Create a nix flake satisfying all dependencies
- Deactivate NetworkManager and firewall (necessary) on entering flake devShell
- Re-Activate NetworkManager and firewall on leaving flake devShell
So using the flake below, you only need to run nix develop in the same directory
Then follow the official documentation (clone git, edit config, run start_flash_sh) and if you leave the flake, everything gets re-enabled
Maybe thats convenient for others
{
description = "Dev shell with Python, MQTT, sslpsk, etc.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
python = pkgs.python3;
pythonEnv = python.withPackages (ps: with ps; [
paho-mqtt
tornado
pycryptodomex
(ps.buildPythonPackage {
pname = "sslpsk";
version = "unstable-2021-05-28";
src = pkgs.fetchFromGitHub {
owner = "drbild";
repo = "sslpsk";
rev = "d88123a75786953f82f5e25d6c43d9d9259acb62";
sha256 = "sha256-RqaZLtRMzYJPKXBBsw1alujGyqWAQRSQLPyAR8Zi6t4=";
};
nativeBuildInputs = [ pkgs.openssl.dev ];
propagatedBuildInputs = [ pkgs.openssl ];
pythonImportsCheck = [ "sslpsk" ];
})
]);
in {
devShells.default = pkgs.mkShell {
name = "prerequisites-shell";
buildInputs = [
pkgs.git
pkgs.iw
pkgs.dnsmasq
pkgs.util-linux
pkgs.hostapd
pkgs.screen
pkgs.curl
pkgs.mosquitto
pkgs.haveged
pkgs.nettools
pkgs.openssl.dev
pkgs.openssl
pkgs.iproute2
pkgs.iputils
pythonEnv
];
shellHook = ''
echo "✅ Development environment ready."
echo "Deactivating firewall and NetworkManager services..."
sudo systemctl stop NetworkManager.service
sudo systemctl stop firewall
cleanup() {
echo "🔄 Re-activating firewall and NetworkManager..."
sudo systemctl start firewall
sudo systemctl start NetworkManager.service
}
trap cleanup EXIT
'';
};
});
}
Hi there,
i think i made it happen to
So using the flake below, you only need to run
nix developin the same directoryThen follow the official documentation (clone git, edit config, run
start_flash_sh) and if you leave the flake, everything gets re-enabledMaybe thats convenient for others