forked from lix-project/nixos-module
overlay: make finalNix depend on the nix version being used by a package
This should address both of the following (were 35 is more general and 36 a specific case) - lix-project/nixos-module#35 - lix-project/nixos-module#36
This commit is contained in:
parent
b0e6f35950
commit
1c44f9cfde
18
overlay.nix
18
overlay.nix
|
@ -62,8 +62,22 @@ let
|
||||||
|
|
||||||
overlay =
|
overlay =
|
||||||
lib.genAttrs overridelist_upstream (
|
lib.genAttrs overridelist_upstream (
|
||||||
name: if (lib.functionArgs prev.${name}.override ? "nix") then prev.${name}.override {
|
name:
|
||||||
nix = final.nixVersions.stable_upstream;
|
if (lib.functionArgs prev.${name}.override ? "nix") then
|
||||||
|
let
|
||||||
|
# Get the two common inputs of a derivation/package.
|
||||||
|
inputs = prev.${name}.buildInputs ++ prev.${name}.nativeBuildInputs;
|
||||||
|
nixDependency = lib.findFirst
|
||||||
|
(drv: lib.hasPrefix "nix-2." drv.name)
|
||||||
|
final.nixVersions.stable # default to stable if nix is not an input
|
||||||
|
inputs;
|
||||||
|
nixMajor = lib.versions.major nixDependency;
|
||||||
|
nixMinor = lib.versions.minor nixDependency;
|
||||||
|
nixAttr = "nix_${nixMajor}_${nixMinor}";
|
||||||
|
finalNix = final.nixVersions.${nixAttr};
|
||||||
|
in
|
||||||
|
prev.${name}.override {
|
||||||
|
nix = finalNix;
|
||||||
} else prev.${name}
|
} else prev.${name}
|
||||||
) // {
|
) // {
|
||||||
lix-overlay-present = 1;
|
lix-overlay-present = 1;
|
||||||
|
|
Loading…
Reference in a new issue