qknight
qknight

Reputation: 944

override python27Packages.bepasty-server

to experiment with upstream changes i want to alter the src= attribute in pkgs.python27Packages.bepasty-server.

reading through https://nixos.org/nixpkgs/manual/#chap-functions there is no example how to do this for pythonPackages!

so i have tried the stuff below, which i found in some xml-code for the documentation. but it doesn't work ... which is the part where i need your help!

packageOverrides

idea

  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";
      };
    }));

results in this:

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)

reducing the code

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

results in:

[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)

so it seems this won't work at all, but why?

systemPackages

in contrast, here it seems to be working:

 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

however, i don't need bepasty-server binaries in the interactive environment but instead i need to override pkgs so the bepasty service will use it!

Upvotes: 1

Views: 350

Answers (1)

qknight
qknight

Reputation: 944

thanks to lassulus!

here is what works now:

  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";
        };
      });
    };
  };

Upvotes: 1

Related Questions