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

Support local overlays #478

Open
fzakaria opened this issue Mar 11, 2023 · 7 comments
Open

Support local overlays #478

fzakaria opened this issue Mar 11, 2023 · 7 comments
Labels
enhancement New feature or request

Comments

@fzakaria
Copy link

Would be great to support local overlays in the repository.

I have to override a package that depends on another package etc.. and doing it with an overlay is very simple.

My workaround at the moment is:

  overlay = final: prev: { f = final.firefox; };
  pkgs1 = pkgs.extend overlay;

and I have to use pkgs1 everywhere.

@fzakaria fzakaria added the bug Something isn't working label Mar 11, 2023
@fzakaria
Copy link
Author

My other option was doing all the chaining myself

  let sqlite-3411 = pkgs.sqlite.overrideAttrs (oldAttrs: rec {
      version = "3.41.1";
      src = pkgs.fetchurl {
        url = "https://sqlite.org/2023/sqlite-autoconf-3410100.tar.gz";
        sha256 = "sha256-Ta376rn44WxpXU+7xRwWsvd/uX/0wcPROZGd/AOMnjM=";
      };
    });
  pythonPackageOverrides = self: super: {
      apsw = super.apsw.overridePythonAttrs (oldAttrs: rec {
      version = "3.41.0.0";
      src = pkgs.fetchFromGitHub {
        owner = "rogerbinns";
        repo = "apsw";
        rev = "refs/tags/${version}";
        sha256 = "sha256-U7NhC83wBaUONLsQbL+j9866u4zs58O6AQxwzS3e0qM=";
      };
      buildInputs = [
        sqlite-3411
      ];
    });
  };
in {

in my devenv.nix

@domenkozar domenkozar added enhancement New feature or request and removed bug Something isn't working labels Mar 12, 2023
@domenkozar
Copy link
Member

I was thinking to add overlays to devenv.yaml to support this one.

@knarkzel
Copy link

This feature is necessary for me to use devenv instead of manual flake.nix 😄

@domenkozar
Copy link
Member

You can do this using devenv.yaml:

inputs:
  subflake:
    url: path:./subflake
    overlays:
      - default

and in subflake/flake.nix:

{
  outputs = { ... }: {
    overlays.default = self: super: {
      hello2 = self.hello;
    };
  };
}

Then your devenv.nix can be:

{ pkgs, ... }: {
  packages = [ pkgs.hello2 ];
}

@domenkozar
Copy link
Member

domenkozar commented Aug 3, 2023

To avoid that boilerplate we could support devenv.yaml like:

overlays:
- myoverlay1: | 
    self: super: { hello2 = self.hello; }
- ./myoverlay2.nix

@domenkozar
Copy link
Member

Another possibility would be to evaluate pkgs twice, to add extra overlays.

This would provide a better API (allowing us to provide overlays per module) for sacrificing performance (to be measured how much).

@domenkozar
Copy link
Member

Relevant is #792 because we need to import nixpkgs once.

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

No branches or pull requests

3 participants