Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / applications / editors / deadpixi-sam / default.nix
blob4321119156e0e35f86c2164fc2a8d3c7e71859b3
1 { lib, stdenv, fetchFromGitHub, freetype, libX11, libXi, libXt, libXft }:
3 stdenv.mkDerivation rec {
4   pname = "deadpixi-sam-unstable";
5   version = "2020-07-14";
7   src = fetchFromGitHub {
8     owner = "deadpixi";
9     repo = "sam";
10     rev = "5d8acb35d78c327d76f00a54857cbd566ed9bc11";
11     sha256 = "sha256-+vRh6nDPc3UnmEdqROHRel5Te0h5m4eiaERs492xciQ=";
12   };
14   postPatch = ''
15     substituteInPlace config.mk.def \
16       --replace "/usr/include/freetype2" "${freetype.dev}/include/freetype2" \
17       --replace "CC=gcc" "CC=${stdenv.cc.targetPrefix}cc" \
18       --replace "RXPATH=/usr/bin/ssh" "RXPATH=ssh"
19   '';
21   CFLAGS = "-D_DARWIN_C_SOURCE";
22   makeFlags = [ "DESTDIR=$(out)" ];
23   buildInputs = [ libX11 libXi libXt libXft ];
24   # build fails when run in parallel
25   enableParallelBuilding = false;
27   postInstall = ''
28     substituteInPlace deadpixi-sam.desktop \
29       --replace "accessories-text-editor" "$out/share/icons/hicolor/scalable/apps/sam.svg"
30     mkdir -p $out/share/applications
31     mkdir -p $out/share/icons/hicolor/scalable/apps
32     mv deadpixi-sam.desktop $out/share/applications
33     mv sam.svg $out/share/icons/hicolor/scalable/apps
34   '';
36   meta = with lib; {
37     homepage = "https://github.com/deadpixi/sam";
38     description = "Updated version of the sam text editor";
39     license = licenses.lpl-102;
40     maintainers = with maintainers; [ ramkromberg ];
41     platforms = platforms.unix;
42   };