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
58893c0c52
commit
6def4cc69a
22
overlay.nix
22
overlay.nix
|
@ -60,11 +60,25 @@ let
|
|||
# errors. This is a simple safeguard to put in at least something that might be seen.
|
||||
maybeWarnWrongMajor = x: if !(lib.hasPrefix supportedLixMajor lixPackageToUse.version) then builtins.trace wrongMajorWarning x else x;
|
||||
|
||||
overlay =
|
||||
overlay =
|
||||
lib.genAttrs overridelist_upstream (
|
||||
name: if (lib.functionArgs prev.${name}.override ? "nix") then prev.${name}.override {
|
||||
nix = final.nixVersions.stable_upstream;
|
||||
} else prev.${name}
|
||||
name:
|
||||
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: drv.pname == "nix")
|
||||
prev.nixVersions.stable_upstream # default to stable nix if nix is not an input
|
||||
inputs;
|
||||
nixMajor = lib.versions.major nixDependency.version;
|
||||
nixMinor = lib.versions.minor nixDependency.version;
|
||||
nixAttr = "nix_${nixMajor}_${nixMinor}";
|
||||
finalNix = final.nixVersions.${nixAttr};
|
||||
in
|
||||
prev.${name}.override {
|
||||
nix = finalNix;
|
||||
} else prev.${name}
|
||||
) // {
|
||||
lix-overlay-present = 1;
|
||||
# used for things that one wouldn't necessarily want to update, but we
|
||||
|
|
Loading…
Reference in a new issue