Build program from forked github repo?

Hi I’m having some issues with a program I’m running, and would like to add some additional debugging.
So I forked the github repo and added some logging, but how would I go about changing the source repo used to build the program?
The program is nixpkgs/pkgs/by-name/fl/flex-launcher/package.nix at d916df777523d75f7c5acca79946652f032f633e · NixOS/nixpkgs · GitHub and I would like to build from GitHub - AnderssonPeter/flex-launcher: A customizable HTPC application launcher for Windows and Linux instead

I have tried to use overlays

  # Overlay to set custom autostart script for openbox
  nixpkgs.overlays = with pkgs; [
      flex-launcher = super.flex-launcher.src.overrideAttrs (oldAttrs: rec {
        owner = "AnderssonPeter";
        repo = "flex-launcher";
        # Generated using nix-prefetch-github
        rev = "be36128d5c2536daa194dc5b50c13bb91239df5a";
        # Generated using nix-prefetch-github
        hash = "sha256-cS2G2muoZctw7Dj/5mhKdj2Y0t9gDP35OiNXPAnDKQ8=";
      });
    })
  ];

in combination with

users = {
    users = {
      htpc = {
        packages =  with pkgs; [
          flex-launcher
        ];
      };
    };
  };

But when I run sudo nixos-rebuild switch the program isn’t located in /etc/profiles/per-user/htpc/bin anymore, what am I missing?

Use override not overrideAttrs. also remove the with pkgs;, that makes no sense in the context of an overlay that is already giving you two nixpkgs instances.

EDIT: and you overrode the package to just its src, which didn’t build anything, it’s just fetching.

1 Like

Thanks the following worked

  nixpkgs.overlays = [
    (final: prev: {
      flex-launcher = prev.flex-launcher.overrideAttrs (old: {
        src = prev.fetchFromGitHub {
          owner = "AnderssonPeter";
          repo = "flex-launcher";
          rev = "381ea7a4e2605731c592ccffd86ff4c27ff725d4";
          hash = "sha256-O4D+B1kjJWQemRg+5oya8e13tvl3o/q15kwYIX8Xd6c=";
        };
      });
    })
  ];

If you do it that way, use final.fetchFromGitHub. (Always prefer final if possible.)

Just out of curiosity what is the reason for this?

If fetchFromGitHub was changed in any overlay (including the current one) you’d want the actual final one.
And depending on the attribute you’re using, you can get the wrong result when you don’t use final (I’ll link an example thread if I find it).

I tried to PR it to the docs but it didn’t go anywhere.

1 Like

Thanks for the explanation. Now I get it.