modules: get flake ref from specialArgs instead of wrapper lambdas#144
Open
JamieMagee wants to merge 1 commit intonvmd:developfrom
Open
modules: get flake ref from specialArgs instead of wrapper lambdas#144JamieMagee wants to merge 1 commit intonvmd:developfrom
JamieMagee wants to merge 1 commit intonvmd:developfrom
Conversation
Modules that need the flake self-reference now accept nixos-raspberrypi from specialArgs (standard NixOS module arg) instead of having self threaded through ad-hoc wrapping lambdas in flake.nix. nixosSystemRPi auto-injects nixos-raspberrypi into specialArgs, so callers of lib.nixosSystem/nixosSystemFull/nixosInstaller need no changes. Direct nixpkgs.lib.nixosSystem users must pass nixos-raspberrypi in specialArgs for board modules 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Modules that need the flake self-reference (
self) had two different patterns for receiving it:selfe.g.bluetooth.nix,display-vc4.nixselfthroughnixpkgs-rpiThis meant
flake.nixhad a mix ofimport ./module.nixand{ config, lib, pkgs, ... }: import ./module.nix { inherit config lib pkgs self; }depending on whether the module needed the flake reference. Adding a new module that referenced the flake meant remembering to add the wrapper.Now all modules use the same pattern: accept
nixos-raspberrypias a regular module argument, provided viaspecialArgs.nixosSystemRPiinjects it automatically, so users oflib.nixosSystem/lib.nixosSystemFull/lib.nixosInstallerneed no changes.Users who call
nixpkgs.lib.nixosSystemdirectly and import board modules must passnixos-raspberrypiinspecialArgs. This was already effectively required (nixosSystemRPipreviously asserted its presence) but the assertion is now replaced by auto-injection.