Last active
March 14, 2025 08:54
-
-
Save Kansattica/c886b0f21f90a0bdc7ace439d256f225 to your computer and use it in GitHub Desktop.
more working nixpackage for unlocking cellular modem on nixos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
networking.networkmanager.fccUnlockScripts = [ | |
{id = "8086:7560"; path = "${pkgs.lenovo-wwan-unlock}/bin/fcc_unlock.sh";} | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sometimes modemmanager times out while running the unlock script and I have to run it manually with: | |
sudo /etc/ModemManager/fcc-unlock.d/8086\:7560 whatever wwan0 wwan0at0 wwan0at1 wwam0mbim0 | |
which seems to work |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ stdenvNoCC, fetchurl, lib }: | |
stdenvNoCC.mkDerivation rec { | |
#name = "lenovo-wwan-unlock-${version}"; | |
pname = "lenovo-wwan-unlock-easy"; | |
version = "2.0.0"; | |
src = ./wwan-unlock.sh; | |
# I like to keep the file locally in my repo, but you can also download it from here | |
# this PR, specifically: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1141/diffs?commit_id=2734ac25191264e6d786af8a9577fb51519cb846 | |
/*src = fetchurl { | |
url = "https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/raw/2734ac25191264e6d786af8a9577fb51519cb846/data/dispatcher-fcc-unlock/8086"; | |
hash = "sha256-QuAC2a0renRZQsZvWfTEE9a/Pj6G+ZhGEmYtVagaurE="; | |
};*/ | |
dontUnpack = true; | |
installPhase = '' | |
runHook preInstall | |
mkdir -p $out/bin/ | |
cp -v $src $out/bin/fcc_unlock.sh | |
chmod +x $out/bin/fcc_unlock.sh | |
patchShebangs $out/bin/fcc_unlock.sh | |
runHook postInstall | |
''; | |
meta = with lib; { | |
homepage = "https://gist.github.com/BohdanTkachenko/3f852c352cb2e02cdcbb47419e2fcc74"; | |
description = "Easy unlock for Lenovo PC wwan."; | |
license = licenses.cc0; | |
platforms = platforms.linux; | |
maintainers = [ "The Internet's Beloved Princess Grace" ]; | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add the package to nixpkgs in an overlay | |
modules = [ | |
({ config, pkgs, ... }: { nixpkgs.overlays = | |
[ | |
(self: super: { | |
lenovo-wwan-unlock = super.callPackage ./easy-lenovo-wwan-unlock.nix { }; | |
} | |
) | |
] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't know, I don't have access to that modem. The instructions from https://gist.github.com/BohdanTkachenko/3f852c352cb2e02cdcbb47419e2fcc74 might help. You'll want to replace the PCI ID with the one for your modem- run
lspci -nn
and note the pair of numbers in square brackets after your modem. It's8086:7560
for my modem, yours may vary. You'll want to make sure the file you put in/etc/ModemManager/fcc-unlock.d/
is named after your device's PCI ID. May or may not work, I'm just offering shots in the dark over the internet.