From two reddit posts:
=================
Hello!
As in the title; I’m trying to use the following overlay, but any overlays to python packages I make are not being reflected in the final overlay:
(final: prev: let
pv2 = "python27";
pv3 = "python310";
in {
python2 = final.${pv2};
python2Packages = final.${pv2}.pkgs;
python3 = final.${pv3};
python3Packages = final.${pv3}.pkgs;
python = final.python3;
pythonPackages = final.python3.pkgs;
})
I’ve heard that you need to modify python${version}.pkgs
manually as well…?
I want to be able to simply use pkgs.python
without having to worry about the version every single time.
Thank you kindly for the help!
=================
Hello!
As a followup to my last post here, I was wondering why the following overlays don’t seem to work, as adapted from here, and here:
(final: prev: with final; let
# Removing recurseForDerivation prevents derivations of aliased attribute set
# to appear while listing all the packages available.
removeRecurseForDerivations = alias: with lib;
if alias.recurseForDerivations or false
then removeAttrs alias ["recurseForDerivations"]
else alias;
# Disabling distribution prevents top-level aliases for non-recursed package
# sets from building on Hydra.
removeDistribute = alias: with lib;
if isDerivation alias then
dontDistribute alias
else alias;
# Make sure that we are not shadowing something from all-packages.nix.
checkInPkgs = n: alias:
if builtins.hasAttr n super
then throw "Alias ${n} is still in all-packages.nix"
else alias;
mapAliases = aliases:
lib.mapAttrs (n: alias:
removeDistribute
(removeRecurseForDerivations
(checkInPkgs n alias)))
aliases;
in mapAliases {
python = python3; # Added 2022-01-11
})
(final: prev: {
# Python interpreters. All standard library modules are included except for tkinter, which is
# available as `pythonPackages.tkinter` and can be used as any other Python package.
# When switching these sets, please update docs at ../../doc/languages-frameworks/python.md
python2 = final.python27;
python3 = final.python310;
# pythonPackages further below, but assigned here because they need to be in sync
python2Packages = dontRecurseIntoAttrs final.python27Packages;
python3Packages = dontRecurseIntoAttrs final.python310Packages;
})
Thank you kindly for the help!