How to override 2 (two) packages in Nixos configuration.nix

跟風遠走 提交于 2019-12-03 16:22:03

The proper solution is:

nixpkgs.config = {

  allowUnfree = true;

  packageOverrides = super: let self = super.pkgs; in {

    mumble = super.mumble.override { pulseSupport = true; };

    linuxPackages = super.linuxPackages // {
      e1000e = super.linuxPackages.e1000e.overrideDerivation (old: {
        name = "e1000e-3.3.3-${config.boot.kernelPackages.kernel.version}";
        src = fetchurl {
          url = "https://www.dropbox.com/s/pxx883hx9763ygn/e1000e-3.3.3.tar.gz?dl=0";
          sha256 = "1s2w54927fsxg0f037h31g3qkajgn5jd0x3yi1chxsyckrcr0x80";
        };
      });
    };
  };
}

The variable super refers to the Nixpkgs set before the overrides are applied and self refers to it after the overrides are applied. It's important to distinguish these two explicitly to avoid infinite recursions, etc.

Also, note that your override

linuxPackages.e1000e = pkgs.linuxPackages.e1000e.overrideDerivation ...

replaces the linuxPackages attribute set with one that contains nothing but the (overriden) e1000e derivation. That's probably not what you want.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!