this creates some eval errors that will be fixed in the next commit
done with the following script:
```fish
\#!/usr/bin/env fish
set packagesjson (nix eval --impure --json --expr '
let
lib = import ./lib;
in
import pkgs/servers/x11/xorg/default.nix (lib.mapAttrs (
name: _:
if name == "lib" then
lib
else if name == "config" then
{ allowAliases = false; }
else
name
) (__functionArgs (import pkgs/servers/x11/xorg/default.nix))) { }
' | jq)
set one (grep '^ [A-Za-z0-9_-]*$' pkgs/servers/x11/xorg/default.nix | string trim | string replace -r '$' Z | sort | string sub -e -1)
set two (grep '^ [A-Za-z0-9_-]* = [A-Za-z0-9_-]*;$' pkgs/servers/x11/xorg/default.nix | cut -d= -f1 | string trim | string replace -r '$' Z | sort | string sub -e -1)
for arg in $one $two
set oname $arg
set nname (echo $packagesjson | jq -r .$oname)
if test $nname = null
echo (set_color red)warn:(set_color normal) unknown package xorg.$oname >&2
continue
end
echo $oname "->" $nname
# replace basic xorg.$name references
for file in (rg -F "xorg.$oname" --files-with-matches pkgs)
# special cases
sd -F "$oname = xorg.$oname;" "$nname = $nname;" $file
# replace
sd -F "xorg.$oname" "$nname" $file
# fixup function arguments
# prevent duplicate function args
if grep -E " ($oname|$nname),\$" $file >/dev/null
continue
end
if grep 'xorg\..' $file >/dev/null # case1: there is more so we can't just remove the function arg
if grep ' xorg,$' $file >/dev/null
sd ' xorg,$' " xorg,
$nname," $file
else if grep ' xorg ? .*,$' $file >/dev/null
sd 'xorg( ? .*),$' "xorg\$1,
$nname," $file
else
sd -F 'xorg,' "$nname,
xorg," $file
end
else # case there is no more xorg..* so we can just replace the function arg
sd 'xorg(| ? .*),.*$' "$nname," $file
end
end
end
nix fmt
```
With `__structuredAttrs = true;` $outputLib is not available as an exported environment variable.
To avoid polluting the env with a generic variable that could be abused, use a bespoke
and easily greppable variable.
This commit was created by a combination of scripts and tools:
- an ast-grep script to prefix things in meta with `lib.`,
- a modified nixf-diagnose / nixf combination to remove unused `with
lib;`, and
- regular nixfmt.
Co-authored-by: Wolfgang Walther <walther@technowledgy.de>
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 a08b3a4d19.tar.gz \
--argstr baseRev 57b193d8dd
result/bin/apply-formatting $NIXPKGS_PATH
Fixes ↓
```
nix-repl> pkgsCross.x86_64-freebsd.pkgsBuildHost.gobject-introspection
error: Don't know how to run x86_64-unknown-freebsd executables.
```
The unwrapped already doesn't error
```
nix-repl> pkgsCross.x86_64-freebsd.pkgsBuildHost.gobject-introspection-unwrapped
«derivation /nix/store/xq4q4vigy2glmfng2h6bbr4sysyk8ipz-gobject-introspection-1.82.0.drv»
```
7b1cffdd2e/pkgs/development/libraries/gobject-introspection/default.nix (L114)
It's caused by `depsTargetTargetPropagated = [ overridenTargetUnwrappedGir ];` in the wrapper
In `graphene` there is
`PATH=${python3.withPackages (pp: [ pp.pygobject3 pp.tappy ])}/bin:$PATH patchShebangs tests/introspection.py`
Which causes the `Don't know` error in `pkgsCross.x86_64-freebsd.pkgsBuildHost.graphene`
because `python3` and `pygobject3` will be from `pkgsHostTarget`
and then `pygobject3` has `gobject-introspection` from `pkgsHostTarget`
and then that `gobject-introspection` will have `pkgsCross.x86_64-freebsd.pkgsCross.x86_64-freebsd.buildPackages.pkgsTargetTarget.gobject-introspection.gobject-introspection` in `depsTargetTargetPropagated`
To test that importing the python library `gi` works without `depsTargetTargetPropagated`
```nix
let
pkgs =
(import ./. {
crossSystem = (import ./lib).systems.examples.aarch64-multiplatform;
# On `master` uncomment this and comment `propagatedBuildInputs` below and you'll get
# error: Don't know how to run x86_64-unknown-freebsd executables.
#crossSystem = (import ./lib).systems.examples.x86_64-freebsd;
overlays = [
(_: prev: {
pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [
(_: pprev: {
pygobject3-test = pprev.pygobject3.overrideAttrs {
propagatedBuildInputs = [
pprev.pycairo
(prev.gobject-introspection.overrideAttrs { depsTargetTargetPropagated = [ ]; })
];
};
})
];
})
];
}).pkgs;
pyr = pkgs.pkgsBuildHost.python3Packages.python.withPackages (pp: [ pp.pygobject3-test ]);
in
pkgs.pkgsBuildBuild.runCommand "test" { } ''
"${pyr.interpreter}" -c "import gi" && touch "$out"
''
```
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"
```
https://gitlab.gnome.org/GNOME/gobject-introspection/-/compare/1.76.1...1.78.1
NEWS look okay.
* Update the GIR data
* Add GObject as a dependency for the Cairo GIR
* Update regression test suite
* Support different prefix for finding GIR data
* Add GI_GIR_PATH environment variable for controlling GIR paths
The build system changes are suspect – `gir_dir_prefix` is assumed to be relative,
but it takes the value from `datadir` option, which is not generally relative.
Though, currently, the variable is not stringly concatenated anywhere
other than in a code path where its value comes from eponymous option,
which is documented as “Intermediate prefix for gir installation under ${prefix}”,
so it can probably be assumed to be relative there.
Changelog-reviewed-by: Bobby Rong <rjl931189261@126.com>
Changelog-reviewed-by: Jan Tojnar <jtojnar@gmail.com>
checkInputs used to be added to nativeBuildInputs. Now we have
nativeCheckInputs to do that instead. Doing this treewide change allows
to keep hashes identical to before the introduction of
nativeCheckInputs.
so we can propagate the dev output
during the build of i3ipc-glib with strictDeps enabled i noticed that
gobject-introspection was not being detected and it was due to
gobject-introspection path not being in the PKG_CONFIG_PATH variable
this commit makes gobject-introspection get detected when build==host
the wrong path was used in gir files because the format of objdump is
different from ldd so the regex in gobject-introspection doesn't work
https://gitlab.gnome.org/GNOME/gobject-introspection/-/blob/main/giscanner/shlibs.py#L42-57
<namespace name="GLib"
shared-library="/nix/store/pak6rr8wdnbwa1iq2ldvg8pa8zahl3r1-gobject-introspection-aarch64-unknown-linux-gnu-1.72.0/lib/libgobject-2.0.so.0,/nix/store/pak6rr8wdnbwa1iq2ldvg8pa8zahl3r1-gobject-introspection-aarch64-unknown-linux-gnu-1.72.0/lib/libglib-2.0.so.0"
objdump
gobject-introspection> NEEDED libgmodule-2.0.so.0
gobject-introspection> NEEDED libglib-2.0.so.0
ldd
gobject-introspection> libgmodule-2.0.so.0 => /nix/store/ngm1wbwms13c2crsvrah2ypfj0b2yii5-glib-2.73.2/lib/libgmodule-2.0.so.0 (0x00007ffff7d6e000)
gobject-introspection> libglib-2.0.so.0 => /nix/store/ngm1wbwms13c2crsvrah2ypfj0b2yii5-glib-2.73.2/lib/libglib-2.0.so.0 (0x00007ffff7c32000)
i should probably move to use the wrapper when host != build and do the
canExecute things inside the wrapper.nix
then i could use gobject-introspection-unwrapped in it even when
host == build
void also adds gobject-introspection to makeDepends when its gir build
helper is used