From 0ee2ce41830b4c1f4beb4edbcd4f60f335fee6a1 Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Sat, 7 Sep 2024 21:52:30 +0200 Subject: [PATCH] fix(overlay): adopt upstream fix for Lua readline https://github.com/telent/liminix/commit/9f58e7b926652dcdbea58694831f7dea58b882c6 ("maybe fix nixpkgs-unstable lua") Signed-off-by: Raito Bezarius --- overlay.nix | 33 ++++++++++++++++----------------- pkgs/run-liminix-vm/default.nix | 7 ++++--- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/overlay.nix b/overlay.nix index 8ecfa5e..dda4ddc 100644 --- a/overlay.nix +++ b/overlay.nix @@ -1,23 +1,24 @@ final: prev: let + isCross = final.stdenv.buildPlatform != final.stdenv.hostPlatform; + crossOnly = pkg : amendFn : if isCross then (amendFn pkg) else pkg; extraPkgs = import ./pkgs/default.nix { inherit (final) lib callPackage; }; inherit (final) fetchpatch; - lua_no_readline = prev.lua5_3; -# lua_no_readline = prev.lua5_3.overrideAttrs(o: { -# name = "lua-tty"; -# preBuild = '' -# makeFlagsArray+=(PLAT="posix" SYSLIBS="-Wl,-E -ldl" CFLAGS="-O2 -fPIC -DLUA_USE_POSIX -DLUA_USE_DLOPEN") -# ''; -# # lua in nixpkgs has a postInstall stanza that assumes only -# # one output, we need to override that if we're going to -# # convert to multi-output -# # outputs = ["bin" "man" "out"]; -# makeFlags = -# builtins.filter (x: (builtins.match "(PLAT|MYLIBS).*" x) == null) -# o.makeFlags; -# }); + luaHost = prev.lua5_3.overrideAttrs(o: { + name = "lua-tty"; + preBuild = '' + makeFlagsArray+=(PLAT="posix" SYSLIBS="-Wl,-E -ldl" CFLAGS="-O2 -fPIC -DLUA_USE_POSIX -DLUA_USE_DLOPEN") + ''; + # lua in nixpkgs has a postInstall stanza that assumes only + # one output, we need to override that if we're going to + # convert to multi-output + # outputs = ["bin" "man" "out"]; + makeFlags = + builtins.filter (x: (builtins.match "(PLAT|MYLIBS).*" x) == null) + o.makeFlags; + }); s6 = prev.s6.overrideAttrs(o: let @@ -42,7 +43,6 @@ let (if o ? patches then o.patches else []) ++ (if patch_needed then [ patch ] else []); }); - lua = let s = lua_no_readline.override { self = s; }; in s; in extraPkgs // { # liminix library functions @@ -214,8 +214,7 @@ extraPkgs // { ]; }); - luaFull = prev.lua; - inherit lua; + lua = crossOnly prev.lua5_3 (_: luaHost); mtdutils = prev.mtdutils.overrideAttrs(o: { patches = (if o ? patches then o.patches else []) ++ [ diff --git a/pkgs/run-liminix-vm/default.nix b/pkgs/run-liminix-vm/default.nix index 1bf0389..f3df1e1 100644 --- a/pkgs/run-liminix-vm/default.nix +++ b/pkgs/run-liminix-vm/default.nix @@ -2,14 +2,15 @@ qemuLim , socat , writeShellScript -, writeFennel , runCommand +, fennel , lib , lua , pkgsBuildBuild }: let - run-liminix-vm = pkgsBuildBuild.writeFennel "run-liminix-vm" { - packages = [ qemuLim pkgsBuildBuild.lua.pkgs.luaposix pkgsBuildBuild.lua.pkgs.fennel ]; + writeFennel = pkgsBuildBuild.writeFennel.override { inherit lua; }; + run-liminix-vm = writeFennel "run-liminix-vm" { + packages = [ qemuLim lua.pkgs.luaposix fennel ]; } ./run-liminix-vm.fnl; connect = writeShellScript "connect-vm" '' export PATH="${lib.makeBinPath [socat]}:$PATH"