- Make `lua` gain `luaOnBuildFor{Build,Host,Target}` and alike attributes.
- wrapLua: correctly substitute build & host lua & luarocks_bootstrap
- Disallow build platform references when using `buildLuarocksPackage`
in cross building.
- add bustedCheckHook in the nativeCheckInputs and busted will run when
doCheck is enabled. You can customize its call via "bustedFlags" and
prevent it from running with "dontBustedCheck". If "nlua" is
available, busted will automatically run busted with nlua as
interpreter (already done in lux). Goal is to standardize the writing
of tests so that if feels less like copy & paste.
- removed the default checkPhase from buildLuarocksPackage which was
running "luarocks test". None of the plugins was using as far as I
know because no plugin out there (maybe 2 or 3) uses that ? it could
be considered a breaking change but in practice I dont think it is.
mkDerivation instead of using the raw list
```
… while evaluating attribute 'propagatedBuildInputs' of derivation 'wrap-lua-hook'
at /home/art/nixgits/my-nixpkgs/pkgs/stdenv/generic/make-derivation.nix:600:13:
599| depsHostHostPropagated = elemAt (elemAt propagatedDependencies 1) 0;
600| propagatedBuildInputs = elemAt (elemAt propagatedDependencies 1) 1;
| ^
601| depsTargetTargetPropagated = elemAt (elemAt propagatedDependencies 2) 0;
… while calling the 'getAttr' builtin
at «nix-internal»/derivation-internal.nix:50:17:
49| value = commonAttrs // {
50| outPath = builtins.getAttr outputName strict;
| ^
51| drvPath = strict.drvPath;
… while calling the 'derivationStrict' builtin
at «nix-internal»/derivation-internal.nix:37:12:
36|
37| strict = derivationStrict drvAttrs;
| ^
38|
… while evaluating derivation 'make-shell-wrapper-hook'
whose name attribute is located at /home/art/nixgits/my-nixpkgs/pkgs/stdenv/generic/make-derivation.nix:541:13
… while evaluating attribute 'shell' of derivation 'make-shell-wrapper-hook'
at /home/art/nixgits/my-nixpkgs/pkgs/top-level/all-packages.nix:716:7:
715| # targetPackages.runtimeShell only exists when pkgs == targetPackages (when targetPackages is not __raw)
716| shell =
| ^
717| if targetPackages ? runtimeShell then
… while calling the 'throw' builtin
at /home/art/nixgits/my-nixpkgs/pkgs/top-level/all-packages.nix:720:11:
719| else
720| throw "makeWrapper/makeShellWrapper must be in nativeBuildInputs";
| ^
721| };
error: makeWrapper/makeShellWrapper must be in nativeBuildInputs
```
This doesn't seem to be necessary anymore. I confirmed by:
- Adding a lib.warn into the __attrsFailsEvaluation branch - never got
any.
- Removing it everywhere and running full Eval on it - no errors, no
rebuilds.
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.
Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.
A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.
This commit was automatically created and can be verified using
nix-build https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \
--argstr baseRev 57b193d8dd
result/bin/apply-formatting $NIXPKGS_PATH
In preparation for the deprecation of `stdenv.isX`.
These shorthands are not conducive to cross-compilation because they
hide the platforms.
Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way
One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059
There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.
```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
Goal is to make generateLuarocksConfig appropriate in more scenarios, in my case, to generate rocks.nvim luarocks config
We override the luarocks default for rocks_subdir to avoid conflicts when creating lua environments but it is not appropriate for other scenarios
so let's not default to it in the "lib" function.
I tried using luaLib.generateLuarocksConfig outside nixpkgs, to generate a rocks.nvim config but it adds a `local_cache = ""` configuration line that is painful to remove so let's not add it in the first place, and let the caller set it if needed.