Skip to content

Commit

Permalink
firmwareLinuxNonfree: simplify source fetching
Browse files Browse the repository at this point in the history
The iwlwifi repo has been merged into linux-firmware.
  • Loading branch information
fpletz committed Mar 28, 2018
1 parent c787555 commit ecf5caf
Showing 1 changed file with 5 additions and 44 deletions.
49 changes: 5 additions & 44 deletions pkgs/os-specific/linux/firmware/firmware-linux-nonfree/default.nix
Expand Up @@ -2,51 +2,12 @@

stdenv.mkDerivation rec {
name = "firmware-linux-nonfree-${version}";
version = "2018-03-20-${src.iwlRev}";
version = "2018-03-20";

# The src runCommand automates the process of building a merged repository of both
#
# https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/
# https://git.kernel.org/cgit/linux/kernel/git/iwlwifi/linux-firmware.git/
#
# This gives us up to date iwlwifi firmware as well as
# the usual set of firmware. firmware/linux-firmware usually lags kernel releases
# so iwlwifi cards will fail to load on newly released kernels.
#
# To update, go to the above repositories and look for latest tags / commits, then
# update version to the more recent commit date

src = runCommand "firmware-linux-nonfree-src-merged-${version}" {
shallowSince = "2017-10-01";
baseRev = "44476f2465dac9c22bce90da66e86b2b56ba34f0";
iwlRev = "iwlwifi-fw-2018-03-02";

# When updating this, you need to let it run with a wrong hash, in order to find out the desired hash
# randomly mutate the hash to break out of fixed hash, when updating
outputHash = "1gh5a2km33jj151j3q7mgkjzzhaaxlqxbb53n4ff46q658gv0wma";

outputHashAlgo = "sha256";
outputHashMode = "recursive";

# Doing the download on a remote machine just duplicates network
# traffic, so don't do that.
preferLocalBuild = true;

nativeBuildInputs = [ cacert git gnupg ];
} ''
git init src && (
cd src
git config user.email "build-daemon@nixos.org"
git config user.name "Nixos Build Daemon $name"
git remote add base https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
git remote add iwl https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/linux-firmware.git
git fetch --shallow-since=$shallowSince base
git fetch --shallow-since=$shallowSince iwl
git checkout -b work $baseRev
git merge $iwlRev)
rm -rf src/.git
cp -a src $out
'';
src = fetchgit {
url = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git";
sha256 = "1gh5a2km33jj151j3q7mgkjzzhaaxlqxbb53n4ff46q658gv0wma";
};

preInstall = ''
mkdir -p $out
Expand Down

0 comments on commit ecf5caf

Please sign in to comment.