Skip to content

Commit

Permalink
Add tshm package
Browse files Browse the repository at this point in the history
Stripping breaks the binary like so:
  NixOS/patchelf#99
  • Loading branch information
samhh committed Apr 2, 2022
1 parent 9f64bd0 commit 80a91fb
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions editor.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ let
sha256 = "0gpyvzy0yndjaq0aifzjm1c453ar9ma4610v6q5zhbp5vs4padlg";
}) {};

tshm = pkgs.callPackage ./pkg/tshm.nix {};

exrc-vim = pkgs.vimUtils.buildVimPlugin {
name = "exrc.vim";
src = builtins.fetchTarball {
Expand Down Expand Up @@ -117,6 +119,7 @@ in {
# Tools w/ language server interop
hlint
stylish-haskell
tshm
];
};
}
32 changes: 32 additions & 0 deletions pkg/tshm.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{ fetchurl, lib, pkgs, stdenv }:

stdenv.mkDerivation rec {
pname = "tshm";
version = "0.4.0";

src = fetchurl {
url = "https://github.com/samhh/tshm/releases/download/${version}/tshm-linux-amd64";
sha256 = "03nnhmplmn2mqibqclyr28dhh1v0f4dn18k4rnbvc9xy2l4k32xf";
};

dontUnpack = true;
dontStrip = true;

installPhase = ''
mkdir -p $out/bin/
cp $src $out/bin/tshm
chmod +x $out/bin/tshm
'';

preFixup =
let libPath = with pkgs; lib.makeLibraryPath [ gmp ];
in ''
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath ${libPath} $out/bin/tshm
'';

meta = {
homepage = "https://github.com/samhh/tshm";
description = "A parser and formatter for TypeScript declarations that outputs HM-style type signatures.";
license = lib.licenses.mit;
};
}

0 comments on commit 80a91fb

Please sign in to comment.