Replace `__curPos.file` with a hardcoded path. The update script
already assumes it runs from the nixpkgs root (via `import ./. {}`),
so the path is stable.
I would like to get rid of `default.nix` entirely, but doing so involves
some back-compat issues. This seems like it might be the last change I
can make before those back-compat issues become unavoidable?
according to upstream: "The wine64 loader binary is removed, in favor of
a single wine loader that selects the correct mode based on the binary
being executed. For binaries that have both 32-bit and 64-bit versions
installed, it defaults to 64-bit. The 32-bit version can then be
launched with an explicit path, e.g. wine
c:\\windows\\syswow64\\notepad.exe.",
I have changed all the references to the wine64 binary to only need the
wine binary -- tentative.
`wineRelease` is a higher-level "policy argument" --- it makes sense
that there are different versions/variations of wine being built, and
those have names. But conversely, it is far for clear what sort of
concrete changes these flags actually effect in the package recipe.
It turns out, the answer for the lower-level `base.nix` is: "not that
much". So it is better to just replace this flag with lower-level knobs
that "just do one thing", and are not choosing from within some
underspecified set of variations (freeform string is misleading).
We move the "policy choice" logic to `default.nix`, despite the fact
that we want to get rid of that indirection longer term (`base.nix`,
`packages.nix`, and `wine-packages.nix` are surely enough already!) this
is because by doing so, we keep back compat (while still doing our
cleanup), allowing this cleanup commit to also be backported.
Finally, we do the `-std=gnu17` forcing for yabridge with
`overrideAttrs` as its a temp hack anyways, and not really worth a
permenant flag.
The new logic is much easier to read, and (I hope!) better documented.
As an added bonus, replace with the `with src` with a more targeted `let
inherit`.
Re `staging.nix`: It wasn't carrying its weight, and it interacted with
`base.nix` vs `default.nix` in bad ways.
Re `util.nix`: Once `staging.nix` is gone, `util.nix` is only used in
one file, and only one definition of it is used. Move that binding to
`base.nix`, and delete the rest.
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
```