Unverified Commit 7d8132a9 authored by quantenzitrone's avatar quantenzitrone
Browse files

treewide: remove references to the xorg namespace in `pkgs` (automated)

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
```
parent c7c77c1a
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -19,7 +19,12 @@
  pulseaudio,
  wrapGAppsHook3,
  xdg-utils,
  xorg,
  libxcb-util,
  libxcb-wm,
  libxtst,
  libxcursor,
  libx11,
  libxcb,
  zlib,
}:

@@ -52,16 +57,16 @@ stdenv.mkDerivation rec {
    libjack2
    # libjpeg8 is required for converting jpeg's to colour palettes
    libjpeg
    xorg.libxcb
    xorg.libXcursor
    xorg.libX11
    xorg.libXtst
    libxcb
    libxcursor
    libx11
    libxtst
    libxkbcommon
    pipewire
    pulseaudio
    (lib.getLib stdenv.cc.cc)
    xorg.xcbutil
    xorg.xcbutilwm
    libxcb-util
    libxcb-wm
    zlib
  ];

+12 −7
Original line number Diff line number Diff line
@@ -26,7 +26,12 @@
  wrapGAppsHook3,
  xcb-imdkit,
  xdg-utils,
  xorg,
  libxcb-util,
  libxcb-wm,
  libxtst,
  libxcursor,
  libx11,
  libxcb,
  zlib,
}:

@@ -64,10 +69,10 @@ stdenv.mkDerivation rec {
    # libjpeg8 is required for converting jpeg's to colour palettes
    libjpeg
    libnghttp2
    xorg.libxcb
    xorg.libXcursor
    xorg.libX11
    xorg.libXtst
    libxcb
    libxcursor
    libx11
    libxtst
    libxkbcommon
    libudev-zero
    pango
@@ -75,8 +80,8 @@ stdenv.mkDerivation rec {
    (lib.getLib stdenv.cc.cc)
    vulkan-loader
    xcb-imdkit
    xorg.xcbutil
    xorg.xcbutilwm
    libxcb-util
    libxcb-wm
    zlib
  ];

+4 −3
Original line number Diff line number Diff line
@@ -13,7 +13,8 @@
  lv2,
  lv2lint,
  sord,
  xorg,
  libxext,
  libx11,
}:

stdenv.mkDerivation (finalAttrs: {
@@ -41,8 +42,8 @@ stdenv.mkDerivation (finalAttrs: {
    libvterm-neovim
    lv2
    sord
    xorg.libX11
    xorg.libXext
    libx11
    libxext
    glew
    lv2lint
  ];
+2 −2
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
  wrapGAppsHook3,
  gdk-pixbuf,
  librsvg,
  xorg,
  lndir,
  shared-mime-info,
}:

@@ -16,7 +16,7 @@ stdenvNoCC.mkDerivation {

  nativeBuildInputs = [
    wrapGAppsHook3
    xorg.lndir
    lndir
  ];

  installPhase = ''
+4 −3
Original line number Diff line number Diff line
@@ -70,7 +70,8 @@
  runCommand,
  wayland,
  xkeyboard_config,
  xorg,
  libsm,
  libice,
  zlib,
  makeDesktopItem,
  tiling_wm, # if we are using a tiling wm, need to set _JAVA_AWT_WM_NONREPARENTING in wrapper
@@ -175,8 +176,8 @@ let
            xcbutilkeysyms
            xcbutilimage
            xcbutilcursor
            xorg.libICE
            xorg.libSM
            libice
            libsm
            libxkbfile
            libXcomposite
            libXcursor
Loading