emacspeak: refactor

- finalAttrs design pattern
- set strictDeps
- getExe emacs
- get rid of nested with
- set meta.changelog
- set meta.mainProgram
This commit is contained in:
Anderson Torres 2024-02-27 21:34:41 -03:00
parent 299f6e16e4
commit df2ba5129c

View File

@ -1,34 +1,37 @@
{ lib { lib
, stdenv , emacs
, espeak-ng
, fetchFromGitHub , fetchFromGitHub
, makeWrapper , makeWrapper
, emacs , stdenv
, tcl , tcl
, tclx , tclx
, espeak-ng
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation (finalAttrs: {
pname = "emacspeak"; pname = "emacspeak";
version = "58.0"; version = "58.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "tvraman"; owner = "tvraman";
repo = pname; repo = "emacspeak";
rev = version; rev = finalAttrs.version;
hash= "sha256-5pWC17nvy3ZuG0bR//LqDVpKsH5hFSFf63Q33a1BfBk="; hash = "sha256-5pWC17nvy3ZuG0bR//LqDVpKsH5hFSFf63Q33a1BfBk=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
emacs emacs
makeWrapper makeWrapper
]; ];
buildInputs = [ buildInputs = [
espeak-ng espeak-ng
tcl tcl
tclx tclx
]; ];
strictDeps = true;
preConfigure = '' preConfigure = ''
make config make config
''; '';
@ -44,17 +47,19 @@ stdenv.mkDerivation rec {
cp -a . "$d" cp -a . "$d"
find "$d" \( -type d -or \( -type f -executable \) \) -execdir chmod 755 {} + find "$d" \( -type d -or \( -type f -executable \) \) -execdir chmod 755 {} +
find "$d" -type f -not -executable -execdir chmod 644 {} + find "$d" -type f -not -executable -execdir chmod 644 {} +
makeWrapper ${emacs}/bin/emacs $out/bin/emacspeak \ makeWrapper ${lib.getExe emacs} $out/bin/emacspeak \
--set DTK_PROGRAM "${placeholder "out"}/share/emacs/site-lisp/emacspeak/servers/espeak" \ --set DTK_PROGRAM "${placeholder "out"}/share/emacs/site-lisp/emacspeak/servers/espeak" \
--set TCLLIBPATH "${tclx}/lib" \ --set TCLLIBPATH "${tclx}/lib" \
--add-flags '-l "${placeholder "out"}/share/emacs/site-lisp/emacspeak/lisp/emacspeak-setup.elc"' --add-flags '-l "${placeholder "out"}/share/emacs/site-lisp/emacspeak/lisp/emacspeak-setup.elc"'
''; '';
meta = with lib; { meta = {
homepage = "https://github.com/tvraman/emacspeak/"; homepage = "https://github.com/tvraman/emacspeak/";
description = "Emacs extension that provides spoken output"; description = "Emacs extension that provides spoken output";
license = licenses.gpl2Plus; changelog = "https://github.com/tvraman/emacspeak/blob/${finalAttrs.src.rev}/etc/NEWS";
maintainers = [ maintainers.AndersonTorres ]; license = with lib.licenses; [ gpl2Plus ];
platforms = platforms.linux; mainProgram = "emacspeak";
maintainers = with lib.maintainers; [ AndersonTorres ];
platforms = lib.platforms.linux;
}; };
} })