Skip to content

Commit

Permalink
fix unused module errors
Browse files Browse the repository at this point in the history
NixOS/nixpkgs#366004 introduced a change that
warns and errors out when modules are defined and not acutally set for a
particular target.

This patch rectifies that by going back the the previous method of
ignoring those errors and not breaking the build. Commentary is left
inline to explain the situation and possible future solutions.

tested against orin agx target for ghaf.

there are similar solutions being deployed in nixpkgs to work around
this e.g.

NixOS/nixpkgs#375165

Signed-off-by: Brian McGillion <[email protected]>
  • Loading branch information
brianmcgillion committed Feb 7, 2025
1 parent 5db499e commit d1c8212
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions kernel/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ buildLinux (args // {

defconfig = "tegra_defconfig";

# https://github.com/NixOS/nixpkgs/pull/366004
# introduced a breaking change that if a module is declared but it is not being used it will fail
# if you try to suppress each of he errors e.g.
# REISERFS_FS_SECURITY = lib.mkForce unset; within structuredExtraConfig
# that list runs to a long 100+ modules so we go back to the previous default and ignore them
ignoreConfigErrors = true;

# disabling the dependency on the common-config would seem appropriate as we define our own defconfig
# however, it seems that some of the settings for e.g. fw loading are only made available there.
# TODO: a future task could be to set this, disable ignoreConfigErrors and add the needed modules to the
# structuredExtraConfig below.
#enableCommonConfig = false;

# Using applyPatches here since it's not obvious how to append an extra
# postPatch. This is not very efficient.
src = applyPatches {
Expand Down Expand Up @@ -102,6 +115,10 @@ buildLinux (args // {

### So nat.service and firewall work ###
NF_TABLES = module; # This one should probably be in common-config.nix
# this NFT_NAT is not actually being set. when build with enableCommonConfig = false;
# and not ignoreConfigErrors = true; it will fail with error about unused option
# unused means that it wanted to set it as a module, but make oldconfig didn't ask it about that option,
# so it didn't get a chance to set it.
NFT_NAT = module;
NFT_MASQ = module;
NFT_REJECT = module;
Expand Down

0 comments on commit d1c8212

Please sign in to comment.