Skip to content

How to combine with drv-parts and flake-parts without incurring in infinite recursion? #581

Answered by yajo
yajo asked this question in Q&A
Discussion options

You must be logged in to vote

I found out a nice way to integrate d2n with flake-parts: packageSets + deps.

Observe this flake-parts module:

{
  inputs,
  lib,
  self,
  ...
}: {
  perSystem = {
    self',
    pkgs,
    system,
    ...
  }: {
    packages.default = inputs.dream2nix.lib.evalModules {
      modules = [{imports = [../drvs/something];}];
      packageSets = {
        inherit inputs self self'; # Here is the magic 🪄
        nixpkgs = pkgs;
      };
  };
}

By doing this, you can define a drv-parts module that has anything it'd need from flake-parts. It just has to declare what it needs in deps:

{config, ...}: {
  deps = {nixpkgs, inputs, self, self', ...}: {
    inherit inputs;
    inherit (nixpkgs) hello;

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
6 replies
@DavHau
Comment options

@yajo
Comment options

@yajo
Comment options

@DavHau
Comment options

@yajo
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by yajo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants