edgedb-cli icon indicating copy to clipboard operation
edgedb-cli copied to clipboard

Support nix package install method

Open MarkMarine opened this issue 1 year ago • 1 comments

I'd like the 3.x versions of edgedb-cli to be easier to add to Nixpkgs. There is a 2.3.1 version available, but the recent 3.x versions are using git submodule for the shared test cases and this is causing nix-build to fail, at least in the cursory attempt I made at porting over the package from 2.3 to 3.3.

I appreciate how much work went into the install script, I just prefer to manager my install in a more declarative way and nix is the best option I've seen. I'll gladly contribute work to getting the nix packages install kept current if that helps, but I'd like to know if there is support for this on the dev side?

MarkMarine avatar Jul 03 '23 02:07 MarkMarine

Yeah, I'd like to support nix as well. I personally use it and have hacked around the cargo build issue in my overlay. I'll coordinate with the team and see if we can get a new version of the derivation up on nixpkg. In the meantime, here's my override:

      edgedb-dev = pkgs.edgedb.overrideAttrs (oldAttrs: rec {
        version = "3.4.0-dev";
        src = pkgs.fetchFromGitHub {
          owner = "edgedb";
          repo = "edgedb-cli";
          rev = "b4b47021710a2bc425ba1a676eec704681b7fae7";
          sha256 = "sha256-VOIBmcmfCc5RETWZGBlX093XNOuR03J/IzafFa83vzg=";
          fetchSubmodules = true;
        };
        cargoDeps = pkgs.rustPlatform.importCargoLock {
          lockFile = src + "/Cargo.lock";
          outputHashes = {
            "edgedb-derive-0.5.0" = "sha256-y/mN0XuJtQBtkLmbk2s7hK5joGEH5Ge6sLCD88WyL9o=";
            "edgeql-parser-0.1.0" = "sha256-Y3gXxPuR7qnTL4fu2nZIa3e20YV1fLvm2jHAng+Ke2Q=";
            "rexpect-0.5.0" = "sha256-vstAL/fJWWx7WbmRxNItKpzvgGF3SvJDs5isq9ym/OA=";
            "rustyline-8.0.0" = "sha256-CrICwQbHPzS4QdVIEHxt2euX+g+0pFYe84NfMp1daEc=";
            "serde_str-1.0.0" = "sha256-CMBh5lxdQb2085y0jc/DrV6B8iiXvVO2aoZH/lFFjak=";
            "indexmap-2.0.0-pre" = "sha256-QMOmoUHE1F/sp+NeDpgRGqqacWLHWG02YgZc5vAdXZY=";
          };
        };
        # Patch the Cargo.toml to set the build flag to false
        preBuild = ''
          sed -i '/^\[package\]/a build = false' Cargo.toml
        '';
      });

Let me know if that works for you, and I'll be sure to update in this message once we get the derivation updated in nixpkg HEAD.

scotttrinh avatar Jul 03 '23 13:07 scotttrinh