npiet: cleanup

- Move to pkgs/by-name
- Format
- Use `finalAttrs` instead of `rec` for passing the `version` to `fetchurl`
- Use `hash` instead of `sha256` for `fetchurl`
- Use `--replace-fail` instead of `--replace` for `substituteInPlace`
- Add `strictDeps = true`
- Use `lib` directly in `meta` instead of using `with lib;`
- Add `meta.changelog`
- Add `meta.mainProgram`
This commit is contained in:
Luflosi 2024-08-10 12:52:10 +02:00
parent 8839e5b9f0
commit 909bf79413
No known key found for this signature in database
GPG Key ID: 743C5DD6900A1FF0
2 changed files with 28 additions and 21 deletions

View File

@ -1,23 +1,28 @@
{ lib {
, stdenv lib,
, fetchurl stdenv,
, gd fetchurl,
, giflib gd,
, groff giflib,
, libpng groff,
, tk libpng,
tk,
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation (finalAttrs: {
pname = "npiet"; pname = "npiet";
version = "1.3f"; version = "1.3f";
src = fetchurl { src = fetchurl {
url = "https://www.bertnase.de/npiet/npiet-${version}.tar.gz"; url = "https://www.bertnase.de/npiet/npiet-${finalAttrs.version}.tar.gz";
sha256 = "sha256-Le2FYGKr1zWZ6F4edozmvGC6LbItx9aptidj3KBLhVo="; hash = "sha256-Le2FYGKr1zWZ6F4edozmvGC6LbItx9aptidj3KBLhVo=";
}; };
buildInputs = [ gd giflib libpng ]; buildInputs = [
gd
giflib
libpng
];
nativeBuildInputs = [ groff ]; nativeBuildInputs = [ groff ];
@ -25,21 +30,25 @@ stdenv.mkDerivation rec {
# malloc.h is not needed because stdlib.h is already included. # malloc.h is not needed because stdlib.h is already included.
# On macOS, malloc.h does not even exist, resulting in an error. # On macOS, malloc.h does not even exist, resulting in an error.
substituteInPlace npiet-foogol.c \ substituteInPlace npiet-foogol.c \
--replace '#include <malloc.h>' "" --replace-fail '#include <malloc.h>' ""
substituteInPlace npietedit \ substituteInPlace npietedit \
--replace 'exec wish' 'exec ${tk}/bin/wish' --replace-fail 'exec wish' 'exec ${tk}/bin/wish'
''; '';
meta = with lib; { strictDeps = true;
meta = {
description = "Interpreter for piet programs. Also includes npietedit and npiet-foogol"; description = "Interpreter for piet programs. Also includes npietedit and npiet-foogol";
longDescription = '' longDescription = ''
npiet is an interpreter for the piet programming language. npiet is an interpreter for the piet programming language.
Instead of text, piet programs are pictures. Commands are determined based on changes in color. Instead of text, piet programs are pictures. Commands are determined based on changes in color.
''; '';
homepage = "https://www.bertnase.de/npiet/"; homepage = "https://www.bertnase.de/npiet/";
license = licenses.gpl2Only; changelog = "https://www.bertnase.de/npiet/ChangeLog";
platforms = platforms.unix; license = lib.licenses.gpl2Only;
maintainers = with maintainers; [ Luflosi ]; platforms = lib.platforms.unix;
mainProgram = "npiet";
maintainers = with lib.maintainers; [ Luflosi ];
}; };
} })

View File

@ -10833,8 +10833,6 @@ with pkgs;
npapi_sdk = callPackage ../development/libraries/npapi-sdk { }; npapi_sdk = callPackage ../development/libraries/npapi-sdk { };
npiet = callPackage ../development/interpreters/npiet { };
npth = callPackage ../development/libraries/npth { }; npth = callPackage ../development/libraries/npth { };
nmap-formatter = callPackage ../tools/security/nmap-formatter { }; nmap-formatter = callPackage ../tools/security/nmap-formatter { };