From 453d0b9c54c890fc1feaf2ef6e78b5c51b0414e5 Mon Sep 17 00:00:00 2001 From: Psionic K <73710933+psionic-k@users.noreply.github.com> Date: Tue, 28 Jan 2025 03:06:21 +0900 Subject: [PATCH] Combine Dev Shells & Fix Pure Build (#1761) * combined dev shells and fix for unlocated libffi.h SDL2 is not very heavy to include for all users. This way, no switching shells is necessary to build Lem or LemSDL2 pkg-config is a requirement. Including packages in the LD_LIBRARY_PATH list does not appear to run the pkg-config hook, so anything where pkg-config is run needs to be in the package list. * which is needed inside completely clean builds Most systems already have this, but it's pretty cheap to make sure. Not relying on any incidental resources is the Nix way. --- flake.nix | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/flake.nix b/flake.nix index 8a3987932..887cc15e3 100644 --- a/flake.nix +++ b/flake.nix @@ -151,40 +151,29 @@ runHook postInstall ''; }; - lem-sdl2-shell = pkgs.mkShell { - packages = with pkgs; [ - sbcl - sbcl.pkgs.qlot-cli - ]; - # Normally we would include pkg-config and list these dependencies - # in packages, but it does not appear that pkg-config is being used - # when available. - shellHook = with pkgs; '' - export LD_LIBRARY_PATH="''${LD_LIBRARY_PATH}:${SDL2}/lib:${SDL2_ttf}/lib:${SDL2_image}/lib:${libffi}/lib:${openssl.out}/lib" - ''; - }; - lem-ncurses-shell = pkgs.mkShell { + + devShell = pkgs.mkShell { packages = with pkgs; [ + autoconf + automake + libffi.dev + libtool + ncurses.dev + pkg-config sbcl sbcl.pkgs.qlot-cli - pkg-config - ncurses.dev + which # this is available in the stdenv and most sane systems ]; # Normally we would include pkg-config and list these dependencies - # in packages, but it does not appear that pkg-config is being used - # when available. + # in the packages attribute, but it does not appear that pkg-config + # is being used when available. shellHook = with pkgs; '' - export LD_LIBRARY_PATH="''${LD_LIBRARY_PATH}:${ncurses.out}/lib:${libffi}/lib:${openssl.out}/lib" + export LD_LIBRARY_PATH="''${LD_LIBRARY_PATH}:${ncurses.out}/lib:${SDL2}/lib:${SDL2_ttf}/lib:${SDL2_image}/lib:${libffi}/lib:${openssl.out}/lib" ''; }; in { - devShells = - { - lem-ncurses = lem-ncurses-shell; - lem-sdl2 = lem-sdl2-shell; - default = lem-ncurses-shell; - }; + devShells.default = devShell; packages.lem-ncurses = lem.overrideLispAttrs (o: { pname = "lem-ncurses"; meta.mainProgram = "lem";