Override code to utilize git HEAD

I’d like to update the Mosh Shell package to utlize the Git HEAD version, or a specific PR. Is this something I can easily override? It seems like I should be the right path is a little fuzzy to me.

Source package: nixpkgs/default.nix at a964d7094a30316f0f25dbe6dad5fb8b1878f57c · NixOS/nixpkgs · GitHub

In this, it pulls a package down from the mosh website, but I’d instead like to switch to the Github Repo and pull the head of the main branch or a PR.

Usind overrideAttrs to override the src and version attributes should do, if the build process between the released tarball and a random commit doesn’t differ to much.

The following expression though fails to build for me, as in the installPhase there is a permission denied when it tries to write the bash completions.

mosh.overrideAttrs (_: {
  version = "git";
  src = fetchFromGitHub {
    owner = "mobile-shell";
    repo = "mosh";
    rev = "03087e7";
    sha256 = "sha256-iEc69M2hzUFCIA1+Wlz5UmbQFwQ0uLwdgtbwrhMeFZw=";
  };
  patches = [];
})
1 Like

Ah, then perhaps the best idea is to make a new package that builds using their prescribed process? Thanks for that helpful info @NobbZ!

Out of curiosity, how did you derive that sha256?

I used “trusted on first use” technique.

  1. Set the sha256 to null or "0000000000000000000000000000000000000000000000000000000000000000"
  2. build once
  3. set sha256 to the “got” sha in error message.
1 Like

Is it possible to reference the patch files from the nixpkgs repo in a local derivation?

Yes. "${pkgs.outPath}/pkgs/…" should do.