From 73c0a1b3237e9682c5342d6880417d535ac64d13 Mon Sep 17 00:00:00 2001 From: Ethan Carter Edwards Date: Mon, 20 Jul 2026 01:33:06 -0400 Subject: [PATCH] esh: modernize Signed-off-by: Ethan Carter Edwards --- pkgs/by-name/es/esh/package.nix | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/pkgs/by-name/es/esh/package.nix b/pkgs/by-name/es/esh/package.nix index e682d0f7c818..ec15fc45fa59 100644 --- a/pkgs/by-name/es/esh/package.nix +++ b/pkgs/by-name/es/esh/package.nix @@ -5,20 +5,24 @@ asciidoctor, gawk, gnused, + coreutils, runtimeShell, binlore, - esh, + versionCheckHook, }: stdenv.mkDerivation (finalAttrs: { pname = "esh"; version = "0.1.1"; + __structuredAttrs = true; + strictDeps = true; + src = fetchFromGitHub { owner = "jirutka"; repo = "esh"; - rev = "v${finalAttrs.version}"; - sha256 = "1ddaji5nplf1dyvgkrhqjy8m5djaycqcfhjv30yprj1avjymlj6w"; + tag = "v${finalAttrs.version}"; + hash = "sha256-3EhavdwqyHw9GFtCxzDzSrZSkZcY5vm2b8HRa0uUqrU="; }; nativeBuildInputs = [ asciidoctor ]; @@ -36,11 +40,12 @@ stdenv.mkDerivation (finalAttrs: { postPatch = '' patchShebangs . substituteInPlace esh \ - --replace '"/bin/sh"' '"${runtimeShell}"' \ - --replace '"awk"' '"${gawk}/bin/awk"' \ - --replace 'sed' '${gnused}/bin/sed' + --replace-fail '"/bin/sh"' '"${runtimeShell}"' \ + --replace-fail '"awk"' '"${gawk}/bin/awk"' \ + --replace-fail 'sed' '${gnused}/bin/sed' \ + --replace-fail 'cat' '${coreutils}/bin/cat' substituteInPlace tests/test-dump.exp \ - --replace '#!/bin/sh' '#!${runtimeShell}' + --replace-fail '#!/bin/sh' '#!${runtimeShell}' ''; doCheck = true; @@ -50,10 +55,14 @@ stdenv.mkDerivation (finalAttrs: { # file 5.41-5.43 but regressed in 5.44+ # see https://bugs.astron.com/view.php?id=276 # "can" verdict because of `-s SHELL` arg - passthru.binlore.out = binlore.synthesize esh '' + passthru.binlore.out = binlore.synthesize finalAttrs.finalPackage '' execer can bin/esh ''; + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgramArg = "-V"; + doInstallCheck = true; + meta = { description = "Simple templating engine based on shell"; mainProgram = "esh";