]>
Commit | Line | Data |
---|---|---|
787cc66c SW |
1 | let |
2 | # We declare some parameters explicitly because nix's --arg command line | |
3 | # flag requires this. Getting the list of parameters & constructing this | |
4 | # function dynamically would require import-from-derivation, which is not | |
5 | # permitted in some evaluation contexts, so we can't do that. Instead, we | |
6 | # duplicate nixpkgs' list of explicit parameters here, with a check in case | |
7 | # it drifts out of sync. | |
8 | unused = builtins.throw "These default values are not used"; | |
9 | toplevel = args@{ localSystem ? unused, system ? unused, platform ? unused | |
10 | , crossSystem ? unused, config ? unused, overlays ? unused | |
11 | , crossOverlays ? unused, ... }: | |
12 | let | |
13 | ||
14 | actualNixpkgs = import <nixpkgs-warned> args; | |
15 | noisyNixpkgs = actualNixpkgs.lib.warn | |
16 | ("Using legacy channel nixpkgs from " + <nixpkgs-warned>) actualNixpkgs; | |
17 | ||
18 | local-parameters = builtins.attrNames (builtins.functionArgs toplevel); | |
19 | remote-parameters = | |
20 | builtins.attrNames (builtins.functionArgs (import <nixpkgs-warned>)); | |
21 | missing-parameters = | |
22 | actualNixpkgs.lib.subtractLists local-parameters remote-parameters; | |
23 | # Don't warn about extra parameters to avoid spurious warnings as everyone | |
24 | # rolls past nixpkgs commit 2dde58903e0f2f490088c3b0cedadc9b479da085 | |
25 | # which removed the platform parameter. | |
26 | # extra-parameters = | |
27 | # actualNixpkgs.lib.subtractLists remote-parameters local-parameters; | |
28 | in actualNixpkgs.lib.traceIf (missing-parameters != [ ]) | |
29 | ("Note: warn-nixpkgs doesn't know about these nixpkgs parameters, warned" | |
30 | + "so they might not work with --arg on the nix command line: " | |
31 | + actualNixpkgs.lib.concatStringsSep " " missing-parameters) noisyNixpkgs; | |
32 | ||
33 | in toplevel |