diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7c6482e --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +outputs/ +result +result-* +repl-result-* diff --git a/flake.nix b/flake.nix index 94ea2e8..69d772e 100644 --- a/flake.nix +++ b/flake.nix @@ -5,13 +5,13 @@ outputs = { self, nixpkgs }: let system = "x86_64-linux"; - myOverlay = import ./overlays/my-pkgs.nix; + myPkgs = import ./overlays/my-pkgs.nix; pkgs = import nixpkgs { inherit system; - overlays = [ myOverlay ]; + overlays = [ myPkgs ]; }; in { - overlays = [ myOverlay ]; - packages.${system} = pkgs; + overlays = { inherit myPkgs; }; + packages.${system} = pkgs // { default = pkgs.hello-zmsun; }; }; } diff --git a/pkgs/fonts-ms-win11/default.nix b/pkgs/fonts-ms-win11/default.nix index 9921605..521b163 100644 --- a/pkgs/fonts-ms-win11/default.nix +++ b/pkgs/fonts-ms-win11/default.nix @@ -18,13 +18,17 @@ stdenv.mkDerivation rec { runHook preInstall mkdir -p $out/share/fonts/truetype - install -D *.{ttf,TTF} $out/share/fonts/truetype/ + install -D *.{ttf,TTF} $out/share/fonts/truetype/ install -D *.ttc $out/share/fonts/ + + mkdir -p $out/share/doc/$pname/ + install -D {license,LICENSE}.* $out/share/doc/$pname/ + runHook postInstall ''; meta = with lib; { - homepage = "https://git.zmsun.cn/pkg/fonts-ms-win11"; + homepage = "https://www.microsoft.com/windows/"; description = "Microsoft Windows 11 TrueType fonts for Linux"; license = licenses.unfree; platforms = platforms.all; diff --git a/pkgs/hello-zmsun/default.nix b/pkgs/hello-zmsun/default.nix new file mode 100644 index 0000000..2c79c5c --- /dev/null +++ b/pkgs/hello-zmsun/default.nix @@ -0,0 +1,60 @@ +{ + callPackage, + lib, + stdenv, + fetchurl, + nixos, + testers, + versionCheckHook, + hello, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "hello-zmsun"; + version = "2.12.2"; + + src = fetchurl { + url = "mirror://gnu/hello/hello-${finalAttrs.version}.tar.gz"; + hash = "sha256-WpqZbcKSzCTc9BHO6H6S9qrluNE72caBm0x6nc4IGKs="; + }; + + # The GNU Hello `configure` script detects how to link libiconv but fails to actually make use of that. + # Unfortunately, this cannot be a patch to `Makefile.am` because `autoreconfHook` causes a gettext + # infrastructure mismatch error when trying to build `hello`. + env = lib.optionalAttrs stdenv.hostPlatform.isDarwin { + NIX_LDFLAGS = "-liconv"; + }; + + doCheck = true; + + doInstallCheck = true; + nativeInstallCheckInputs = [ + versionCheckHook + ]; + + # Give hello some install checks for testing purpose. + postInstallCheck = '' + stat "''${!outputBin}/bin/${finalAttrs.meta.mainProgram}" + ''; + + passthru.tests = { + version = testers.testVersion { package = hello; }; + }; + + passthru.tests.run = callPackage ./test.nix { hello = finalAttrs.finalPackage; }; + + meta = { + description = "Program that produces a familiar, friendly greeting"; + longDescription = '' + GNU Hello is a program that prints "Hello, world!" when you run it. + It is fully customizable. + ''; + homepage = "https://www.gnu.org/software/hello/manual/"; + changelog = "https://git.savannah.gnu.org/cgit/hello.git/plain/NEWS?h=v${finalAttrs.version}"; + license = lib.licenses.gpl3Plus; + maintainers = with lib.maintainers; [ stv0g ]; + mainProgram = "hello"; + platforms = lib.platforms.all; + identifiers.cpeParts.vendor = "gnu"; + }; +})