EDIT: I figured it out and the flakes below are working.
…
I have packaged a python package called firedrake
. This package relies on another python package I wrote called recursivenodes
. My goal is to create an overlay of nixpkgs with firedrake
in it, and then use it in a devShell
.
The directory structure of where I created the overlay and packaged firedrake
looks like this:
.
├── flake.nix
├── pkgs
├── firedrake
├── default.nix
├── recursivenodes
├── default.nix
The flake.nix
file currently looks like this
{
description = "Overlay flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
};
outputs =
{ self, nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
};
in
{
overlays.default = final: prev: rec {
pythonPackagesOverlays = (prev.pythonPackagesOverlays or [ ]) ++ [
(python-final: python-prev: rec {
recursivenodes = pkgs.python3Packages.callPackage ./pkgs/recursivenodes { };
firedrake = prev.python3Packages.callPackage ./pkgs/firedrake { inherit recursivenodes; };
})
];
python3 =
let
self = prev.python3.override {
inherit self;
packageOverrides = prev.lib.composeManyExtensions final.pythonPackagesOverlays;
}; in
self;
python3Packages = final.python3.pkgs;
};
}
The above flake lives in a github repo at github:megaloblasto/custom-nixpkgs
.
Then, my goal is to consume this overlay in a separate flake like this:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
custom-nixpkgs.url = "github:megaloblasto/custom-nixpkgs";
};
outputs =
{ self, nixpkgs, custom-nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
overlays = [ custom-nixpkgs.overlays.python ];
};
in
{
devShells.${system}.default = pkgs.mkShell {
packages = [
# Here is where firedrake is called
(pkgs.python3.withPackages (python-pkgs: [
python-pkgs.firedrake
]))
];
};
};
}