about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/editors/deadpixi-sam/default.nix
blob: 4321119156e0e35f86c2164fc2a8d3c7e71859b3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{ lib, stdenv, fetchFromGitHub, freetype, libX11, libXi, libXt, libXft }:

stdenv.mkDerivation rec {
  pname = "deadpixi-sam-unstable";
  version = "2020-07-14";

  src = fetchFromGitHub {
    owner = "deadpixi";
    repo = "sam";
    rev = "5d8acb35d78c327d76f00a54857cbd566ed9bc11";
    sha256 = "sha256-+vRh6nDPc3UnmEdqROHRel5Te0h5m4eiaERs492xciQ=";
  };

  postPatch = ''
    substituteInPlace config.mk.def \
      --replace "/usr/include/freetype2" "${freetype.dev}/include/freetype2" \
      --replace "CC=gcc" "CC=${stdenv.cc.targetPrefix}cc" \
      --replace "RXPATH=/usr/bin/ssh" "RXPATH=ssh"
  '';

  CFLAGS = "-D_DARWIN_C_SOURCE";
  makeFlags = [ "DESTDIR=$(out)" ];
  buildInputs = [ libX11 libXi libXt libXft ];
  # build fails when run in parallel
  enableParallelBuilding = false;

  postInstall = ''
    substituteInPlace deadpixi-sam.desktop \
      --replace "accessories-text-editor" "$out/share/icons/hicolor/scalable/apps/sam.svg"
    mkdir -p $out/share/applications
    mkdir -p $out/share/icons/hicolor/scalable/apps
    mv deadpixi-sam.desktop $out/share/applications
    mv sam.svg $out/share/icons/hicolor/scalable/apps
  '';

  meta = with lib; {
    homepage = "https://github.com/deadpixi/sam";
    description = "Updated version of the sam text editor";
    license = licenses.lpl-102;
    maintainers = with maintainers; [ ramkromberg ];
    platforms = platforms.unix;
  };
}