覆盖python27Packages.bepasty-server

时间:2017-03-09 14:05:42

标签: nix nixos nixpkgs

尝试上游更改我想更改src=中的pkgs.python27Packages.bepasty-server属性。

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

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

packageOverrides

主意

  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)

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

systemPackages

相比之下,这里似乎有效:

 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

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

1 个答案:

答案 0 :(得分: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";
        };
      });
    };
  };