-
I'm testing v1 and having one PITA so let me share it here just in case I'm doing something wrong. Well, the thing is that drv-parts recommends using it through flake-parts. However, when doing that, I couldn't find a way to make the So, since drv-parts is recommended to be used by flake-parts, I think it would be great to have an example on how to combine those 2 projects together with dream2nix without incurring in infinite recursion. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Sorry, the drv-parts readme is a bit outdated. We also don't really use the flake-parts interface it delivers. I should remove that. |
Beta Was this translation helpful? Give feedback.
-
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;
selfLib = self.lib;
defaultPackage = self'.packages.default;
};
# Now use those deps anywhere you want; any infinite recursion will depend on you from now on
name = config.deps.selfLib.name;
# dream2nix and drv-parts are available from config.deps.inputs too, no need for a top-level arg
imports = [
config.deps.inputs.dream2nix.modules.drv-parts.lock
config.deps.inputs.drv-parts.modules.drv-parts.mkDerivation
];
# Use flake outputs as dependencies
mkDerivation.buildInputs = [config.deps.defaultPackage];
} |
Beta Was this translation helpful? Give feedback.
I found out a nice way to integrate d2n with flake-parts: packageSets + deps.
Observe this flake-parts module:
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: