xorgserver: set log-dir to /var/log instead of the Nix store

Xorg creates the log-dir in its output path because X crashes if it can't write
to its logfile. On a regular distro, this dir would be installed into the root
to prevent that from happening but with Nix, it sits in the read-only Nix store.
Ironically, when Xorg tries to write here, it fails and crashes.

To make Xorg log to /var/log, we have to stop the build script from trying to
create the log-dir as the sandbox doesn't (and shouldn't) have access to /var.

This creates a runtime dependency on /var when running as root but that should
exist on any Linux system (on NixOS, journald always creates /var/log).

Previously, the startx displayManager required some workarounds for logfiles
which are obsolete now.

patchPhase -> postPatch because overriding the patchPhase prevents patches from
being applied
This commit is contained in:
Atemu 2020-05-03 19:09:43 +02:00
parent c72c02ab26
commit a5ea1b6fb3
2 changed files with 40 additions and 1 deletions

View File

@ -0,0 +1,32 @@
---
hw/xfree86/Makefile.am | 1 -
hw/xfree86/Makefile.in | 1 -
2 files changed, 2 deletions(-)
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 9aeaea1..dcca3b8 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -100,7 +100,6 @@ EXTRA_DIST = xorgconf.cpp
# Without logdir, X will post an error on the terminal and will not start
install-data-local:
- $(AM_V_GEN)$(MKDIR_P) $(DESTDIR)$(logdir)
if CYGWIN
$(INSTALL_DATA) libXorg.exe.a $(DESTDIR)$(libdir)/libXorg.exe.a
endif
diff --git a/hw/xfree86/Makefile.in b/hw/xfree86/Makefile.in
index c4fceee..74da8f1 100644
--- a/hw/xfree86/Makefile.in
+++ b/hw/xfree86/Makefile.in
@@ -1161,7 +1161,6 @@ uninstall-am: uninstall-binPROGRAMS uninstall-local \
# Without logdir, X will post an error on the terminal and will not start
install-data-local:
- $(AM_V_GEN)$(MKDIR_P) $(DESTDIR)$(logdir)
@CYGWIN_TRUE@ $(INSTALL_DATA) libXorg.exe.a $(DESTDIR)$(libdir)/libXorg.exe.a
install-exec-hook:
--
2.25.4

View File

@ -571,7 +571,7 @@ self: super:
attrs =
if (abiCompat == null || lib.hasPrefix abiCompat version) then
attrs_passed // {
buildInputs = attrs_passed.buildInputs ++ [ libdrm.dev ]; patchPhase = ''
buildInputs = attrs_passed.buildInputs ++ [ libdrm.dev ]; postPatch = ''
for i in dri3/*.c
do
sed -i -e "s|#include <drm_fourcc.h>|#include <libdrm/drm_fourcc.h>|" $i
@ -626,6 +626,12 @@ self: super:
if (!isDarwin)
then {
outputs = [ "out" "dev" ];
patches = [
# The build process tries to create the specified logdir when building.
#
# We set it to /var/log which can't be touched from inside the sandbox causing the build to hard-fail
./dont-create-logdir-during-build.patch
];
buildInputs = commonBuildInputs ++ [ libdrm mesa ];
propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ libpciaccess epoxy ] ++ commonPropagatedBuildInputs ++ lib.optionals stdenv.isLinux [
udev
@ -642,6 +648,7 @@ self: super:
"--with-xkb-bin-directory=${self.xkbcomp}/bin"
"--with-xkb-path=${self.xkeyboardconfig}/share/X11/xkb"
"--with-xkb-output=$out/share/X11/xkb/compiled"
"--with-log-dir=/var/log"
"--enable-glamor"
] ++ lib.optionals stdenv.hostPlatform.isMusl [
"--disable-tls"