From 653173ce8c250b466c3ec064c1ed5de2b1a362b3 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sun, 1 Dec 2024 11:28:19 +0300 Subject: [PATCH] chore(nix): Update Flake with upstream Nix package changes --- build-aux/pkg.nix | 90 +++++++++++++++++++++-------------------------- flake.lock | 12 +++---- 2 files changed, 46 insertions(+), 56 deletions(-) diff --git a/build-aux/pkg.nix b/build-aux/pkg.nix index c5009e063..5d774f8e6 100644 --- a/build-aux/pkg.nix +++ b/build-aux/pkg.nix @@ -16,6 +16,7 @@ cargo, rustc, rustPlatform, + luarocks, # buildInputs cargo-edit, @@ -28,7 +29,6 @@ stylua, taplo, typos, - darwin, # FONTCONFIG_FILE makeFontsConf, gentium, @@ -41,49 +41,6 @@ libtexpdf-src, }: -let - luaEnv = lua.withPackages ( - ps: - with ps; - [ - # used for module detection, also recommended at runtime for 3rd party module installation - luarocks - - # modules used at runtime - cassowary - cldr - fluent - linenoise - loadkit - lpeg - lua-zlib - lua_cliargs - luaepnf - luaexpat - luafilesystem - luarepl - luasec - luasocket - luautf8 - penlight - vstruct - - # lua packages needed for testing - busted - luacheck - - # packages needed for building api docs - ldoc - ] - ++ lib.optionals (lib.versionOlder lua.luaversion "5.2") [ - bit32 - ] - ++ lib.optionals (lib.versionOlder lua.luaversion "5.3") [ - compat53 - ] - ); - -in stdenv.mkDerivation (finalAttrs: { pname = "sile"; inherit version src; @@ -104,7 +61,10 @@ stdenv.mkDerivation (finalAttrs: { cargo rustc rustPlatform.cargoSetupHook + luarocks ]; + # luarocks propagates cmake, but it shouldn't be used as a build system. + dontUseCmakeConfigure = true; preAutoreconf = '' # Add the libtexpdf src instead of the git submodule. (From some reason @@ -120,8 +80,8 @@ stdenv.mkDerivation (finalAttrs: { buildInputs = [ + finalAttrs.finalPackage.passthru.luaEnv cargo-edit - luaEnv harfbuzz icu fontconfig @@ -130,9 +90,6 @@ stdenv.mkDerivation (finalAttrs: { stylua taplo typos - ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ - darwin.apple_sdk.frameworks.AppKit ]; configureFlags = @@ -175,8 +132,41 @@ stdenv.mkDerivation (finalAttrs: { ''; passthru = { - # So it will be easier to inspect this environment, in comparison to others - inherit luaEnv; + + luaPackages = + [ + # modules used at runtime + "cassowary" + "cldr" + "fluent" + "linenoise" + "loadkit" + "lpeg" + "lua-zlib" + "lua_cliargs" + "luaepnf" + "luaexpat" + "luafilesystem" + "luarepl" + "luasec" + "luasocket" + "luautf8" + "penlight" + "vstruct" + # lua packages needed for testing + "busted" + "luacheck" + # packages needed for building api docs + "ldoc" + ] + ++ lib.optionals (lib.versionOlder lua.luaversion "5.2") [ + "bit32" + ] + ++ lib.optionals (lib.versionOlder lua.luaversion "5.3") [ + "compat53" + ]; + luaEnv = lua.withPackages (ps: lib.attrVals finalAttrs.finalPackage.passthru.luaPackages ps); + # Copied from Makefile.am tests.test = lib.optionalAttrs (!(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64)) ( runCommand "${finalAttrs.pname}-test" diff --git a/flake.lock b/flake.lock index 774297951..42e08e9a5 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "lastModified": 1732722421, + "narHash": "sha256-HRJ/18p+WoXpWJkcdsk9St5ZiukCqSDgbOGFa8Okehg=", "owner": "edolstra", "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "rev": "9ed2ac151eada2306ca8c418ebd97807bb08f6ac", "type": "github" }, "original": { @@ -72,11 +72,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1732238832, - "narHash": "sha256-sQxuJm8rHY20xq6Ah+GwIUkF95tWjGRd1X8xF+Pkk38=", + "lastModified": 1732971106, + "narHash": "sha256-pHO+NWd8wJGDuVJjyyxdgtcmiGhNNKbIIXLMLBPxJTI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "8edf06bea5bcbee082df1b7369ff973b91618b8d", + "rev": "f40efe1ce90f9cd692c8d56d9305fa6b9c07f211", "type": "github" }, "original": {