From 9d38846b580c192bdd8a341b045e5b60cf89b04c Mon Sep 17 00:00:00 2001 From: punkfairie Date: Sun, 17 Nov 2024 16:17:57 -0800 Subject: [PATCH] fix(figlet): Overlay -> custom package Still can't get the overlay to work :( --- modules/home/programs/figlet/default.nix | 2 +- overlays/figlet/default.nix | 11 ----- packages/figlet-xero-fonts/default.nix | 56 ++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 12 deletions(-) delete mode 100644 overlays/figlet/default.nix create mode 100644 packages/figlet-xero-fonts/default.nix diff --git a/modules/home/programs/figlet/default.nix b/modules/home/programs/figlet/default.nix index 6c712eb..00c349f 100644 --- a/modules/home/programs/figlet/default.nix +++ b/modules/home/programs/figlet/default.nix @@ -14,7 +14,7 @@ in config = mkIf cfg.enable { home.packages = with pkgs; [ - figlet + marleyos.figlet-xero-fonts ]; programs.fish.functions = lib.mkIf config.programs.fish.enable { diff --git a/overlays/figlet/default.nix b/overlays/figlet/default.nix deleted file mode 100644 index 80aa035..0000000 --- a/overlays/figlet/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -_: -final: prev: { - figlet = prev.figlet.overrideAttrs (old: { - contributed = prev.fetchFromGitHub { - owner = "xero"; - repo = "figlet-fonts"; - rev = "a6d2db1a3ee88bec3518214e851825fc4495ac84"; - hash = "sha256-dAs7N66D2Fpy4/UB5Za1r2qb1iSAJR6TMmau1asxgtY"; - }; - }); -} diff --git a/packages/figlet-xero-fonts/default.nix b/packages/figlet-xero-fonts/default.nix new file mode 100644 index 0000000..38f5954 --- /dev/null +++ b/packages/figlet-xero-fonts/default.nix @@ -0,0 +1,56 @@ +{ + lib, + stdenv, + fetchurl, + fetchpatch, + fetchFromGitHub, +}: + +stdenv.mkDerivation rec { + pname = "figlet-xero-fonts"; + version = "2.2.5"; + + # some tools can be found here ftp://ftp.figlet.org/pub/figlet/util/ + src = fetchurl { + url = "ftp://ftp.figlet.org/pub/figlet/program/unix/figlet-${version}.tar.gz"; + sha256 = "0za1ax15x7myjl8jz271ybly8ln9kb9zhm1gf6rdlxzhs07w925z"; + }; + + contributed = fetchFromGitHub { + owner = "xero"; + repo = "figlet-fonts"; + rev = "a6d2db1a3ee88bec3518214e851825fc4495ac84"; + hash = "sha256-dAs7N66D2Fpy4/UB5Za1r2qb1iSAJR6TMmau1asxgtY"; + }; + + patches = [ + (fetchpatch { + url = "https://git.alpinelinux.org/aports/plain/main/figlet/musl-fix-cplusplus-decls.patch?h=3.4-stable&id=71776c73a6f04b6f671430f702bcd40b29d48399"; + name = "musl-fix-cplusplus-decls.patch"; + sha256 = "1720zgrfk9makznqkbjrnlxm7nnhk6zx7g458fv53337n3g3zn7j"; + }) + (fetchpatch { + url = "https://github.com/cmatsuoka/figlet/commit/9a50c1795bc32e5a698b855131ee87c8d7762c9e.patch"; + name = "unistd-on-darwin.patch"; + sha256 = "hyfY87N+yuAwjsBIjpgvcdJ1IbzlR4A2yUJQSzShCRI="; + }) + ]; + + makeFlags = [ + "prefix=$(out)" + "CC:=$(CC)" + "LD:=$(CC)" + ]; + + postInstall = "cp -ar ${contributed}/* $out/share/figlet/"; + + doCheck = true; + + meta = { + description = "Program for making large letters out of ordinary text (with fonts from xero added)"; + homepage = "http://www.figlet.org/"; + license = lib.licenses.afl21; + maintainers = with lib.maintainers; [ ehmry ]; + platforms = lib.platforms.unix; + }; +}