├── README.md └── repo ├── egl-wayland ├── build ├── checksums ├── depends ├── files │ └── 10_nvidia_wayland.json ├── sources └── version ├── gcompat ├── build ├── checksums ├── patches │ └── nvidia.patch ├── sources └── version ├── libglvnd ├── build ├── checksums ├── depends ├── sources └── version ├── mesa ├── build ├── checksums ├── depends ├── sources └── version ├── nvidia ├── build ├── checksums ├── depends ├── post-install ├── sources └── version ├── patchelf ├── build ├── checksums ├── sources └── version ├── sway ├── build ├── checksums ├── depends ├── patches │ └── no-evdev.patch ├── post-install ├── sources └── version └── wlroots ├── build ├── checksums ├── depends ├── sources └── version /README.md: -------------------------------------------------------------------------------- 1 | # nvidia-musl 2 | 3 | **NOTE:** This was just a small experiment to see if I could get NVIDIA drivers working on musl, real usage is _NOT_ advised and there could be possibilities of undefined behaviour due to the inherent hackiness of all this. 4 | 5 | Some hacks to run proprietary NVIDIA drivers on a pure musl system. 6 | 7 | * Only two symbols required by the drivers are missing from gcompat so we [patch them in](https://github.com/git-bruh/nvidia-musl/blob/master/repo/gcompat/patches/nvidia.patch). The `_IO_2_1_stdout_` symbol is just a NULL stub so if the driver tries to actually make use of it, it will crash but it doesn't seem to use it at all in my experience so this will do for now. 8 | 9 | * `libglvnd` is required by the drivers so we build mesa with glvnd support and build `libglvnd` itself without support for `tls` (`-Dtls=disabled`) to prevent the `initial-exec TLS resolves to dynamic definition in ...` error. 10 | 11 | * All the driver libraries like `libnvidia-eglcore.so` have to be explicitly "linked" against gcompat with `patchelf` to avoid `LD_PRELOAD`-ing gcompat (`patchelf --add-needed libgcompat.so.0 libnvidia-xyz.so`). 12 | 13 | * X11 will not work (Neither will anything that needs `libnvidia-tls.so`) and no NVIDIA-specific X11 libs should be installed (See the `nvidia` package). 14 | 15 | * The `repo/` directory is a KISS repository that contains packages containing the above hacks. 16 | 17 | It should be obvious but don't report driver related bugs to anyone if you're running such a setup. 18 | -------------------------------------------------------------------------------- /repo/egl-wayland/build: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | export DESTDIR="$1" 4 | 5 | export CFLAGS="$CFLAGS -I$PWD/eglexternalplatform/interface" 6 | export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PWD/eglexternalplatform" 7 | 8 | meson \ 9 | --prefix=/usr \ 10 | . output 11 | 12 | ninja -C output 13 | ninja -C output install 14 | 15 | mkdir -p "$1/usr/share/egl/egl_external_platform.d/" 16 | cp 10_nvidia_wayland.json "$1/usr/share/egl/egl_external_platform.d/" 17 | -------------------------------------------------------------------------------- /repo/egl-wayland/checksums: -------------------------------------------------------------------------------- 1 | 12bee9accf121987b0f0d6fb1a4e3b1fc5855b116c50d8d9e035edd02c82f88c 2 | 5cccf1905a266e8e34d5ad4aad4be85390e60b1a0850a29dd9d64adc641de412 3 | -------------------------------------------------------------------------------- /repo/egl-wayland/depends: -------------------------------------------------------------------------------- 1 | meson make 2 | wayland 3 | wayland-protocols make 4 | -------------------------------------------------------------------------------- /repo/egl-wayland/files/10_nvidia_wayland.json: -------------------------------------------------------------------------------- 1 | { 2 | "file_format_version" : "1.0.0", 3 | "ICD" : { 4 | "library_path" : "libnvidia-egl-wayland.so.1" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /repo/egl-wayland/sources: -------------------------------------------------------------------------------- 1 | https://github.com/NVIDIA/egl-wayland/archive/refs/tags/1.1.8.tar.gz 2 | git+https://github.com/NVIDIA/eglexternalplatform.git eglexternalplatform 3 | files/10_nvidia_wayland.json 4 | -------------------------------------------------------------------------------- /repo/egl-wayland/version: -------------------------------------------------------------------------------- 1 | 1.1.8 3 2 | -------------------------------------------------------------------------------- /repo/gcompat/build: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | patch -p1 < nvidia.patch 4 | 5 | sed 's|/lib|/usr/lib|g' Makefile > _ 6 | mv -f _ Makefile 7 | 8 | make \ 9 | LINKER_PATH=/usr/lib/ld-musl-x86_64.so.1 \ 10 | PKG_CONFIG=/bin/true 11 | make DESTDIR="$1" install 12 | 13 | ln -s ld-linux.so.2 "$1/usr/lib/ld-linux-x86-64.so.2" 14 | -------------------------------------------------------------------------------- /repo/gcompat/checksums: -------------------------------------------------------------------------------- 1 | 9b81264ee0228170092ccc1dda44a4ed4bdcb896fd1ffeed7e8c246f6e31a689 2 | -------------------------------------------------------------------------------- /repo/gcompat/patches/nvidia.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Makefile b/Makefile 2 | index cbb7634..a7a1259 100644 3 | --- a/Makefile 4 | +++ b/Makefile 5 | @@ -26,6 +26,7 @@ LIBGCOMPAT_SRC = \ 6 | libgcompat/signal.c \ 7 | libgcompat/socket.c \ 8 | libgcompat/stdio.c \ 9 | + libgcompat/stdfiles.c \ 10 | libgcompat/stdlib.c \ 11 | libgcompat/string.c \ 12 | libgcompat/sysctl.c \ 13 | diff --git a/libgcompat/dlfcn.c b/libgcompat/dlfcn.c 14 | index f2eaa45..3cc9e64 100644 15 | --- a/libgcompat/dlfcn.c 16 | +++ b/libgcompat/dlfcn.c 17 | @@ -3,6 +3,11 @@ 18 | #include /* fprintf */ 19 | #include /* getenv */ 20 | 21 | +enum { 22 | + RTLD_DL_SYMENT = 1, 23 | + RTLD_DL_LINKMAP = 2 24 | +}; 25 | + 26 | void *dlmopen(long lmid, const char *pathname, int mode) 27 | { 28 | if (getenv("GLIBC_FAKE_DEBUG") != NULL) { 29 | @@ -23,3 +28,20 @@ void *dlvsym(void *handle, char *symbol, char *version) 30 | 31 | return dlsym(handle, symbol); 32 | } 33 | + 34 | +int dladdr1(const void *addr, Dl_info *info, void **extra_info, int flags) { 35 | + if (getenv("GLIBC_FAKE_DEBUG") != NULL) { 36 | + fprintf(stderr, "dladdr1 flags %d\n", flags); 37 | + } 38 | + 39 | + switch(flags) { 40 | + default: 41 | + case 0: 42 | + return dladdr(addr, info); 43 | + case RTLD_DL_SYMENT: 44 | + case RTLD_DL_LINKMAP: 45 | + break; 46 | + } 47 | + 48 | + return 0; 49 | +} 50 | diff --git a/libgcompat/stdfiles.c b/libgcompat/stdfiles.c 51 | new file mode 100644 52 | index 0000000..1948931 53 | --- /dev/null 54 | +++ b/libgcompat/stdfiles.c 55 | @@ -0,0 +1,3 @@ 56 | +#include 57 | + 58 | +void *_IO_2_1_stdout_ = NULL; 59 | -------------------------------------------------------------------------------- /repo/gcompat/sources: -------------------------------------------------------------------------------- 1 | git+https://git.adelielinux.org/adelie/gcompat 2 | patches/nvidia.patch 3 | -------------------------------------------------------------------------------- /repo/gcompat/version: -------------------------------------------------------------------------------- 1 | git 1 2 | -------------------------------------------------------------------------------- /repo/libglvnd/build: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | export DESTDIR="$1" 4 | 5 | # Don't build tests. 6 | sed -i "/subdir('tests')/d" meson.build 7 | 8 | meson \ 9 | --prefix=/usr \ 10 | -Dx11=disabled \ 11 | -Dtls=disabled \ 12 | . output 13 | 14 | ninja -C output 15 | ninja -C output install 16 | -------------------------------------------------------------------------------- /repo/libglvnd/checksums: -------------------------------------------------------------------------------- 1 | c42061da999f75234f9bca501c21144d9a5768c5911d674eceb8650ce3fb94bb 2 | -------------------------------------------------------------------------------- /repo/libglvnd/depends: -------------------------------------------------------------------------------- 1 | meson make 2 | -------------------------------------------------------------------------------- /repo/libglvnd/sources: -------------------------------------------------------------------------------- 1 | https://gitlab.freedesktop.org/glvnd/libglvnd/-/archive/v1.3.4/libglvnd-v1.3.4.tar.gz 2 | -------------------------------------------------------------------------------- /repo/libglvnd/version: -------------------------------------------------------------------------------- 1 | 1.3.4 1 2 | -------------------------------------------------------------------------------- /repo/mesa/build: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | # Install python-mako which is solely needed for mesa 4 | # and thus contained in this build. 5 | { 6 | cd mako 7 | 8 | python3 setup.py build 9 | python3 setup.py install \ 10 | --prefix=/usr \ 11 | --root="$PWD/dist" 12 | 13 | # Use a glob to avoid having to figure out the Python 14 | # version for the path below. 15 | cd dist/usr/lib/python*/site-packages 16 | 17 | # Set the PYTHONPATH so python knows where to find mako. 18 | # The one liner simply appends the existing path and 19 | # handles the case where an unset PYTHONPATH breaks 20 | # python as it will only contain our new addition. 21 | PYTHONPATH=$PWD:$(python -c "import sys; print(':'.join(sys.path))") 22 | 23 | cd -; cd .. 24 | } 25 | 26 | export PYTHONPATH 27 | export DESTDIR="$1" 28 | export CFLAGS="$CFLAGS -DGLX_X86_READONLY_TEXT" 29 | 30 | # Fix issues with musl and firefox. 31 | # https://bugs.freedesktop.org/show_bug.cgi?id=35268 32 | # https://github.com/mesa3d/mesa/commit/9f37c9903b87f86a533bfaffa72f0ecb285b02b2 33 | sed -i "/pre_args += '-DUSE_ELF_TLS'/d" meson.build 34 | 35 | python3 bin/git_sha1_gen.py --output include/git_sha1.h 36 | 37 | meson \ 38 | --prefix=/usr \ 39 | --sysconfdir=/etc \ 40 | --mandir=/usr/share/man \ 41 | --localstatedir=/var \ 42 | --buildtype=release \ 43 | -Dgbm=enabled \ 44 | -Dglvnd=true \ 45 | -Dplatforms=wayland \ 46 | -Dzstd=disabled \ 47 | -Ddri-drivers=nouveau \ 48 | -Dgallium-drivers="" \ 49 | -Dvulkan-drivers="" \ 50 | -Dglx=disabled \ 51 | -Dgles1=disabled \ 52 | -Dgles2=disabled \ 53 | . output 54 | 55 | ninja -C output 56 | ninja -C output install 57 | -------------------------------------------------------------------------------- /repo/mesa/checksums: -------------------------------------------------------------------------------- 1 | 1f177f44098164b65731c5ded4c928fd58b14f6c9d2087aa0e37bc79bf79e90b 2 | 2984a6733e1d472796ceef37ad48c26f4a984bb18119bb2dbc37a44d8f6e75a4 3 | -------------------------------------------------------------------------------- /repo/mesa/depends: -------------------------------------------------------------------------------- 1 | bison make 2 | flex make 3 | libdrm 4 | libelf 5 | linux-headers make 6 | m4 make 7 | meson make 8 | pkgconf make 9 | python make 10 | wayland 11 | wayland-protocols make 12 | zlib 13 | -------------------------------------------------------------------------------- /repo/mesa/sources: -------------------------------------------------------------------------------- 1 | https://archive.mesa3d.org/mesa-21.1.4.tar.xz 2 | https://files.pythonhosted.org/packages/source/M/Mako/Mako-1.1.1.tar.gz mako 3 | -------------------------------------------------------------------------------- /repo/mesa/version: -------------------------------------------------------------------------------- 1 | 21.1.4 1 2 | -------------------------------------------------------------------------------- /repo/nvidia/build: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | sh "NVIDIA-Linux-x86_64-${2}-no-compat32.run" --extract-only 4 | cd "NVIDIA-Linux-x86_64-${2}-no-compat32" 5 | 6 | mkdir -p \ 7 | "$1/usr/bin" \ 8 | "$1/usr/share/man/man1" \ 9 | "$1/usr/share/glvnd/egl_vendor.d" \ 10 | "$1/usr/share/vulkan/icd.d" \ 11 | "$1/usr/share/vulkan/implicit_layer.d" \ 12 | "$1/usr/lib/modules/${KERNEL_UNAME:-$(uname -r)}/extra" 13 | 14 | bins=" 15 | smi persistenced modprobe 16 | " 17 | 18 | libs=" 19 | libEGL_nvidia libGLESv1_CM_nvidia libGLESv2_nvidia 20 | libnvidia-eglcore libnvidia-glsi libnvidia-ml 21 | " 22 | 23 | for bin in $bins; do 24 | cp "nvidia-${bin}" "$1/usr/bin/" 25 | cp "nvidia-${bin}.1.gz" "$1/usr/share/man/man1/" 26 | done 27 | 28 | for lib in $libs; do 29 | cp "${lib}.so.$2" "$1/usr/lib/" 30 | done 31 | 32 | patchelf --add-needed libgcompat.so.0 "$1/usr/lib/"*".so.$2" 33 | 34 | chmod 4755 "$1/usr/bin/nvidia-modprobe" 35 | 36 | cp 10_nvidia.json "$1/usr/share/glvnd/egl_vendor.d/" 37 | 38 | sed 's|libGLX_nvidia.so.0|libEGL_nvidia.so.0|' nvidia_icd.json \ 39 | > "$1/usr/share/vulkan/icd.d/nvidia_icd.json" 40 | sed 's|libGLX_nvidia.so.0|libEGL_nvidia.so.0|' nvidia_layers.json \ 41 | > "$1/usr/share/vulkan/implicit_layer.d/nvidia_layers.json" 42 | 43 | # soname links 44 | for lib in "$1/usr/lib/"*.so*; do 45 | soname=$(dirname "$lib")/$(readelf -d "$lib" | awk '/SONAME/ {print $5}' | tr -d '[]') 46 | base=$(printf "%s" "$soname" | sed -r 's/(.*).so.*/\1.so/') 47 | [ -e "$soname" ] || ln -sf "$(basename "$lib")" "$soname" 48 | [ -e "$base" ] || ln -sf "$(basename "$soname")" "$base" 49 | done 50 | 51 | # kernel modules 52 | cd kernel 53 | make modules 54 | cp ./*.ko "$1/usr/lib/modules/${KERNEL_UNAME:-$(uname -r)}/extra" 55 | -------------------------------------------------------------------------------- /repo/nvidia/checksums: -------------------------------------------------------------------------------- 1 | b1ab5db6bffd5246fc571ef252ca4406332bd204a12e4063d3fe0939224d0b56 2 | -------------------------------------------------------------------------------- /repo/nvidia/depends: -------------------------------------------------------------------------------- 1 | gcompat 2 | libglvnd 3 | patchelf make 4 | -------------------------------------------------------------------------------- /repo/nvidia/post-install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | /usr/bin/depmod 4 | 5 | cat < _ 12 | mv -f _ sway/desktop/render.c 13 | 14 | export DESTDIR="$1" 15 | 16 | meson \ 17 | --prefix=/usr \ 18 | -Dexamples=false \ 19 | -Dxwayland=disabled \ 20 | -Dx11-backend=disabled \ 21 | -Dxcb-errors=disabled \ 22 | -Dxcb-icccm=disabled \ 23 | . build 24 | 25 | ninja -C build 26 | ninja -C build install 27 | 28 | rm -rf \ 29 | "$1/usr/share/fish" \ 30 | "$1/usr/share/bash-completion" \ 31 | "$1/usr/share/backgrounds" \ 32 | "$1/usr/share/zsh" 33 | -------------------------------------------------------------------------------- /repo/sway/checksums: -------------------------------------------------------------------------------- 1 | 120c1ba3fa19bca678e471bcc61bd8c84bb40e05ce19a12307809773f618ce91 2 | 3d322aec9e00c88298c90802be29f4e1e37e857ec4ee06cf9ba6129c88052d03 3 | -------------------------------------------------------------------------------- /repo/sway/depends: -------------------------------------------------------------------------------- 1 | cairo 2 | flex make 3 | json-c 4 | libinput 5 | libseat 6 | libxkbcommon 7 | linux-headers make 8 | mesa 9 | meson make 10 | pango 11 | pcre 12 | pixman 13 | pkgconf make 14 | wayland 15 | wayland-protocols make 16 | wlroots 17 | -------------------------------------------------------------------------------- /repo/sway/patches/no-evdev.patch: -------------------------------------------------------------------------------- 1 | diff --git a/meson.build b/meson.build 2 | index 6461ff1..fa1de0b 100644 3 | --- a/meson.build 4 | +++ b/meson.build 5 | @@ -49,7 +49,6 @@ pangocairo = dependency('pangocairo') 6 | gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf')) 7 | pixman = dependency('pixman-1') 8 | glesv2 = dependency('glesv2') 9 | -libevdev = dependency('libevdev') 10 | libinput = dependency('libinput', version: '>=1.6.0') 11 | xcb = dependency('xcb', required: get_option('xwayland')) 12 | drm_full = dependency('libdrm') # only needed for drm_fourcc.h 13 | diff --git a/sway/commands/bar/bind.c b/sway/commands/bar/bind.c 14 | index b4b5bc4..2770312 100644 15 | --- a/sway/commands/bar/bind.c 16 | +++ b/sway/commands/bar/bind.c 17 | @@ -1,4 +1,4 @@ 18 | -#include 19 | +#include 20 | #include 21 | #include 22 | #include 23 | diff --git a/sway/commands/bind.c b/sway/commands/bind.c 24 | index 4c67b3c..e9c0eab 100644 25 | --- a/sway/commands/bind.c 26 | +++ b/sway/commands/bind.c 27 | @@ -1,5 +1,4 @@ 28 | #define _POSIX_C_SOURCE 200809L 29 | -#include 30 | #include 31 | #include 32 | #include 33 | diff --git a/sway/commands/input/scroll_button.c b/sway/commands/input/scroll_button.c 34 | index 6b33141..039f533 100644 35 | --- a/sway/commands/input/scroll_button.c 36 | +++ b/sway/commands/input/scroll_button.c 37 | @@ -1,4 +1,4 @@ 38 | -#include 39 | +#include 40 | #include "sway/config.h" 41 | #include "sway/commands.h" 42 | #include "sway/input/cursor.h" 43 | diff --git a/sway/input/cursor.c b/sway/input/cursor.c 44 | index 96b5b93..e7f457f 100644 45 | --- a/sway/input/cursor.c 46 | +++ b/sway/input/cursor.c 47 | @@ -1,7 +1,7 @@ 48 | #define _POSIX_C_SOURCE 200809L 49 | #include 50 | #include 51 | -#include 52 | +#include 53 | #include 54 | #include 55 | #include 56 | @@ -1217,7 +1217,7 @@ uint32_t get_mouse_bindsym(const char *name, char **error) { 57 | return buttons[number - 1]; 58 | } else if (strncmp(name, "BTN_", strlen("BTN_")) == 0) { 59 | // Get event code from name 60 | - int code = libevdev_event_code_from_name(EV_KEY, name); 61 | + int code = libinput_event_code_from_name(EV_KEY, name); 62 | if (code == -1) { 63 | size_t len = snprintf(NULL, 0, "Unknown event %s", name) + 1; 64 | *error = malloc(len); 65 | @@ -1243,7 +1243,7 @@ uint32_t get_mouse_bindcode(const char *name, char **error) { 66 | *error = strdup("Button event code out of range."); 67 | return 0; 68 | } 69 | - const char *event = libevdev_event_code_get_name(EV_KEY, code); 70 | + const char *event = libinput_event_code_get_name(EV_KEY, code); 71 | if (!event || strncmp(event, "BTN_", strlen("BTN_")) != 0) { 72 | size_t len = snprintf(NULL, 0, "Event code %d (%s) is not a button", 73 | code, event ? event : "(null)") + 1; 74 | @@ -1266,7 +1266,7 @@ uint32_t get_mouse_button(const char *name, char **error) { 75 | } 76 | 77 | const char *get_mouse_button_name(uint32_t button) { 78 | - const char *name = libevdev_event_code_get_name(EV_KEY, button); 79 | + const char *name = libinput_event_code_get_name(EV_KEY, button); 80 | if (!name) { 81 | if (button == SWAY_SCROLL_UP) { 82 | name = "SWAY_SCROLL_UP"; 83 | diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c 84 | index f9eb8c8..681ca26 100644 85 | --- a/sway/input/seatop_default.c 86 | +++ b/sway/input/seatop_default.c 87 | @@ -1,6 +1,6 @@ 88 | #define _POSIX_C_SOURCE 200809L 89 | #include 90 | -#include 91 | +#include 92 | #include 93 | #include 94 | #include 95 | diff --git a/sway/ipc-json.c b/sway/ipc-json.c 96 | index 1b64f86..13fa7d4 100644 97 | --- a/sway/ipc-json.c 98 | +++ b/sway/ipc-json.c 99 | @@ -1,7 +1,7 @@ 100 | #include 101 | #include 102 | #include 103 | -#include 104 | +#include 105 | #include 106 | #include 107 | #include 108 | diff --git a/sway/meson.build b/sway/meson.build 109 | index 1402db1..53ed355 100644 110 | --- a/sway/meson.build 111 | +++ b/sway/meson.build 112 | @@ -207,7 +207,6 @@ sway_deps = [ 113 | cairo, 114 | drm, 115 | jsonc, 116 | - libevdev, 117 | libinput, 118 | libudev, 119 | math, 120 | -------------------------------------------------------------------------------- /repo/sway/post-install: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | cat <