1

为了试验上游的变化,我想src=改变pkgs.python27Packages.bepasty-server.

通读https://nixos.org/nixpkgs/manual/#chap-functions没有示例如何执行此操作pythonPackages

所以我尝试了下面的东西,我在文档的一些 xml 代码中找到了这些东西。但它不起作用......这是我需要帮助的部分!

包覆盖

主意

  nixpkgs.config.packageOverrides = super: {

    python27Packages.bepasty-server = (pkgs.python27Packages.bepasty-server.overrideAttrs (oldAttrs: {
      src = pkgs.fetchgit {
        url = "https://github.com/bepasty/bepasty-server";
        sha256 = "1ziqshmsf0rjvdhhca55sm0x8jz76fsf2q4rwh4m6lpcf8wr0nps";
        rev = "e2516e8cf4f2afb5185337073607eb9e84a61d2d";
      };
    }));

结果是:

building Nix...
building the system configuration...
error: attribute ‘gunicorn’ missing, at /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/services/misc/bepasty.nix:5:14
(use ‘--show-trace’ to show detailed location information)

减少代码

 nixpkgs.config.packageOverrides = super: {
    python27Packages.bepasty-server = pkgs.python27Packages.bepasty-server;
 };

结果是:

[root@nixdoc:~/nixpkgs]# nixos-rebuild build
building Nix...
building the system configuration...
error: attribute ‘gunicorn’ missing, at /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/services/misc/bepasty.nix:5:14
(use ‘--show-trace’ to show detailed location information)

所以看起来这根本行不通,但为什么呢?

系统包

相反,这里似乎正在工作:

 environment.systemPackages = with pkgs; [
    (python27Packages.bepasty-server.overrideAttrs (oldAttrs: {
      src = pkgs.fetchgit {
        url = "https://github.com/bepasty/bepasty-server";
        sha256 = "1ziqshmsf0rjvdhhca55sm0x8jz76fsf2q4rwh4m6lpcf8wr0nps";
        rev = "e2516e8cf4f2afb5185337073607eb9e84a61d2d";
      };
    }))

    file
    # gcc-wrapper
    gdb
    gnumake
    gnutls
    psmisc
   # tlspool
    wireshark-cli
    gnutls

但是,我不需要 bepasty-server 二进制文件,interactive environment而是需要覆盖 pkgs 以便bepasty service使用它!

4

1 回答 1

1

感谢lassulus

这是现在有效的方法:

  nixpkgs.config.packageOverrides = super: {
    pythonPackages = super.pythonPackages // { bepasty-server = super.python27Packages.bepasty-server.overrideAttrs (oldAttrs: {
        src = pkgs.fetchgit {
          url = "https://github.com/bepasty/bepasty-server";
          sha256 = "9ziqshmsf0rjvdhhca55sm0x8jz76fsf2q4rwh4m6lpcf8wr0nps";
          #sha256 = "5ziqshmsf0rjvdhhca55sm0x8jz76fsf2q4rwh4m6lpcf8wr0nps";
          #sha256 = "7ziqshmsf0rjvdhhca55sm0x8jz76fsf2q4rwh4m6lpcf8wr0nps";
          rev = "e2516e8cf4f2afb5185337073607eb9e84a61d2d";
        };
      });
    };
  };
于 2017-03-09T15:10:39.077 回答