2

我想使用 Nixpkgs 覆盖将 makeFlag 添加到 Firefox 包中,但这似乎很重要。

覆盖 w3m 工作...

(import <nixpkgs> {
  overlays = [
    (self: super: {
      w3m = super.w3m.overrideAttrs (oldAttrs: {
        # that makeFlag makes no sense for w3m, it's just for demonstration
        makeFlags = oldAttrs.makeFlags ++ [ "BUILD_OFFICIAL=1" ];
      });
    })
  ];
}).w3m

...但覆盖 Firefox 不会。

(import <nixpkgs> {
  overlays = [
    (self: super: {
      firefox = super.firefox.overrideAttrs (oldAttrs: {
        makeFlags = oldAttrs.makeFlags ++ [ "BUILD_OFFICIAL=1" ];
      });
    })
  ];
}).firefox
$ nix build -f default.nix
error: attribute 'makeFlags' missing, at /path/to/default.nix:5:21
(use '--show-trace' to show detailed location information)
4

1 回答 1

3

事实证明,需要重写该firefox-unwrapped属性:

(import <nixpkgs> {
  overlays = [
    (self: super: {
      firefox-unwrapped = super.firefox-unwrapped.overrideAttrs (oldAttrs: {
        makeFlags = oldAttrs.makeFlags ++ [ "BUILD_OFFICIAL=1" ];
      });
    })
  ];
}).firefox-unwrapped

这样表达式就会计算。

于 2019-06-21T15:35:30.533 回答