Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inject system dependency while still using common overrrides #87

Closed
lokegustafsson opened this issue Jul 15, 2021 · 1 comment
Closed

Comments

@lokegustafsson
Copy link

I have a flake.nix along the lines of

{
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
  inputs.flake-utils.url = "github:numtide/flake-utils";

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};
        myGems = pkgs.bundlerEnv {
          name = "somegems";
          ruby = pkgs.ruby;
          gemdir = ./.;
          # Uncommenting this breaks things by removing all default overrides. How can I avoid that?
          /*
          gemConfig.some-gem-without-default-override = attrs: {
            buildInputs = with pkgs; [ ... ]
          }
          */
        };
      in {
        devShell = pkgs.mkShell {
          nativeBuildInputs = [ pkgs.myGems ];
        };
      });
}

Where gemset.nix contains gems that require injecting native dependencies. Some of these have defined overrides in https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/ruby-modules/gem-config/default.nix, some do not. I want to define some overrides for packages that do not. My problem is that doing so disables all the universal overrides, and I have no interest in duplicating the entirety of that file in mine.

@lokegustafsson
Copy link
Author

lokegustafsson commented Jul 15, 2021

I found a way:

gemConfig = pkgs.defaultGemConfig // {
  some-gem-without-default-override = attrs: { buildInputs = with pkgs; [ ... ]; };
};

This was not at all discoverable though. I found it by searching for gemConfig and finding #68

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant