Installing wezterm from git

Im trying to install wezterm but there are a few feature i need which haven’t made it too release yet, I’ve been trying to figure out a way to install the package from git and this is the closest i’ve come so far

{ pkgs, ... }:
let
  version = "d6809533215e273ca23e52614c886929ad702715";
in
{
  nixpkgs.overlays = [ (final: prev: {
    wezterm = prev.wezterm.overrideAttrs (old: {
      inherit version;
      src = prev.fetchFromGitHub {
        owner = "wez";
        repo = "wezterm";
        rev = version;
        fetchSubmodules = true;
        hash = "sha256-ZnmBKBiaqKGKKrItTrPf/LGJvtu7BBvu1+QAk5PBi6g=";
      };

      cargoHash = "";
    });
  }) ];
  home.packages = [ pkgs.wezterm ];
}

But it tells me that cargoHash is out of date. it suggests setting it to an empty string and doing exactly the same as you do with the hash for fetchFromGitHub, but i set it to an empty string and it gives me the same error and no hash

any ideas as to what im missing for this final peice of the puzzle? that is, if i haven’t done it entirely wrong and should be doing a different method completely

2 Likes

There are some options listed here. I think the easiest is to use the lockfile option.

how do you suggest getting the lock file to do that? should I build the package manually first myself?

I don’t know if this is the best way but maybe you can fetch the lockfile from the github repo
https://raw.githubusercontent.com/wez/wezterm/d6809533215e273ca23e52614c886929ad702715/Cargo.lock

good point, I completely missed that, my bad

not at my nix system at the moment but I’ll give it a try when I have the chance

1 Like

this doesn’t seem to work, if I try to set cargoLock.lockfile to ./Cargo.toml (as it is set in the original nixpkgs derivation), it gives me an error because it cannot coerce a set into a string. I don’t understand why it expects cargoLock to be a string, and if i set it to an empty string similarly to what the original error message suggested, I still get the same first error message

You could try getting a hash using nurl

I get this when I run it on the latest commit:

fetchFromGitHub {
  owner = "wez";
  repo = "wezterm";
  rev = "f0e3eecba6faec0aa963a6f0067577afc99e11db";
  hash = "sha256-7+i+6zPEoQQ88x0g3ncf0UciRutYJtGKVLDxIDCg5G8=";
}

I’m trying to do this as well. I tried following this discussion: Is it possible to override cargoSha256 in buildRustPackage? - #5 by Sandro and came up with this:

{ pkgs, ...}:
let
  version = "6a58a5ce94f186884ec70a60b5afbd728521b1c5";
in
{
  nixpkgs.overlays = [ (final: prev: {
    wezterm = prev.wezterm.overrideAttrs (old: rec {
      inherit version;
      src = prev.fetchFromGitHub {
        owner = "wez";
        repo = "wezterm";
        rev = version;
        fetchSubmodules = true;
        hash = "sha256-QXZjGIw5LvK+frigdCYGVOjLHM3Fnnqqi5FEySaKExs=";
      };
      cargoDeps = old.cargoDeps.overrideAttrs (prev.lib.const {
        name = "wezterm-vendor.tar.gz";
        inherit src;
        outputHash = "sha256-b5OB42PDpw1uZ3agO/TOrWuRM2eCqC8/xWOAkivxTRg=";
        outputHashMode = "recursive";
      });
    });
  }) ];
  home.packages = [ pkgs.wezterm ];
} 

But it gets stuck here:

warning: The interpretation of store paths arguments ending in `.drv` recently changed. If this command is now failing try again with '/nix/store/in18x3ycwhz8lwn3hyg616gizv45i79x-wezterm-6a58a5ce94f186884ec70a60b5afbd728521b1c5.drv^*'
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/i4ys5r1l889szbpfkz2h5zhflhbpkv1r-source
source root is source
Executing cargoSetupPostUnpackHook
unpacking source archive /nix/store/z1hwbawwl579xalk0wck66pk7mginpxa-wezterm-vendor.tar.gz
tar: /nix/store/z1hwbawwl579xalk0wck66pk7mginpxa-wezterm-vendor.tar.gz: Cannot open: No such file or direc>
tar: Error is not recoverable: exiting now
do not know how to unpack source archive /nix/store/z1hwbawwl579xalk0wck66pk7mginpxa-wezterm-vendor.tar.gz

The referenced file /nix/store/z1hwbawwl579xalk0wck66pk7mginpxa-wezterm-vendor.tar.gz really does not exist.

So, did anyone figure out a way to do this? I followed all of the links posted here and got nowhere with it :frowning:

This is what I do:

It seems to work just fine for me. Hope this helps.

4 Likes

Worked perfectly! Thanks <3