Reputation: 645
While developing a nix package, my default.nix looks like this:
let
pkgs = import <nixpkgs> {
config = { ... }
}
in pkgs.path.to.derivation
But when turning that into an actual package, the pkgs
comes in as an argument. But adding a config to that doesn't seem to work:
{ pkgs, ... }:
let
pkgs_ = pkgs // { config = { ... } };
in pkgs_.path.to.derivation
How do I add the same config to an already existing package set?
Upvotes: 2
Views: 313
Reputation: 297
I couldn't get this to work by attempting to merge the attributes, so instead I created a second pkgs
block with the config
that I wanted.
Example:
pkgs = import nixpkgs {
inherit system;
crossSystem = {
config = "x86_64-unknown-linux-musl"
}
};
jsPkgs = import nixpkgs {
inherit system;
};
Then I could reference jsPkgs.mkDerivation
when I wanted to build a derivation for the current system and pkgs.mkDerivation
for cross-compiling to x86_64-unknown-linux-musl
.
I would imagine this would work similarly for config
blocks.
Upvotes: 0