nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 callPackage,
3 lib,
4 stdenv,
5 fetchurl,
6 nixos,
7 testers,
8 versionCheckHook,
9 hello,
10 gnulib,
11}:
12
13stdenv.mkDerivation (finalAttrs: {
14 pname = "hello";
15 version = "2.12.2";
16
17 src = fetchurl {
18 url = "mirror://gnu/hello/hello-${finalAttrs.version}.tar.gz";
19 hash = "sha256-WpqZbcKSzCTc9BHO6H6S9qrluNE72caBm0x6nc4IGKs=";
20 };
21
22 patches = lib.optional stdenv.hostPlatform.isCygwin gnulib.patches.memcpy-fix-backport-250512;
23
24 # The GNU Hello `configure` script detects how to link libiconv but fails to actually make use of that.
25 # Unfortunately, this cannot be a patch to `Makefile.am` because `autoreconfHook` causes a gettext
26 # infrastructure mismatch error when trying to build `hello`.
27 env = lib.optionalAttrs stdenv.hostPlatform.isDarwin {
28 NIX_LDFLAGS = "-liconv";
29 };
30
31 doCheck = true;
32
33 doInstallCheck = true;
34 nativeInstallCheckInputs = [
35 versionCheckHook
36 ];
37
38 # Give hello some install checks for testing purpose.
39 postInstallCheck = ''
40 stat "''${!outputBin}/bin/${finalAttrs.meta.mainProgram}"
41 '';
42
43 passthru.tests = {
44 version = testers.testVersion { package = hello; };
45 };
46
47 passthru.tests.run = callPackage ./test.nix { hello = finalAttrs.finalPackage; };
48
49 meta = {
50 description = "Program that produces a familiar, friendly greeting";
51 longDescription = ''
52 GNU Hello is a program that prints "Hello, world!" when you run it.
53 It is fully customizable.
54 '';
55 homepage = "https://www.gnu.org/software/hello/manual/";
56 changelog = "https://git.savannah.gnu.org/cgit/hello.git/plain/NEWS?h=v${finalAttrs.version}";
57 license = lib.licenses.gpl3Plus;
58 maintainers = with lib.maintainers; [ stv0g ];
59 mainProgram = "hello";
60 platforms = lib.platforms.all;
61 identifiers.cpeParts.vendor = "gnu";
62 };
63})