uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,30 @@
{ lib, stdenv, fetchurl, xorg, pixman, pkg-config, AppKit, Foundation, Xplugin }:
let version = "1.3.1";
in stdenv.mkDerivation {
pname = "quartz-wm";
inherit version;
src = fetchurl {
url = "http://xquartz-dl.macosforge.org/src/quartz-wm-${version}.tar.xz";
sha256 = "1j8zd3p7rhay1s3sxq6anw78k5s59mx44xpqla2ianl62346a5g9";
};
patches = [
./no_title_crash.patch
./extern-patch.patch
];
buildInputs = [
xorg.libXinerama
xorg.libAppleWM
xorg.xorgproto
xorg.libXrandr
xorg.libXext
pixman
pkg-config
AppKit Xplugin Foundation
];
meta = with lib; {
license = licenses.apsl20;
platforms = platforms.darwin;
maintainers = with maintainers; [ matthewbauer ];
};
}

View file

@ -0,0 +1,13 @@
diff --git a/src/x-list.h b/src/x-list.h
index bb85c02..059c88b 100644
--- a/src/x-list.h
+++ b/src/x-list.h
@@ -39,7 +39,7 @@
#endif
#ifndef X_EXTERN
-# define X_EXTERN __private_extern__
+# define X_EXTERN extern
#endif
X_EXTERN void X_PFX (list_free_1) (x_list *node);

View file

@ -0,0 +1,25 @@
commit c28527b1340c51f2b492a31e49127106cebbfc5d
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Fri Jun 1 10:38:37 2012 -0700
Fix a crash when minimizing windows without titles
<rdar://problem/11575791>
Regression-from: 21f210c923aa5d79400ce46275084f2636c92bd9
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
diff --git a/src/x-window.m b/src/x-window.m
index a210c6a..e3b9066 100644
--- a/src/x-window.m
+++ b/src/x-window.m
@@ -2139,7 +2139,7 @@ - (void) do_collapse
if (wid == XP_NULL_NATIVE_WINDOW_ID)
return;
- title_c = strdup([_title UTF8String]);
+ title_c = strdup([[self title] UTF8String]);
assert(title_c);
err = qwm_dock_minimize_item_with_title_async (wid, title_c);

1
pkgs/servers/x11/xorg/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
download-cache/

View file

@ -0,0 +1,40 @@
# This is the builder for all X.org components.
source $stdenv/setup
# After installation, automatically add all "Requires" fields in the
# pkgconfig files (*.pc) to the propagated build inputs.
origPostInstall=$postInstall
postInstall() {
if test -n "$origPostInstall"; then eval "$origPostInstall"; fi
local r p requires
set +o pipefail
requires=$(grep "Requires:" ${!outputDev}/lib/pkgconfig/*.pc | \
sed "s/Requires://" | sed "s/,/ /g")
set -o pipefail
echo "propagating requisites $requires"
for r in $requires; do
for p in "${pkgsHostHost[@]}" "${pkgsHostTarget[@]}"; do
if test -e $p/lib/pkgconfig/$r.pc; then
echo " found requisite $r in $p"
propagatedBuildInputs+=" $p"
fi
done
done
}
installFlags="appdefaultdir=$out/share/X11/app-defaults $installFlags"
if test -n "$x11BuildHook"; then
source $x11BuildHook
fi
enableParallelBuilding=1
genericBuild

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

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

@ -0,0 +1,327 @@
#!/usr/bin/env nix-shell
#!nix-shell --pure --keep NIX_PATH -i perl -p cacert nix perl
# Usage: manually update tarballs.list then run: ./generate-expr-from-tarballs.pl tarballs.list
use strict;
use warnings;
use File::Basename;
use File::Spec::Functions;
use File::Temp;
my %pkgURLs;
my %pkgHashes;
my %pkgNames;
my %pkgVersions;
my %pkgRequires;
my %pkgNativeRequires;
my %pcMap;
my %extraAttrs;
my @missingPCs = ("fontconfig", "libdrm", "libXaw", "zlib", "perl", "python3", "mkfontscale", "bdftopcf", "libxslt", "openssl", "gperf", "m4", "libinput", "libevdev", "mtdev", "xorgproto", "cairo", "gettext", "meson", "ninja" );
$pcMap{$_} = $_ foreach @missingPCs;
$pcMap{"freetype2"} = "freetype";
$pcMap{"libpng12"} = "libpng";
$pcMap{"libpng"} = "libpng";
$pcMap{"dbus-1"} = "dbus";
$pcMap{"uuid"} = "libuuid";
$pcMap{"libudev"} = "udev";
$pcMap{"gl"} = "libGL";
$pcMap{"GL"} = "libGL";
$pcMap{"gbm"} = "mesa";
$pcMap{"\$PIXMAN"} = "pixman";
$pcMap{"\$RENDERPROTO"} = "xorgproto";
$pcMap{"\$DRI3PROTO"} = "xorgproto";
$pcMap{"\$DRI2PROTO"} = "xorgproto";
$pcMap{"\${XKBMODULE}"} = "libxkbfile";
my $downloadCache = "./download-cache";
mkdir $downloadCache, 0755;
while (<>) {
chomp;
my $tarball = "$_";
print "\nDOING TARBALL $tarball\n";
my $pkg;
if ($tarball =~ s/:([a-zA-Z0-9_]+)$//) {
$pkg = $1;
} else {
$tarball =~ /\/((?:(?:[A-Za-z0-9]|(?:-[^0-9])|(?:-[0-9]*[a-z]))+))[^\/]*$/;
die unless defined $1;
$pkg = $1;
$pkg =~ s/(-|[a-f0-9]{40})//g; # Remove hyphen-minus and SHA-1
#next unless $pkg eq "xcbutil";
}
$tarball =~ /\/([^\/]*)\.(tar\.(bz2|gz|xz)|tgz)$/;
my $pkgName = $1;
print " $pkg $pkgName\n";
if (defined $pkgNames{$pkg}) {
print " SKIPPING\n";
next;
}
# Split by first occurrence of hyphen followed by only numbers, ends line, another hyphen follows, or SHA-1
my ($name, $version) = split(/-(?=[.0-9]+(?:$|-)|[a-f0-9]{40})/, $pkgName, 2);
$pkgURLs{$pkg} = $tarball;
$pkgNames{$pkg} = $name;
$pkgVersions{$pkg} = $version;
my $cachePath = catdir($downloadCache, basename($tarball));
my $hash;
my $path;
if (-e $cachePath) {
$path = readlink($cachePath);
$hash = `nix-hash --type sha256 --base32 --flat $cachePath`;
}
else {
($hash, $path) = `PRINT_PATH=1 QUIET=1 nix-prefetch-url '$tarball'`;
`nix-store --realise --add-root $cachePath --indirect $path`;
}
chomp $hash;
chomp $path;
$pkgHashes{$pkg} = $hash;
print "\nunpacking $path\n";
my $tmpDir = File::Temp->newdir();
system "cd '$tmpDir' && tar xf '$path'";
die "cannot unpack `$path'" if $? != 0;
print "\n";
my $pkgDir = `echo $tmpDir/*`;
chomp $pkgDir;
my $provides = `find $pkgDir -name "*.pc.in"`;
my @provides2 = split '\n', $provides;
my @requires = ();
my @nativeRequires = ();
foreach my $pcFile (@provides2) {
my $pc = $pcFile;
$pc =~ s/.*\///;
$pc =~ s/.pc.in//;
print "PROVIDES $pc\n";
die "collision with $pcMap{$pc}" if defined $pcMap{$pc};
$pcMap{$pc} = $pkg;
open FOO, "<$pcFile" or die;
while (<FOO>) {
if (/Requires:(.*)/) {
my @reqs = split ' ', $1;
foreach my $req (@reqs) {
next unless $req =~ /^[a-z]+$/;
print "REQUIRE (from $pc): $req\n";
push @requires, $req;
}
}
}
close FOO;
}
my $file;
{
local $/;
open FOO, "cd '$tmpDir'/* && grep -v '^ *#' configure.ac |";
$file = <FOO>;
close FOO;
}
if ($file =~ /XAW_CHECK_XPRINT_SUPPORT/) {
push @requires, "libXaw";
}
if ($file =~ /zlib is required/ || $file =~ /AC_CHECK_LIB\(z\,/) {
push @requires, "zlib";
}
if ($file =~ /Perl is required/) {
push @requires, "perl";
}
if ($file =~ /AC_PATH_PROG\(BDFTOPCF/) {
push @nativeRequires, "bdftopcf";
}
if ($file =~ /AC_PATH_PROG\(MKFONTSCALE/) {
push @nativeRequires, "mkfontscale";
}
if ($file =~ /AC_PATH_PROG\(MKFONTDIR/) {
push @nativeRequires, "mkfontscale";
}
if ($file =~ /AM_PATH_PYTHON/) {
push @nativeRequires, "python3";
}
if ($file =~ /AC_PATH_PROG\(FCCACHE/) {
# Don't run fc-cache.
die if defined $extraAttrs{$pkg};
push @{$extraAttrs{$pkg}}, "preInstall = \"installFlags=(FCCACHE=true)\";";
}
my $isFont;
if ($file =~ /XORG_FONT_BDF_UTILS/) {
push @nativeRequires, "bdftopcf", "mkfontscale";
$isFont = 1;
}
if ($file =~ /XORG_FONT_SCALED_UTILS/) {
push @nativeRequires, "mkfontscale";
$isFont = 1;
}
if ($file =~ /XORG_FONT_UCS2ANY/) {
push @nativeRequires, "fontutil", "mkfontscale";
$isFont = 1;
}
if ($isFont) {
push @{$extraAttrs{$pkg}}, "configureFlags = [ \"--with-fontrootdir=\$(out)/lib/X11/fonts\" ];";
}
sub process {
my $requires = shift;
my $s = shift;
$s =~ s/\[/\ /g;
$s =~ s/\]/\ /g;
$s =~ s/\,/\ /g;
foreach my $req (split / /, $s) {
next if $req eq ">=";
#next if $req =~ /^\$/;
next if $req =~ /^[0-9]/;
next if $req =~ /^\s*$/;
next if $req eq '$REQUIRED_MODULES';
next if $req eq '$REQUIRED_LIBS';
next if $req eq '$XDMCP_MODULES';
next if $req eq '$XORG_MODULES';
print "REQUIRE: $req\n";
push @{$requires}, $req;
}
}
#process \@requires, $1 while $file =~ /PKG_CHECK_MODULES\([^,]*,\s*[\[]?([^\)\[]*)/g;
process \@requires, $1 while $file =~ /PKG_CHECK_MODULES\([^,]*,([^\)\,]*)/g;
process \@requires, $1 while $file =~ /AC_SEARCH_LIBS\([^,]*,([^\)\,]*)/g;
process \@requires, $1 while $file =~ /MODULES=\"(.*)\"/g;
process \@requires, $1 while $file =~ /REQUIRED_LIBS=\"(.*)\"/g;
process \@requires, $1 while $file =~ /REQUIRED_MODULES=\"(.*)\"/g;
process \@requires, $1 while $file =~ /REQUIRES=\"(.*)\"/g;
process \@requires, $1 while $file =~ /X11_REQUIRES=\'(.*)\'/g;
process \@requires, $1 while $file =~ /XDMCP_MODULES=\"(.*)\"/g;
process \@requires, $1 while $file =~ /XORG_MODULES=\"(.*)\"/g;
process \@requires, $1 while $file =~ /NEEDED=\"(.*)\"/g;
process \@requires, $1 while $file =~ /ivo_requires=\"(.*)\"/g;
process \@requires, $1 while $file =~ /XORG_DRIVER_CHECK_EXT\([^,]*,([^\)]*)\)/g;
push @nativeRequires, "gettext" if $file =~ /USE_GETTEXT/;
push @requires, "libxslt" if $pkg =~ /libxcb/;
push @nativeRequires, "meson", "ninja" if $pkg =~ /libxcvt/;
push @nativeRequires, "m4" if $pkg =~ /xcbutil/;
push @requires, "gperf", "xorgproto" if $pkg =~ /xcbutil/;
print "REQUIRES $pkg => @requires\n";
print "NATIVE_REQUIRES $pkg => @nativeRequires\n";
$pkgRequires{$pkg} = \@requires;
$pkgNativeRequires{$pkg} = \@nativeRequires;
print "done\n";
}
print "\nWRITE OUT\n";
open OUT, ">default.nix";
print OUT "";
print OUT <<EOF;
# THIS IS A GENERATED FILE. DO NOT EDIT!
{ lib, newScope, pixman }:
lib.makeScope newScope (self: with self; {
inherit pixman;
EOF
foreach my $pkg (sort (keys %pkgURLs)) {
print "$pkg\n";
my %nativeRequires = ();
my @nativeBuildInputs;
foreach my $req (sort @{$pkgNativeRequires{$pkg}}) {
if (defined $pcMap{$req}) {
# Some packages have .pc that depends on itself.
next if $pcMap{$req} eq $pkg;
if (!defined $nativeRequires{$pcMap{$req}}) {
push @nativeBuildInputs, $pcMap{$req};
$nativeRequires{$pcMap{$req}} = 1;
}
} else {
print " NOT FOUND: $req\n";
}
}
my %requires = ();
my @buildInputs;
foreach my $req (sort @{$pkgRequires{$pkg}}) {
if (defined $pcMap{$req}) {
# Some packages have .pc that depends on itself.
next if $pcMap{$req} eq $pkg;
if (!defined $requires{$pcMap{$req}}) {
push @buildInputs, $pcMap{$req};
$requires{$pcMap{$req}} = 1;
}
} else {
print " NOT FOUND: $req\n";
}
}
my $nativeBuildInputsStr = join "", map { $_ . " " } @nativeBuildInputs;
my $buildInputsStr = join "", map { $_ . " " } @buildInputs;
my @arguments = @buildInputs;
push @arguments, @nativeBuildInputs;
unshift @arguments, "stdenv", "pkg-config", "fetchurl";
my $argumentsStr = join ", ", @arguments;
my $extraAttrsStr = "";
if (defined $extraAttrs{$pkg}) {
$extraAttrsStr = join "", map { "\n " . $_ } @{$extraAttrs{$pkg}};
}
print OUT <<EOF
# THIS IS A GENERATED FILE. DO NOT EDIT!
$pkg = callPackage ({ $argumentsStr }: stdenv.mkDerivation {
pname = "$pkgNames{$pkg}";
version = "$pkgVersions{$pkg}";
builder = ./builder.sh;
src = fetchurl {
url = "$pkgURLs{$pkg}";
sha256 = "$pkgHashes{$pkg}";
};
hardeningDisable = [ "bindnow" "relro" ];
nativeBuildInputs = [ pkg-config $nativeBuildInputsStr];
buildInputs = [ $buildInputsStr];$extraAttrsStr
meta.platforms = lib.platforms.unix;
}) {};
EOF
}
print OUT "})\n";
close OUT;

View file

@ -0,0 +1,13 @@
diff --git a/imake.c b/imake.c
index c20cd4a..ec2589b 100644
--- a/imake.c
+++ b/imake.c
@@ -959,7 +959,7 @@ get_libc_version(FILE *inFile)
{
char aout[4096], *tmpdir;
FILE *fp;
- const char *format = "%s -o %s -x c -";
+ const char *format = "f=$(mktemp imakeXXXXXX.c); cat > $f; %s $f -o %s";
char *cc;
int len;
char *command;

View file

@ -0,0 +1,19 @@
export IMAKECPP="@tradcpp@/bin/tradcpp"
imakeConfigurePhase() {
runHook preConfigure
echoCmd 'configuring with imake'
if [ -z "${imakefile:-}" -a ! -e Imakefile ]; then
echo "no Imakefile, doing nothing"
else
xmkmf -a
fi
runHook postConfigure
}
if [ -z "${dontUseImakeConfigure-}" -a -z "${configurePhase-}" ]; then
configurePhase=imakeConfigurePhase
fi

View file

@ -0,0 +1,41 @@
Disable imake autodetection for:
- LinuxDistribution to avoid injection of /usr paths
- gcc to avoid use uf /usr/bin/gcc
https://github.com/NixOS/nixpkgs/issues/135337
--- a/imake.c
+++ b/imake.c
@@ -1065,6 +1065,7 @@ get_distrib(FILE *inFile)
fprintf (inFile, "%s\n", "#define LinuxWare 11");
fprintf (inFile, "%s\n", "#define LinuxYggdrasil 12");
+#if 0 /* disable system autodetection. Fall through to LinuxUnknown. */
# ifdef CROSSCOMPILE
if (CrossCompiling) {
fprintf (inFile, "%s\n",
@@ -1090,6 +1091,7 @@ get_distrib(FILE *inFile)
* at the content of /etc/debian_version */
return;
}
+#endif
/* what's the definitive way to tell what any particular distribution is? */
fprintf (inFile, "%s\n", "#define DefaultLinuxDistribution LinuxUnknown");
@@ -1337,6 +1339,7 @@ get_gcc_version(FILE *inFile, char *name)
static boolean
get_gcc(char *cmd)
{
+#if 0 /* disable gcc autodetection. Fall through to explicitly set. */
struct stat sb;
static const char* gcc_path[] = {
#if defined(linux) || \
@@ -1385,6 +1388,9 @@ get_gcc(char *cmd)
}
}
return FALSE;
+#endif
+ strcpy (cmd, IMAKE_COMPILETIME_CPP);
+ return TRUE;
}
#ifdef CROSSCOMPILE

View file

@ -0,0 +1,6 @@
preInstall() {
mkdir -p $out/lib/X11/config
ln -s $xorgcffiles/lib/X11/config/* $out/lib/X11/config
#touch $out/lib/X11/config/host.def # !!! hack
#touch $out/lib/X11/config/date.def # !!! hack
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,221 @@
https://invisible-mirror.net/archives/luit/luit-20190106.tgz
https://xcb.freedesktop.org/dist/libpthread-stubs-0.4.tar.bz2
https://xcb.freedesktop.org/dist/xcb-util-0.4.0.tar.bz2
https://xcb.freedesktop.org/dist/xcb-util-cursor-0.1.3.tar.bz2
https://xcb.freedesktop.org/dist/xcb-util-errors-1.0.tar.bz2
https://xcb.freedesktop.org/dist/xcb-util-image-0.4.0.tar.bz2
https://xcb.freedesktop.org/dist/xcb-util-keysyms-0.4.0.tar.bz2
https://xcb.freedesktop.org/dist/xcb-util-renderutil-0.3.9.tar.bz2
https://xcb.freedesktop.org/dist/xcb-util-wm-0.4.1.tar.bz2
mirror://xorg/individual/app/appres-1.0.5.tar.bz2
mirror://xorg/individual/app/bdftopcf-1.1.tar.bz2
mirror://xorg/individual/app/bitmap-1.0.9.tar.gz
mirror://xorg/individual/app/editres-1.0.7.tar.bz2
mirror://xorg/individual/app/fonttosfnt-1.2.2.tar.bz2
mirror://xorg/individual/app/iceauth-1.0.8.tar.bz2
mirror://xorg/individual/app/ico-1.0.5.tar.bz2
mirror://xorg/individual/app/listres-1.0.4.tar.bz2
mirror://xorg/individual/app/mkfontscale-1.2.1.tar.bz2
mirror://xorg/individual/app/oclock-1.0.4.tar.bz2
mirror://xorg/individual/app/sessreg-1.1.2.tar.bz2
mirror://xorg/individual/app/setxkbmap-1.3.2.tar.bz2
mirror://xorg/individual/app/smproxy-1.0.6.tar.bz2
mirror://xorg/individual/app/transset-1.0.2.tar.bz2
mirror://xorg/individual/app/twm-1.0.10.tar.bz2
mirror://xorg/individual/app/viewres-1.0.5.tar.bz2
mirror://xorg/individual/app/x11perf-1.6.1.tar.bz2
mirror://xorg/individual/app/xauth-1.1.tar.bz2
mirror://xorg/individual/app/xbacklight-1.2.3.tar.bz2
mirror://xorg/individual/app/xcalc-1.1.0.tar.bz2
mirror://xorg/individual/app/xclock-1.0.9.tar.bz2
mirror://xorg/individual/app/xcmsdb-1.0.5.tar.bz2
mirror://xorg/individual/app/xcompmgr-1.1.8.tar.bz2
mirror://xorg/individual/app/xconsole-1.0.7.tar.bz2
mirror://xorg/individual/app/xcursorgen-1.0.7.tar.bz2
mirror://xorg/individual/app/xdm-1.1.12.tar.bz2
mirror://xorg/individual/app/xdpyinfo-1.3.2.tar.bz2
mirror://xorg/individual/app/xdriinfo-1.0.6.tar.bz2
mirror://xorg/individual/app/xev-1.2.4.tar.bz2
mirror://xorg/individual/app/xeyes-1.2.0.tar.bz2
mirror://xorg/individual/app/xfd-1.1.3.tar.bz2
mirror://xorg/individual/app/xfontsel-1.0.6.tar.bz2
mirror://xorg/individual/app/xfs-1.2.0.tar.bz2
mirror://xorg/individual/app/xfsinfo-1.0.6.tar.bz2
mirror://xorg/individual/app/xgamma-1.0.6.tar.bz2
mirror://xorg/individual/app/xgc-1.0.5.tar.bz2
mirror://xorg/individual/app/xhost-1.0.8.tar.bz2
mirror://xorg/individual/app/xinit-1.4.1.tar.bz2
mirror://xorg/individual/app/xinput-1.6.3.tar.bz2
mirror://xorg/individual/app/xkbcomp-1.4.5.tar.bz2
mirror://xorg/individual/app/xkbevd-1.1.4.tar.bz2
mirror://xorg/individual/app/xkbprint-1.0.4.tar.bz2
mirror://xorg/individual/app/xkbutils-1.0.4.tar.bz2
mirror://xorg/individual/app/xkill-1.0.5.tar.bz2
mirror://xorg/individual/app/xload-1.1.3.tar.bz2
mirror://xorg/individual/app/xlsatoms-1.1.3.tar.bz2
mirror://xorg/individual/app/xlsclients-1.1.4.tar.bz2
mirror://xorg/individual/app/xlsfonts-1.0.6.tar.bz2
mirror://xorg/individual/app/xmag-1.0.6.tar.bz2
mirror://xorg/individual/app/xmessage-1.0.5.tar.bz2
mirror://xorg/individual/app/xmodmap-1.0.10.tar.bz2
mirror://xorg/individual/app/xmore-1.0.3.tar.bz2
mirror://xorg/individual/app/xpr-1.0.5.tar.bz2
mirror://xorg/individual/app/xprop-1.2.5.tar.bz2
mirror://xorg/individual/app/xrandr-1.5.1.tar.xz
mirror://xorg/individual/app/xrdb-1.2.1.tar.bz2
mirror://xorg/individual/app/xrefresh-1.0.6.tar.bz2
mirror://xorg/individual/app/xset-1.2.4.tar.bz2
mirror://xorg/individual/app/xsetroot-1.1.2.tar.bz2
mirror://xorg/individual/app/xsm-1.0.4.tar.bz2
mirror://xorg/individual/app/xstdcmap-1.0.4.tar.bz2
mirror://xorg/individual/app/xtrap-1.0.3.tar.bz2
mirror://xorg/individual/app/xvinfo-1.1.4.tar.bz2
mirror://xorg/individual/app/xwd-1.0.8.tar.bz2
mirror://xorg/individual/app/xwininfo-1.1.4.tar.bz2
mirror://xorg/individual/app/xwud-1.0.5.tar.bz2
mirror://xorg/individual/data/xbitmaps-1.1.2.tar.bz2
mirror://xorg/individual/data/xcursor-themes-1.0.6.tar.bz2
mirror://xorg/individual/data/xkeyboard-config/xkeyboard-config-2.33.tar.bz2
mirror://xorg/individual/doc/xorg-docs-1.7.1.tar.bz2
mirror://xorg/individual/doc/xorg-sgml-doctools-1.11.tar.bz2
mirror://xorg/individual/driver/xf86-input-evdev-2.10.6.tar.bz2
mirror://xorg/individual/driver/xf86-input-joystick-1.6.3.tar.bz2
mirror://xorg/individual/driver/xf86-input-keyboard-1.9.0.tar.bz2
mirror://xorg/individual/driver/xf86-input-libinput-1.2.0.tar.bz2
mirror://xorg/individual/driver/xf86-input-mouse-1.9.3.tar.bz2
mirror://xorg/individual/driver/xf86-input-synaptics-1.9.1.tar.bz2
mirror://xorg/individual/driver/xf86-input-vmmouse-13.1.0.tar.bz2
mirror://xorg/individual/driver/xf86-input-void-1.4.1.tar.bz2
mirror://xorg/individual/driver/xf86-video-amdgpu-21.0.0.tar.bz2
mirror://xorg/individual/driver/xf86-video-apm-1.3.0.tar.bz2
mirror://xorg/individual/driver/xf86-video-ark-0.7.5.tar.bz2
mirror://xorg/individual/driver/xf86-video-ast-1.1.5.tar.bz2
https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/-/archive/5eba006e4129e8015b822f9e1d2f1e613e252cda/xf86-video-ati-5eba006e4129e8015b822f9e1d2f1e613e252cda.tar.bz2
mirror://xorg/individual/driver/xf86-video-chips-1.4.0.tar.bz2
mirror://xorg/individual/driver/xf86-video-cirrus-1.5.3.tar.bz2
mirror://xorg/individual/driver/xf86-video-dummy-0.3.8.tar.bz2
mirror://xorg/individual/driver/xf86-video-fbdev-0.5.0.tar.bz2
mirror://xorg/individual/driver/xf86-video-geode-2.11.19.tar.bz2
mirror://xorg/individual/driver/xf86-video-glide-1.2.2.tar.bz2
mirror://xorg/individual/driver/xf86-video-glint-1.2.9.tar.bz2
mirror://xorg/individual/driver/xf86-video-i128-1.4.0.tar.bz2
mirror://xorg/individual/driver/xf86-video-i740-1.4.0.tar.bz2
mirror://xorg/individual/driver/xf86-video-intel-2.99.917.tar.bz2
mirror://xorg/individual/driver/xf86-video-mga-2.0.0.tar.bz2
mirror://xorg/individual/driver/xf86-video-neomagic-1.3.0.tar.bz2
mirror://xorg/individual/driver/xf86-video-newport-0.2.4.tar.bz2
https://gitlab.freedesktop.org/xorg/driver/xf86-video-nouveau/-/archive/3ee7cbca8f9144a3bb5be7f71ce70558f548d268/xf86-video-nouveau-3ee7cbca8f9144a3bb5be7f71ce70558f548d268.tar.bz2
mirror://xorg/individual/driver/xf86-video-nv-2.1.21.tar.bz2
mirror://xorg/individual/driver/xf86-video-omap-0.4.5.tar.bz2
mirror://xorg/individual/driver/xf86-video-openchrome-0.6.0.tar.bz2
mirror://xorg/individual/driver/xf86-video-qxl-0.1.5.tar.bz2
mirror://xorg/individual/driver/xf86-video-r128-6.11.0.tar.bz2
mirror://xorg/individual/driver/xf86-video-rendition-4.2.7.tar.bz2
mirror://xorg/individual/driver/xf86-video-s3virge-1.11.0.tar.bz2
mirror://xorg/individual/driver/xf86-video-savage-2.3.9.tar.bz2
mirror://xorg/individual/driver/xf86-video-siliconmotion-1.7.9.tar.bz2
mirror://xorg/individual/driver/xf86-video-sis-0.11.0.tar.bz2
mirror://xorg/individual/driver/xf86-video-sisusb-0.9.7.tar.bz2
mirror://xorg/individual/driver/xf86-video-suncg6-1.1.2.tar.bz2
mirror://xorg/individual/driver/xf86-video-sunffb-1.2.2.tar.bz2
mirror://xorg/individual/driver/xf86-video-sunleo-1.2.2.tar.bz2
mirror://xorg/individual/driver/xf86-video-tdfx-1.5.0.tar.bz2
mirror://xorg/individual/driver/xf86-video-tga-1.2.2.tar.bz2
mirror://xorg/individual/driver/xf86-video-trident-1.3.8.tar.bz2
mirror://xorg/individual/driver/xf86-video-v4l-0.3.0.tar.bz2
mirror://xorg/individual/driver/xf86-video-vboxvideo-1.0.0.tar.bz2
mirror://xorg/individual/driver/xf86-video-vesa-2.5.0.tar.bz2
mirror://xorg/individual/driver/xf86-video-vmware-13.3.0.tar.bz2
mirror://xorg/individual/driver/xf86-video-voodoo-1.2.5.tar.bz2
mirror://xorg/individual/driver/xf86-video-wsfb-0.4.0.tar.bz2
mirror://xorg/individual/driver/xf86-video-xgi-1.6.1.tar.bz2
mirror://xorg/individual/font/encodings-1.0.5.tar.bz2
mirror://xorg/individual/font/font-adobe-100dpi-1.0.3.tar.bz2
mirror://xorg/individual/font/font-adobe-75dpi-1.0.3.tar.bz2
mirror://xorg/individual/font/font-adobe-utopia-100dpi-1.0.4.tar.bz2
mirror://xorg/individual/font/font-adobe-utopia-75dpi-1.0.4.tar.bz2
mirror://xorg/individual/font/font-adobe-utopia-type1-1.0.4.tar.bz2
mirror://xorg/individual/font/font-alias-1.0.3.tar.bz2
mirror://xorg/individual/font/font-arabic-misc-1.0.3.tar.bz2
mirror://xorg/individual/font/font-bh-100dpi-1.0.3.tar.bz2
mirror://xorg/individual/font/font-bh-75dpi-1.0.3.tar.bz2
mirror://xorg/individual/font/font-bh-lucidatypewriter-100dpi-1.0.3.tar.bz2
mirror://xorg/individual/font/font-bh-lucidatypewriter-75dpi-1.0.3.tar.bz2
mirror://xorg/individual/font/font-bh-ttf-1.0.3.tar.bz2
mirror://xorg/individual/font/font-bh-type1-1.0.3.tar.bz2
mirror://xorg/individual/font/font-bitstream-100dpi-1.0.3.tar.bz2
mirror://xorg/individual/font/font-bitstream-75dpi-1.0.3.tar.bz2
mirror://xorg/individual/font/font-bitstream-type1-1.0.3.tar.bz2
mirror://xorg/individual/font/font-cronyx-cyrillic-1.0.3.tar.bz2
mirror://xorg/individual/font/font-cursor-misc-1.0.3.tar.bz2
mirror://xorg/individual/font/font-daewoo-misc-1.0.3.tar.bz2
mirror://xorg/individual/font/font-dec-misc-1.0.3.tar.bz2
mirror://xorg/individual/font/font-ibm-type1-1.0.3.tar.bz2
mirror://xorg/individual/font/font-isas-misc-1.0.3.tar.bz2
mirror://xorg/individual/font/font-jis-misc-1.0.3.tar.bz2
mirror://xorg/individual/font/font-micro-misc-1.0.3.tar.bz2
mirror://xorg/individual/font/font-misc-cyrillic-1.0.3.tar.bz2
mirror://xorg/individual/font/font-misc-ethiopic-1.0.3.tar.bz2
mirror://xorg/individual/font/font-misc-meltho-1.0.3.tar.bz2
mirror://xorg/individual/font/font-misc-misc-1.1.2.tar.bz2
mirror://xorg/individual/font/font-mutt-misc-1.0.3.tar.bz2
mirror://xorg/individual/font/font-schumacher-misc-1.1.2.tar.bz2
mirror://xorg/individual/font/font-screen-cyrillic-1.0.4.tar.bz2
mirror://xorg/individual/font/font-sony-misc-1.0.3.tar.bz2
mirror://xorg/individual/font/font-sun-misc-1.0.3.tar.bz2
mirror://xorg/individual/font/font-util-1.3.1.tar.bz2
mirror://xorg/individual/font/font-winitzki-cyrillic-1.0.3.tar.bz2
mirror://xorg/individual/font/font-xfree86-type1-1.0.4.tar.bz2
mirror://xorg/individual/lib/libAppleWM-1.4.1.tar.bz2
mirror://xorg/individual/lib/libdmx-1.1.4.tar.bz2
mirror://xorg/individual/lib/libfontenc-1.1.4.tar.bz2
mirror://xorg/individual/lib/libFS-1.0.8.tar.bz2
mirror://xorg/individual/lib/libICE-1.0.10.tar.bz2
mirror://xorg/individual/lib/libpciaccess-0.16.tar.bz2
mirror://xorg/individual/lib/libSM-1.2.3.tar.bz2
mirror://xorg/individual/lib/libWindowsWM-1.0.1.tar.bz2
mirror://xorg/individual/lib/libX11-1.7.2.tar.bz2
mirror://xorg/individual/lib/libXau-1.0.9.tar.bz2
mirror://xorg/individual/lib/libXaw-1.0.14.tar.bz2
mirror://xorg/individual/lib/libXaw3d-1.6.3.tar.bz2
mirror://xorg/individual/lib/libxcb-1.14.tar.xz
mirror://xorg/individual/lib/libXcomposite-0.4.5.tar.bz2
mirror://xorg/individual/lib/libXcursor-1.2.0.tar.bz2
mirror://xorg/individual/lib/libxcvt-0.1.1.tar.xz
mirror://xorg/individual/lib/libXdamage-1.1.5.tar.bz2
mirror://xorg/individual/lib/libXdmcp-1.1.3.tar.bz2
mirror://xorg/individual/lib/libXext-1.3.4.tar.bz2
mirror://xorg/individual/lib/libXfixes-6.0.0.tar.bz2
mirror://xorg/individual/lib/libXfont-1.5.4.tar.bz2
mirror://xorg/individual/lib/libXfont2-2.0.5.tar.bz2
mirror://xorg/individual/lib/libXft-2.3.4.tar.bz2
mirror://xorg/individual/lib/libXi-1.8.tar.bz2
mirror://xorg/individual/lib/libXinerama-1.1.4.tar.bz2
mirror://xorg/individual/lib/libxkbfile-1.1.0.tar.bz2
mirror://xorg/individual/lib/libXmu-1.1.3.tar.bz2
mirror://xorg/individual/lib/libXp-1.0.3.tar.bz2
mirror://xorg/individual/lib/libXpm-3.5.13.tar.bz2
mirror://xorg/individual/lib/libXpresent-1.0.0.tar.bz2
mirror://xorg/individual/lib/libXrandr-1.5.2.tar.bz2
mirror://xorg/individual/lib/libXrender-0.9.10.tar.bz2
mirror://xorg/individual/lib/libXres-1.2.1.tar.bz2
mirror://xorg/individual/lib/libXScrnSaver-1.2.3.tar.bz2
mirror://xorg/individual/lib/libxshmfence-1.3.tar.bz2
mirror://xorg/individual/lib/libXTrap-1.0.1.tar.bz2
mirror://xorg/individual/lib/libXt-1.2.1.tar.bz2
mirror://xorg/individual/lib/libXtst-1.2.3.tar.bz2
mirror://xorg/individual/lib/libXv-1.0.11.tar.bz2
mirror://xorg/individual/lib/libXvMC-1.0.12.tar.bz2
mirror://xorg/individual/lib/libXxf86dga-1.1.5.tar.bz2
mirror://xorg/individual/lib/libXxf86misc-1.0.4.tar.bz2
mirror://xorg/individual/lib/libXxf86vm-1.1.4.tar.bz2
mirror://xorg/individual/lib/xtrans-1.4.0.tar.bz2
mirror://xorg/individual/proto/xcb-proto-1.14.1.tar.xz
mirror://xorg/individual/proto/xorgproto-2021.5.tar.bz2
mirror://xorg/individual/util/gccmakedep-1.0.3.tar.bz2
mirror://xorg/individual/util/imake-1.0.8.tar.bz2
mirror://xorg/individual/util/lndir-1.0.3.tar.bz2
mirror://xorg/individual/util/makedepend-1.0.6.tar.bz2
mirror://xorg/individual/util/util-macros-1.19.3.tar.bz2
mirror://xorg/individual/util/xorg-cf-files-1.0.7.tar.bz2
mirror://xorg/individual/xserver/xorg-server-1.20.13.tar.xz

View file

@ -0,0 +1,24 @@
{ lib, stdenv, fetchurl, pkg-config, m4, libxcb, xcbutil, libX11 }:
stdenv.mkDerivation rec {
version = "1.3";
pname = "xcb-util-xrm";
src = fetchurl {
url = "https://github.com/Airblader/xcb-util-xrm/releases/download/v${version}/${pname}-${version}.tar.bz2";
sha256 = "118cj1ybw86pgw0l5whn9vbg5n5b0ijcpx295mwahzi004vz671h";
};
strictDeps = true;
nativeBuildInputs = [ pkg-config m4 ];
doCheck = true;
buildInputs = [ libxcb xcbutil libX11 ];
meta = with lib; {
description = "XCB utility functions for the X resource manager";
homepage = "https://github.com/Airblader/xcb-util-xrm";
license = licenses.mit; # X11 variant
platforms = with platforms; unix;
};
}

View file

@ -0,0 +1,112 @@
{ egl-wayland
, libepoxy
, fetchurl
, fontutil
, lib
, libGL
, libGLU
, libX11
, libXau
, libXaw
, libXdmcp
, libXext
, libXfixes
, libXfont2
, libXmu
, libXpm
, libXrender
, libXres
, libXt
, libdrm
, libtirpc
, libunwind
, libxcb
, libxkbfile
, libxshmfence
, libxcvt
, mesa
, meson
, ninja
, openssl
, pkg-config
, pixman
, stdenv
, wayland
, wayland-protocols
, wayland-scanner
, xkbcomp
, xkeyboard_config
, xorgproto
, xtrans
, zlib
, defaultFontPath ? "" }:
stdenv.mkDerivation rec {
pname = "xwayland";
version = "22.1.1";
src = fetchurl {
url = "mirror://xorg/individual/xserver/${pname}-${version}.tar.xz";
sha256 = "sha256-9dDgujfhm7h8YvYdpZcL0gSTnyEgYglkvtTMhJW6plc=";
};
depsBuildBuild = [
pkg-config
];
nativeBuildInputs = [
pkg-config
meson
ninja
wayland-scanner
];
buildInputs = [
egl-wayland
libepoxy
fontutil
libGL
libGLU
libX11
libXau
libXaw
libXdmcp
libXext
libXfixes
libXfont2
libXmu
libXpm
libXrender
libXres
libXt
libdrm
libtirpc
libunwind
libxcb
libxkbfile
libxshmfence
libxcvt
mesa
openssl
pixman
wayland
wayland-protocols
xkbcomp
xorgproto
xtrans
zlib
];
mesonFlags = [
"-Dxwayland_eglstream=true"
"-Ddefault_font_path=${defaultFontPath}"
"-Dxkb_bin_dir=${xkbcomp}/bin"
"-Dxkb_dir=${xkeyboard_config}/etc/X11/xkb"
"-Dxkb_output_dir=${placeholder "out"}/share/X11/xkb/compiled"
];
meta = with lib; {
description = "An X server for interfacing X11 apps with the Wayland protocol";
homepage = "https://wayland.freedesktop.org/xserver.html";
license = licenses.mit;
maintainers = with maintainers; [ emantor ];
platforms = platforms.linux;
};
}

20
pkgs/servers/x11/xquartz/X11 Executable file
View file

@ -0,0 +1,20 @@
#!@shell@
set "$(dirname "$0")"/X11.bin "${@}"
export XQUARTZ_DEFAULT_CLIENT="@DEFAULT_CLIENT@"
export XQUARTZ_DEFAULT_SHELL="@DEFAULT_SHELL@"
export XQUARTZ_DEFAULT_STARTX="@DEFAULT_STARTX@"
export FONTCONFIG_FILE="@FONTCONFIG_FILE@"
if [ -x ~/.x11run ]; then
exec ~/.x11run "${@}"
fi
case $(basename "${SHELL}") in
bash) exec -l "${SHELL}" --login -c 'exec "${@}"' - "${@}" ;;
ksh|sh|zsh) exec -l "${SHELL}" -c 'exec "${@}"' - "${@}" ;;
csh|tcsh) exec -l "${SHELL}" -c 'exec $argv:q' "${@}" ;;
es|rc) exec -l "${SHELL}" -l -c 'exec $*' "${@}" ;;
*) exec "${@}" ;;
esac

View file

@ -0,0 +1,193 @@
{ lib, stdenv, buildEnv, makeFontsConf, gnused, writeScript, xorg, bashInteractive, xterm, makeWrapper, ruby
, quartz-wm, fontconfig, xlsfonts, xfontsel
, ttf_bitstream_vera, freefont_ttf, liberation_ttf
, shell ? "${bashInteractive}/bin/bash"
}:
# ------------
# Installation
# ------------
#
# First, assuming you've previously installed XQuartz from macosforge.com,
# unload and remove the existing launch agents:
#
# $ sudo launchctl unload /Library/LaunchAgents/org.macosforge.xquartz.startx.plist
# $ sudo launchctl unload /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist
# $ sudo rm /Library/LaunchAgents/org.macosforge.xquartz.startx.plist
# $ sudo rm /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist
#
# (You will need to log out for the above changes to take effect.)
#
# Then install xquartz from nixpkgs:
#
# $ nix-env -i xquartz
# $ xquartz-install
#
# You'll also want to add the following to your shell's profile (after you
# source nix.sh, so $NIX_LINK points to your user profile):
#
# if [ "$(uname)" = "Darwin" -a -n "$NIX_LINK" -a -f $NIX_LINK/etc/X11/fonts.conf ]; then
# export FONTCONFIG_FILE=$NIX_LINK/etc/X11/fonts.conf
# fi
# A note about dependencies:
# Xquartz wants to exec XQuartz.app, XQuartz.app wants to exec xstart, and
# xstart wants to exec Xquartz, so we must bundle all three to prevent a cycle.
# Coincidentally, this also makes it trivial to install launch agents/daemons
# that point into the user's profile.
let
installer = writeScript "xquartz-install" ''
NIX_LINK=$HOME/.nix-profile
tmpdir=$(/usr/bin/mktemp -d $TMPDIR/xquartz-installer-XXXXXXXX)
agentName=org.nixos.xquartz.startx.plist
daemonName=org.nixos.xquartz.privileged_startx.plist
sed=${gnused}/bin/sed
cp ${./org.nixos.xquartz.startx.plist} $tmpdir/$agentName
$sed -i "s|@LAUNCHD_STARTX@|$NIX_LINK/etc/X11/xinit/launchd_startx|" $tmpdir/$agentName
$sed -i "s|@STARTX@|$NIX_LINK/bin/startx|" $tmpdir/$agentName
$sed -i "s|@XQUARTZ@|$NIX_LINK/bin/Xquartz|" $tmpdir/$agentName
cp ${./org.nixos.xquartz.privileged_startx.plist} $tmpdir/$daemonName
$sed -i "s|@PRIVILEGED_STARTX@|$NIX_LINK/lib/X11/xinit/privileged_startx|" $tmpdir/$daemonName
$sed -i "s|@PRIVILEGED_STARTX_D@|$NIX_LINK/lib/X11/xinit/privileged_startx.d|" $tmpdir/$daemonName
sudo cp $tmpdir/$agentName /Library/LaunchAgents/$agentName
sudo cp $tmpdir/$daemonName /Library/LaunchDaemons/$daemonName
sudo launchctl load -w /Library/LaunchAgents/$agentName
sudo launchctl load -w /Library/LaunchDaemons/$daemonName
'';
fontDirs = [
xorg.fontbhlucidatypewriter100dpi
xorg.fontbhlucidatypewriter75dpi
ttf_bitstream_vera
freefont_ttf
liberation_ttf
xorg.fontbh100dpi
xorg.fontmiscmisc
xorg.fontcursormisc
];
fontsConf = makeFontsConf {
fontDirectories = fontDirs ++ [
"/Library/Fonts"
"~/Library/Fonts"
];
};
fonts = import ./system-fonts.nix {
inherit stdenv xorg fontDirs;
};
# any X related programs expected to be available via $PATH
env = buildEnv {
name = "xquartz-env";
pathsToLink = [ "/bin" ];
paths = with xorg; [
# non-xorg
quartz-wm xterm fontconfig
# xorg
xlsfonts xfontsel
bdftopcf fontutil iceauth libXpm lndir luit makedepend mkfontdir
mkfontscale sessreg setxkbmap smproxy twm x11perf xauth xbacklight xclock
xcmsdb xcursorgen xdm xdpyinfo xdriinfo xev xeyes xfs xgamma xhost
xinput xkbcomp xkbevd xkbutils xkill xlsatoms xlsclients xmessage xmodmap
xpr xprop xrandr xrdb xrefresh xset xsetroot xvinfo xwd xwininfo xwud
];
};
in stdenv.mkDerivation {
pname = "xquartz";
version = lib.getVersion xorg.xorgserver;
nativeBuildInputs = [ ruby makeWrapper ];
unpackPhase = "sourceRoot=.";
dontBuild = true;
installPhase = ''
cp -rT ${xorg.xinit} $out
chmod -R u+w $out
cp -rT ${xorg.xorgserver} $out
chmod -R u+w $out
cp ${installer} $out/bin/xquartz-install
rm -rf $out/LaunchAgents $out/LaunchDaemons
fontsConfPath=$out/etc/X11/fonts.conf
cp ${fontsConf} $fontsConfPath
cp ${./startx} $out/bin/startx
substituteInPlace $out/bin/startx \
--replace "@shell@" "${stdenv.shell}" \
--replace "@PATH@" "$out/bin:${env}" \
--replace "@XAUTH@" "${xorg.xauth}/bin/xauth" \
--replace "@FONT_CACHE@" "$out/bin/font_cache" \
--replace "@PRIVILEGED_STARTX@" "$out/lib/X11/xinit/privileged_startx" \
--replace "@DEFAULT_SERVER@" "$out/bin/Xquartz" \
--replace "@DEFAULT_CLIENT@" "${xterm}/bin/xterm" \
--replace "@XINIT@" "$out/bin/xinit" \
--replace "@XINITRC@" "$out/etc/X11/xinit/xinitrc" \
--replace "@FONTCONFIG_FILE@" "$fontsConfPath"
wrapProgram $out/bin/Xquartz \
--set XQUARTZ_X11 $out/Applications/XQuartz.app/Contents/MacOS/X11
defaultStartX="$out/bin/startx -- $out/bin/Xquartz"
ruby ${./patch_plist.rb} \
${lib.escapeShellArg (builtins.toXML {
XQUARTZ_DEFAULT_CLIENT = "${xterm}/bin/xterm";
XQUARTZ_DEFAULT_SHELL = shell;
XQUARTZ_DEFAULT_STARTX = "@STARTX@";
FONTCONFIG_FILE = "@FONTCONFIG_FILE@";
})} \
$out/Applications/XQuartz.app/Contents/Info.plist
substituteInPlace $out/Applications/XQuartz.app/Contents/Info.plist \
--replace "@STARTX@" "$defaultStartX" \
--replace "@FONTCONFIG_FILE@" "$fontsConfPath"
mkdir -p $out/lib/X11/xinit/privileged_startx.d
cp ${./privileged} $out/lib/X11/xinit/privileged_startx.d/privileged
substituteInPlace $out/lib/X11/xinit/privileged_startx.d/privileged \
--replace "@shell@" "${stdenv.shell}" \
--replace "@PATH@" "$out/bin:${env}" \
--replace "@FONTCONFIG_FILE@" "$fontsConfPath" \
--replace "@FONT_CACHE@" "$out/bin/font_cache"
cp ${./font_cache} $out/bin/font_cache
substituteInPlace $out/bin/font_cache \
--replace "@shell@" "${stdenv.shell}" \
--replace "@PATH@" "$out/bin:${env}" \
--replace "@ENCODINGSDIR@" "${xorg.encodings}/share/fonts/X11/encodings" \
--replace "@MKFONTDIR@" "${xorg.mkfontdir}/bin/mkfontdir" \
--replace "@MKFONTSCALE@" "${xorg.mkfontscale}/bin/mkfontscale" \
--replace "@FC_CACHE@" "${fontconfig.bin}/bin/fc-cache" \
--replace "@FONTCONFIG_FILE@" "$fontsConfPath"
cp ${./xinitrc} $out/etc/X11/xinit/xinitrc
substituteInPlace $out/etc/X11/xinit/xinitrc \
--replace "@shell@" "${stdenv.shell}" \
--replace "@PATH@" "$out/bin:${env}" \
--replace "@XSET@" "${xorg.xset}/bin/xset" \
--replace "@XMODMAP@" "${xorg.xmodmap}/bin/xmodmap" \
--replace "@XRDB@" "${xorg.xrdb}/bin/xrdb" \
--replace "@SYSTEM_FONTS@" "${fonts}/share/X11-fonts/" \
--replace "@QUARTZ_WM@" "${quartz-wm}/bin/quartz-wm" \
--replace "@FONTCONFIG_FILE@" "$fontsConfPath"
cp ${./X11} $out/Applications/XQuartz.app/Contents/MacOS/X11
substituteInPlace $out/Applications/XQuartz.app/Contents/MacOS/X11 \
--replace "@shell@" "${stdenv.shell}" \
--replace "@DEFAULT_SHELL@" "${shell}" \
--replace "@DEFAULT_STARTX@" "$defaultStartX" \
--replace "@DEFAULT_CLIENT@" "${xterm}/bin/xterm" \
--replace "@FONTCONFIG_FILE@" "$fontsConfPath"
'';
meta = with lib; {
platforms = platforms.darwin;
maintainers = with maintainers; [ cstrahan ];
license = licenses.mit;
};
}

View file

@ -0,0 +1,240 @@
#!@shell@
export PATH=@PATH@:$PATH
export FONTCONFIG_FILE="@FONTCONFIG_FILE@"
ENCODINGSDIR="@ENCODINGSDIR@"
FC_LOCKFILE=""
# Are we caching system fonts or user fonts?
system=0
# Are we including OSX font dirs ({/,~/,/System/}Library/Fonts)
osxfonts=1
# Do we want to force a recache?
force=0
# How noisy are we?
verbose=0
# Check if the data in the given directory is newer than its cache
check_dirty() {
local dir=$1
local fontfiles=""
local retval=1
# If the dir does not exist, we just exit
if [[ ! -d "${dir}" ]]; then
return 1
fi
# Create a list of all files in the dir
# Filter out config / cache files. Ugly... counting down the day until
# xfs finally goes away
fontfiles="$(find ${dir}/ -maxdepth 1 -type f | awk '$0 !~ /fonts\..*$|^.*\.dir$/ {print}')"
# Fonts were deleted (or never there). Kill off the caches
if [[ -z "${fontfiles}" ]] ; then
local f
for f in "${dir}"/fonts.* "${dir}"/encodings.dir; do
if [[ -f ${f} ]] ; then
rm -f "${f}"
fi
done
return 1
fi
# Force a recache
if [[ ${force} == 1 ]] ; then
retval=0
fi
# If we don't have our caches, we are dirty
if [[ ! -f "${dir}/fonts.list" || ! -f "${dir}/fonts.dir" || ! -f "${dir}/encodings.dir" ]]; then
retval=0
fi
# Check that no files were added or removed....
if [[ "${retval}" -ne 0 && "$(cat ${dir}/fonts.list)" != "${fontfiles}" ]] ; then
retval=0
fi
# Check that no files were updated....
if [[ "${retval}" -ne 0 ]] ; then
local changed="$(find ${dir}/ -type f -cnewer ${dir}/fonts.dir | awk '$0 !~ /fonts\..*$|^.*\.dir$/ {print}')"
if [[ -n "${changed}" ]] ; then
retval=0
fi
fi
# Recreate fonts.list since something changed
if [[ "${retval}" == 0 ]] ; then
echo "${fontfiles}" > "${dir}"/fonts.list
fi
return ${retval}
}
get_fontdirs() {
local d
if [[ $system == 1 ]] ; then
if [[ $osxfonts == 1 ]] ; then
find {/System/,/}Library/Fonts -type d
fi
else
if [[ $osxfonts == 1 && -d "${HOME}/Library/Fonts" ]] ; then
find "${HOME}/Library/Fonts" -type d
fi
if [[ -d "${HOME}/.fonts" ]] ; then
find "${HOME}/.fonts" -type d
fi
fi
}
setup_fontdirs() {
local x=""
local fontdirs=""
local changed="no"
umask 022
if [[ $system == 1 ]] ; then
echo "font_cache: Scanning system font directories to generate X11 font caches"
else
echo "font_cache: Scanning user font directories to generate X11 font caches"
fi
OIFS=$IFS
IFS='
'
for x in $(get_fontdirs) ; do
if [[ -d "${x}" ]] && check_dirty "${x}" ; then
if [[ -z "${fontdirs}" ]] ; then
fontdirs="${x}"
else
fontdirs="${fontdirs}${IFS}${x}"
fi
fi
done
if [[ -n "${fontdirs}" ]] ; then
echo "font_cache: Making fonts.dir for updated directories."
for x in ${fontdirs} ; do
if [[ $verbose == 1 ]] ; then
echo "font_cache: ${x}"
fi
# First, generate fonts.scale for scaleable fonts that might be there
@MKFONTSCALE@ \
-a $ENCODINGSDIR/encodings.dir \
-a $ENCODINGSDIR/large/encodings.dir \
-- ${x}
# Next, generate fonts.dir
if [[ $verbose == 1 ]] ; then
@MKFONTDIR@ \
-e $ENCODINGSDIR \
-e $ENCODINGSDIR/large \
-- ${x}
else
@MKFONTDIR@ \
-e $ENCODINGSDIR \
-e $ENCODINGSDIR/large \
-- ${x} > /dev/null
fi
done
fi
IFS=$OIFS
# Finally, update fontconfig's cache
echo "font_cache: Updating FC cache"
if [[ $system == 1 ]] ; then
@FC_CACHE@ -s \
$([[ $force == 1 ]] && echo "-f -r") \
$([[ $verbose == 1 ]] && echo "-v")
else
@FC_CACHE@ \
$([[ $force == 1 ]] && echo "-f -r") \
$([[ $verbose == 1 ]] && echo "-v")
fi
echo "font_cache: Done"
}
do_usage() {
echo "font_cache [options]"
echo " -f, --force : Force cache recreation"
echo " -n, --no-osxfonts : Just cache X11 font directories"
echo " (-n just pertains to XFont cache, not fontconfig)"
echo " -s, --system : Cache system font dirs instead of user dirs"
echo " -v, --verbose : Verbose Output"
}
cleanup() {
[[ -r "${FC_LOCKFILE}" ]] && rm -f "${FC_LOCKFILE}"
exit 1
}
while [[ $# -gt 0 ]] ; do
case $1 in
-s|--system) system=1 ;;
-f|--force) force=1 ;;
-v|--verbose) verbose=1 ;;
-n|--no-osxfonts) osxfonts=0 ;;
--help) do_usage ; exit 0 ;;
*) do_usage ; exit 1 ;;
esac
shift
done
if [[ $system == 1 ]] ; then
FC_LOCKFILE="/tmp/font_cache.$UID.lock"
elif [[ -w "${TMPDIR}" ]] ; then
FC_LOCKFILE="${TMPDIR}/font_cache.lock"
elif [[ -w "/tmp" ]] ; then
FC_LOCKFILE="/tmp/font_cache.$UID.lock"
else
FC_LOCKFILE="${HOME}/.font_cache.lock"
fi
if [[ -x /usr/bin/lockfile ]] ; then
if /usr/bin/lockfile -r 0 -l 240 -s 4 -! "${FC_LOCKFILE}" ; then
echo "font_cache is already running." >&2
echo "If you believe this to be erroneous, please remove ${FC_LOCKFILE}." >&2
exit 1
fi
else
if [[ -r "${FC_LOCKFILE}" ]] ; then
read OLD_PID < "${FC_LOCKFILE}"
if kill -0 ${OLD_PID} >& /dev/null ; then
echo "font_cache is already running with PID ${OLD_PID}." >&2
echo "If you believe this to be erroneous, please remove ${FC_LOCKFILE}." >&2
exit 1
fi
echo "Removing stale ${FC_LOCKFILE}" >&2
rm -f "${FC_LOCKFILE}"
fi
echo $$ > "${FC_LOCKFILE}"
if [[ ! -r "${FC_LOCKFILE}" ]] ; then
echo "Unable to write to ${FC_LOCKFILE}." >&2
exit 1
fi
# Now make sure we didn't collide mid-air
read OLD_PID < "${FC_LOCKFILE}"
if [[ $$ != ${OLD_PID} ]] ; then
echo "font_cache is already running with PID ${OLD_PID}." >&2
exit 1
fi
fi
trap cleanup SIGINT SIGQUIT SIGABRT SIGTERM
setup_fontdirs
rm -f "${FC_LOCKFILE}"

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.nixos.xquartz.privileged_startx</string>
<key>ProgramArguments</key>
<array>
<string>@PRIVILEGED_STARTX@</string>
<string>-d</string>
<string>@PRIVILEGED_STARTX_D@</string>
</array>
<key>MachServices</key>
<dict>
<key>org.nixos.xquartz.privileged_startx</key>
<true/>
</dict>
<key>TimeOut</key>
<integer>120</integer>
<key>EnableTransactions</key>
<true/>
</dict>
</plist>

View file

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.nixos.xquartz.startx</string>
<key>ProgramArguments</key>
<array>
<string>@LAUNCHD_STARTX@</string>
<string>@STARTX@</string>
<string>--</string>
<string>@XQUARTZ@</string>
</array>
<key>Sockets</key>
<dict>
<key>org.nixos.xquartz:0</key>
<dict>
<key>SecureSocketWithKey</key>
<string>DISPLAY</string>
</dict>
</dict>
<key>ServiceIPC</key>
<true/>
<key>EnableTransactions</key>
<true/>
</dict>
</plist>

View file

@ -0,0 +1,47 @@
require 'rexml/document'
# This script is for setting environment variables in OSX applications.
#
# This script takes two arguments:
# 1) A Nix attrset serialized via `builtins.toXML'
# 2) The path to an OSX app's Info.plist file.
def main(serialized_attrs, plist_path)
env = attrs_to_hash(serialized_attrs)
doc = REXML::Document.new(File.open(plist_path, &:read))
topmost_dict = doc.root.elements.detect { |e| e.name == "dict" }
topmost_dict.add_element("key").tap do |key|
key.text = "LSEnvironment"
end
topmost_dict.add_element(env_to_dict(env))
formatter = REXML::Formatters::Pretty.new(2)
formatter.compact = true
formatter.write(doc, File.open(plist_path, "w"))
end
# Convert a `builtins.toXML' serialized attrs to a hash.
# This assumes the values are strings.
def attrs_to_hash(serialized_attrs)
hash = {}
env_vars = REXML::Document.new(serialized_attrs)
env_vars.root.elements[1].elements.each do |attr|
name = attr.attribute("name")
value = attr.elements.first.attribute("value")
hash[name] = value
end
hash
end
def env_to_dict(env)
dict = REXML::Element.new("dict")
env.each do |k, v|
key = dict.add_element("key")
key.text = k
string = dict.add_element("string")
string.text = v
end
dict
end
main(ARGV[0], ARGV[1])

View file

@ -0,0 +1,43 @@
#!@shell@
export PATH=@PATH@:$PATH
export FONTCONFIG_FILE="@FONTCONFIG_FILE@"
# Our usage of mktemp fails with GNU, so prefer /usr/bin to hopefully
# get BSD mktemp
if [ -x /usr/bin/mktemp ] ; then
MKTEMP=/usr/bin/mktemp
else
MKTEMP=mktemp
fi
STAT=/usr/bin/stat
for dir in /tmp/.ICE-unix /tmp/.X11-unix /tmp/.font-unix ; do
success=0
for attempt in 1 2 3 4 5 ; do
check=`${STAT} -f '%#p %u %g' ${dir} 2> /dev/null`
if [ "${check}" = "041777 0 0" ] ; then
success=1
break
elif [ -n "${check}" ] ; then
saved=$(${MKTEMP} -d ${dir}-XXXXXXXX)
mv ${dir} ${saved}
echo "${dir} exists but is insecure. It has been moved into ${saved}" >&2
fi
# if $dir exists and is a symlink (ie protect against a race)
if ${MKTEMP} -d ${dir} >& /dev/null ; then
chmod 1777 $dir
chown root:wheel $dir
success=1
break
fi
done
if [ "${success}" -eq 0 ] ; then
echo "Could not successfully create ${dir}" >&2
fi
done
@FONT_CACHE@ -s &

232
pkgs/servers/x11/xquartz/startx Executable file
View file

@ -0,0 +1,232 @@
#!@shell@
# vim :set ts=4 sw=4 sts=4 et :
#
# This is just a sample implementation of a slightly less primitive
# interface than xinit. It looks for user .xinitrc and .xserverrc
# files, then system xinitrc and xserverrc files, else lets xinit choose
# its default. The system xinitrc should probably do things like check
# for .Xresources files and merge them in, start up a window manager,
# and pop a clock and several xterms.
#
# Site administrators are STRONGLY urged to write nicer versions.
#
unset DBUS_SESSION_BUS_ADDRESS
unset SESSION_MANAGER
# Bourne shell does not automatically export modified environment variables
# so export the new PATH just in case the user changes the shell
export PATH=@PATH@:$PATH
export FONTCONFIG_FILE="@FONTCONFIG_FILE@"
userclientrc=$HOME/.xinitrc
sysclientrc=@XINITRC@
userserverrc=$HOME/.xserverrc
sysserverrc=@XINITRC@
defaultclient=@DEFAULT_CLIENT@ # xterm
defaultserver=@DEFAULT_SERVER@
defaultclientargs=""
defaultserverargs=""
defaultdisplay=":0"
clientargs=""
serverargs=""
export X11_PREFS_DOMAIN=org.nixos.xquartz".X11"
# Initialize defaults (this will cut down on "safe" error messages)
if ! /usr/bin/defaults read $X11_PREFS_DOMAIN cache_fonts > /dev/null 2>&1 ; then
/usr/bin/defaults write $X11_PREFS_DOMAIN cache_fonts -bool true
fi
if ! /usr/bin/defaults read $X11_PREFS_DOMAIN no_auth > /dev/null 2>&1 ; then
/usr/bin/defaults write $X11_PREFS_DOMAIN no_auth -bool false
fi
if ! /usr/bin/defaults read $X11_PREFS_DOMAIN nolisten_tcp > /dev/null 2>&1 ; then
/usr/bin/defaults write $X11_PREFS_DOMAIN nolisten_tcp -bool true
fi
# First, start caching fonts
if [ x`/usr/bin/defaults read $X11_PREFS_DOMAIN cache_fonts` = x1 ] ; then
@FONT_CACHE@ &
fi
# a race to create /tmp/.X11-unix
@PRIVILEGED_STARTX@
if [ x`/usr/bin/defaults read $X11_PREFS_DOMAIN no_auth` = x0 ] ; then
enable_xauth=1
else
enable_xauth=0
fi
if [ x`defaults read $X11_PREFS_DOMAIN nolisten_tcp` = x1 ] ; then
defaultserverargs="$defaultserverargs -nolisten tcp"
fi
# The second check is the real one. The first is to hopefully avoid
# needless syslog spamming.
if /usr/bin/defaults read $X11_PREFS_DOMAIN 2> /dev/null | grep -q 'dpi' && /usr/bin/defaults read $X11_PREFS_DOMAIN dpi > /dev/null 2>&1 ; then
defaultserverargs="$defaultserverargs -dpi `/usr/bin/defaults read $X11_PREFS_DOMAIN dpi`"
fi
# Automatically determine an unused $DISPLAY
d=0
while true ; do
[ -e /tmp/.X$d-lock ] || break
d=$(($d + 1))
done
defaultdisplay=":$d"
unset d
whoseargs="client"
while [ x"$1" != x ]; do
case "$1" in
# '' required to prevent cpp from treating "/*" as a C comment.
/''*|\./''*)
if [ "$whoseargs" = "client" ]; then
if [ x"$client" = x ] && [ x"$clientargs" = x ]; then
client="$1"
else
clientargs="$clientargs $1"
fi
else
if [ x"$server" = x ] && [ x"$serverargs" = x ]; then
server="$1"
else
serverargs="$serverargs $1"
fi
fi
;;
--)
whoseargs="server"
;;
*)
if [ "$whoseargs" = "client" ]; then
clientargs="$clientargs $1"
else
# display must be the FIRST server argument
if [ x"$serverargs" = x ] && \
expr "$1" : ':[0-9][0-9]*$' > /dev/null 2>&1; then
display="$1"
else
serverargs="$serverargs $1"
fi
fi
;;
esac
shift
done
# process client arguments
if [ x"$client" = x ]; then
client=$defaultclient
# For compatibility reasons, only use startxrc if there were no client command line arguments
if [ x"$clientargs" = x ]; then
if [ -f "$userclientrc" ]; then
client=$userclientrc
elif [ -f "$sysclientrc" ]; then
client=$sysclientrc
fi
fi
fi
# if no client arguments, use defaults
if [ x"$clientargs" = x ]; then
clientargs=$defaultclientargs
fi
# process server arguments
if [ x"$server" = x ]; then
server=$defaultserver
# For compatibility reasons, only use xserverrc if there were no server command line arguments
if [ x"$serverargs" = x -a x"$display" = x ]; then
if [ -f "$userserverrc" ]; then
server=$userserverrc
elif [ -f "$sysserverrc" ]; then
server=$sysserverrc
fi
fi
fi
# if no server arguments, use defaults
if [ x"$serverargs" = x ]; then
serverargs=$defaultserverargs
fi
# if no display, use default
if [ x"$display" = x ]; then
display=$defaultdisplay
fi
if [ x"$enable_xauth" = x1 ] ; then
if [ x"$XAUTHORITY" = x ]; then
XAUTHORITY=$HOME/.Xauthority
export XAUTHORITY
fi
removelist=
# set up default Xauth info for this machine
hostname=`/bin/hostname`
authdisplay=${display:-:0}
mcookie=`/usr/bin/openssl rand -hex 16`
if test x"$mcookie" = x; then
echo "Couldn't create cookie"
exit 1
fi
dummy=0
# create a file with auth information for the server. ':0' is a dummy.
xserverauthfile=$HOME/.serverauth.$$
trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP KILL BUS TERM
@XAUTH@ -q -f "$xserverauthfile" << EOF
add :$dummy . $mcookie
EOF
xserverauthfilequoted=$(echo ${xserverauthfile} | sed "s/'/'\\\\''/g")
serverargs=${serverargs}" -auth '"${xserverauthfilequoted}"'"
# now add the same credentials to the client authority file
# if '$displayname' already exists do not overwrite it as another
# server man need it. Add them to the '$xserverauthfile' instead.
for displayname in $authdisplay $hostname$authdisplay; do
authcookie=`@XAUTH@ list "$displayname" \
| sed -n "s/.*$displayname[[:space:]*].*[[:space:]*]//p"` 2>/dev/null;
if [ "z${authcookie}" = "z" ] ; then
@XAUTH@ -q << EOF
add $displayname . $mcookie
EOF
removelist="$displayname $removelist"
else
dummy=$(($dummy+1));
@XAUTH@ -q -f "$xserverauthfile" << EOF
add :$dummy . $authcookie
EOF
fi
done
fi
eval @XINIT@ \"$client\" $clientargs -- \"$server\" $display $serverargs
retval=$?
if [ x"$enable_xauth" = x1 ] ; then
if [ x"$removelist" != x ]; then
@XAUTH@ remove $removelist
fi
if [ x"$xserverauthfile" != x ]; then
rm -f "$xserverauthfile"
fi
fi
exit $retval

View file

@ -0,0 +1,34 @@
{ stdenv, xorg, fontDirs }:
stdenv.mkDerivation {
name = "xquartz-system-fonts";
buildInputs = [
xorg.mkfontdir xorg.mkfontscale
];
buildCommand = ''
source $stdenv/setup
for i in ${toString fontDirs} ; do
if [ -d $i/ ]; then
list="$list $i";
fi;
done
list=$(find $list -name fonts.dir -o -name '*.ttf' -o -name '*.otf');
fontDirs=''';
for i in $list ; do
fontDirs="$fontDirs $(dirname $i)";
done;
mkdir -p $out/share/X11-fonts/;
find $fontDirs -type f -o -type l | while read i; do
j="''${i##*/}"
if ! test -e "$out/share/X11-fonts/''${j}"; then
ln -s "$i" "$out/share/X11-fonts/''${j}";
fi;
done;
cd $out/share/X11-fonts/
rm -f fonts.dir fonts.scale fonts.alias
mkfontdir
mkfontscale
cat $( find ${xorg.fontalias}/ -name fonts.alias) >fonts.alias
'';
}

View file

@ -0,0 +1,40 @@
#!@shell@
export PATH=@PATH@:$PATH
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
# Fix ridiculously slow key repeat.
@XSET@ r rate
# merge in defaults and keymaps
if [ -f "$userresources" ]; then
if [ -x /usr/bin/cpp ] ; then
@XRDB@ -merge "$userresources"
else
@XRDB@ -nocpp -merge "$userresources"
fi
fi
if [ -f "$usermodmap" ]; then
@XMODMAP@ "$usermodmap"
fi
fontpath="@SYSTEM_FONTS@"
[ -e "$HOME"/.fonts/fonts.dir ] && fontpath="$fontpath,$HOME/.fonts"
[ -e "$HOME"/Library/Fonts/fonts.dir ] && fontpath="$fontpath,$HOME/Library/Fonts"
[ -e /Library/Fonts/fonts.dir ] && fontpath="$fontpath,/Library/Fonts"
[ -e /System/Library/Fonts/fonts.dir ] && fontpath="$fontpath,/System/Library/Fonts"
@XSET@ fp= "$fontpath"
unset fontpath
if [ -d "${HOME}/.xinitrc.d" ] ; then
for f in "${HOME}"/.xinitrc.d/*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
exec @QUARTZ_WM@