Unverified Commit 921f61df authored by Fabian Affolter's avatar Fabian Affolter Committed by GitHub
Browse files

sshx: unstable-2023-11-23 -> 0.2.4 (#342406)

parents b12a1ff6 3c3e6d15
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -8,13 +8,13 @@
, buildNpmPackage
}:
let
  version = "unstable-2023-11-23";
  version = "0.2.4";

  src = fetchFromGitHub {
    owner = "ekzhang";
    repo = "sshx";
    rev = "2677f7e1fa3b369132cc7f27f6028a04b92ba5cf";
    hash = "sha256-9fo8hNUzJr4gse0J2tw7j+alqE82+y8McADzTkxryWk=";
    rev = "refs/tags/v${version}";
    hash = "sha256-RIQRX4sXlMl73Opi6hK2WD/erdAMNrm40IasHasikuw=";
  };

  mkSshxPackage = { pname, cargoHash, ... }@args:
@@ -26,14 +26,17 @@ let
        cargoHash;

      nativeBuildInputs = [ protobuf ];

      buildInputs = lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;

      cargoBuildFlags = [ "--package" pname ];

      cargoTestFlags = cargoBuildFlags;

      meta = {
        description = "Fast, collaborative live terminal sharing over the web";
        homepage = "https://github.com/ekzhang/sshx";
        changelog = "https://github.com/ekzhang/sshx/releases/tag/v${version}";
        license = lib.licenses.mit;
        maintainers = with lib.maintainers; [ pinpox kranzes ];
        mainProgram = pname;
@@ -43,17 +46,17 @@ in
{
  sshx = mkSshxPackage {
    pname = "sshx";
    cargoHash = "sha256-dA5Aen/qANW8si75pj/RsBknvOo3KDyU5UISAmmcfRE=";
    cargoHash = "sha256-PMSKhlHSjXKh/Jxvl2z+c1zDDyuVPzQapvdCdcuaFYc=";
  };

  sshx-server = mkSshxPackage rec {
    pname = "sshx-server";
    cargoHash = "sha256-1GRWCMXsOzqvORgtwfuywV4wLyX3r4nURhM3Dl5V9Ss=";
    cargoHash = "sha256-ySsTjNoI/nuz2qtZ4M2Fd9zy239+E61hUCq1r/ahgsA=";

    postPatch = ''
      substituteInPlace crates/sshx-server/src/web.rs \
        --replace 'ServeDir::new("build")' 'ServeDir::new("${passthru.web.outPath}")' \
        --replace 'ServeFile::new("build/spa.html")' 'ServeFile::new("${passthru.web.outPath}/spa.html")'
        --replace-fail 'ServeDir::new("build")' 'ServeDir::new("${passthru.web.outPath}")' \
        --replace-fail 'ServeFile::new("build/spa.html")' 'ServeFile::new("${passthru.web.outPath}/spa.html")'
    '';

    passthru.web = buildNpmPackage {
@@ -65,7 +68,7 @@ in

      postPatch = ''
        substituteInPlace vite.config.ts \
          --replace 'execSync("git rev-parse --short HEAD").toString().trim()' '"${src.rev}"'
          --replace-fail 'execSync("git rev-parse --short HEAD").toString().trim()' '"${src.rev}"'
      '';

      npmDepsHash = "sha256-bKePCxo6+n0EG+4tbbMimPedJ0Hu1O8yZsgspmhobOs=";