Skip to content

Instantly share code, notes, and snippets.

@con-f-use
Created May 18, 2023 10:18
Show Gist options
  • Save con-f-use/e2fa9b7d866dcf4befb46b7bfd24d1bc to your computer and use it in GitHub Desktop.
Save con-f-use/e2fa9b7d866dcf4befb46b7bfd24d1bc to your computer and use it in GitHub Desktop.
Somewhat minimal example for Python Libraries as overlay
{
description = "Minimal example for Python Libraries as overlay";
outputs = { self, nixpkgs }: # implicitly get `nixpkgs` from flake registry
let
system = "x86_64-linux";
myPyLibOverlay = final: prev: {
myPyLib = final.callPackage ./packages/myPyLib.nix { };
};
overlayed-nixpkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.customPyLibs ];
};
in
{
overlays = {
customPyLibs = final: prev: {
# pythonPackagesExtensions (PR #91850) merged Aug 6, 2022
pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [
myPyLibOverlay
# ... more Python library overlays ...
];
};
};
packages."${system}" = {
somePackage = overlayed-nixpkgs.callPackage ./packages/uses_myPyLib.nix {};
};
apps."${system}" = {
someApp = {
type = "app";
program = "${self.packages."${system}".somePackage}/bin/some_executable";
};
};
nixosConfigurations = {
someMachine = overlayed-nixpkgs.lib.nixosSystem {
inherit system;
modules = [ ./machines/some/configuration.nix ];
};
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment