nix-community / dream2nix

Simplified nix packaging for various programming language ecosystems [maintainer=@DavHau]
https://dream2nix.dev
MIT License
1.03k stars 126 forks source link

How to refer to pkgs for system inside makeFlakeOutputs? #517

Open zmrocze opened 1 year ago

zmrocze commented 1 year ago

Hey, I have problem understanding your example.

My problem is that - while the attributes passed to makeFlakeOutputs define packages uniformly for every system, the packageOverrides seem to be specific to system.

Below is a snippet from your README under "Extensive Example flake.nix", stripped down to relevant parts:

{
  inputs.dream2nix.url = "github:nix-community/dream2nix";
  outputs = { self, dream2nix }:
    dream2nix.lib.makeFlakeOutputs {
      systems = ["x86_64-linux"];

      # configure package builds via overrides
      # (see docs for override system below)
      packageOverrides = {
        # name of the package
        package-name = {
          # name the override
          add-pre-build-steps = {
            # override attributes
            preBuild = "...";
            # update attributes
            buildInputs = old: old ++ [pkgs.hello];
          };
        };
      };
    };
}

How do I get pkgs here in pkgs.hello?

zmrocze commented 1 year ago

if this interface is different or has changed could you please point me to some relevant piece of doc/code?

zmrocze commented 1 year ago

For my npm run build command to succeed while building the default derivation I need to provide which executable. I think I should override buildInputs, like in the example above.