xinit: refactor & move to pkgs/by-name from xorg namespace

relevant changes:
- switch to GitLab source instead of release tarball
- remove the outdated postPatch subtituteInPlace
  - I would have needed to go into postConfigure when using GitLab
    source, however swapping --replace with --replace-fail made it fail.
- change the postFixup sed command to a somewhat equivalent substituteInPlace
- remove the stdenv = clangStdenv override for darwin since stdenv is
  using clang on darwin anyway
This commit is contained in:
quantenzitrone
2026-01-10 02:27:03 +01:00
parent 66f52e7842
commit 5a95ffa9f1
5 changed files with 89 additions and 73 deletions
+85
View File
@@ -0,0 +1,85 @@
{
lib,
stdenv,
fetchFromGitLab,
buildPackages,
autoreconfHook,
pkg-config,
util-macros,
darwin,
libx11,
xorgproto,
xauth,
xorg-server,
nix-update-script,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "xinit";
version = "1.4.4";
src = fetchFromGitLab {
domain = "gitlab.freedesktop.org";
group = "xorg";
owner = "app";
repo = "xinit";
tag = "xinit-${finalAttrs.version}";
hash = "sha256-1GL0xJ/l9BnhoUyD5m1Ch86hjcRdBnys366qM4Lj84U=";
};
strictDeps = true;
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [
autoreconfHook
pkg-config
util-macros
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.bootstrap_cmds
];
buildInputs = [
libx11
xorgproto
];
propagatedBuildInputs = [
xauth
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
libx11
xorgproto
];
configureFlags = [
"--with-xserver=${xorg-server.out}/bin/X"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
"--with-bundle-id-prefix=org.nixos.xquartz"
"--with-launchdaemons-dir=${placeholder "out"}/LaunchDaemons"
"--with-launchagents-dir=${placeholder "out"}/LaunchAgents"
];
postFixup = ''
substituteInPlace $out/bin/startx \
--replace-fail '"''${prefix}/etc/X11/xinit/xinitrc"' '/etc/X11/xinit/xinitrc' \
--replace-fail '"$xinitdir/xserverrc"' '/etc/X11/xinit/xserverrc'
'';
passthru = {
updateScript = nix-update-script { extraArgs = [ "--version-regex=xinit-(.*)" ]; };
};
meta = {
description = "X server & client startup utilities (includes startx)";
homepage = "https://gitlab.freedesktop.org/xorg/app/xinit";
license = with lib.licenses; [
mitOpenGroup
x11
];
mainProgram = "xinit";
maintainers = [ ];
platforms = lib.platforms.unix;
};
})
+2 -36
View File
@@ -134,6 +134,7 @@
xgamma,
xgc,
xhost,
xinit,
xkbevd,
xkbprint,
xkbutils,
@@ -221,6 +222,7 @@ self: with self; {
xgamma
xgc
xhost
xinit
xkbevd
xkbprint
xkbutils
@@ -2124,42 +2126,6 @@ self: with self; {
})
) { };
# THIS IS A GENERATED FILE. DO NOT EDIT!
xinit = callPackage (
{
stdenv,
pkg-config,
fetchurl,
libX11,
xorgproto,
testers,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "xinit";
version = "1.4.4";
builder = ./builder.sh;
src = fetchurl {
url = "mirror://xorg/individual/app/xinit-1.4.4.tar.xz";
sha256 = "1ygymifhg500sx1ybk8x4d1zn4g4ywvlnyvqwcf9hzsc2rx7r920";
};
hardeningDisable = [
"bindnow"
"relro"
];
strictDeps = true;
nativeBuildInputs = [ pkg-config ];
buildInputs = [
libX11
xorgproto
];
passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
meta = {
pkgConfigModules = [ ];
platforms = lib.platforms.unix;
};
})
) { };
# THIS IS A GENERATED FILE. DO NOT EDIT!
xinput = callPackage (
{
@@ -466,6 +466,7 @@ print OUT <<EOF;
xgamma,
xgc,
xhost,
xinit,
xkbevd,
xkbprint,
xkbutils,
@@ -553,6 +554,7 @@ self: with self; {
xgamma
xgc
xhost
xinit
xkbevd
xkbprint
xkbutils
-36
View File
@@ -338,42 +338,6 @@ self: super:
postPatch = lib.concatStrings (lib.mapAttrsToList patchIn layouts);
});
xinit =
(super.xinit.override {
stdenv = if isDarwin then clangStdenv else stdenv;
}).overrideAttrs
(attrs: {
nativeBuildInputs = attrs.nativeBuildInputs ++ lib.optional isDarwin bootstrap_cmds;
depsBuildBuild = [ buildPackages.stdenv.cc ];
configureFlags = [
"--with-xserver=${xorg.xorgserver.out}/bin/X"
]
++ lib.optionals isDarwin [
"--with-bundle-id-prefix=org.nixos.xquartz"
"--with-launchdaemons-dir=\${out}/LaunchDaemons"
"--with-launchagents-dir=\${out}/LaunchAgents"
];
postPatch = ''
# Avoid replacement of word-looking cpp's builtin macros in Nix's cross-compiled paths
substituteInPlace Makefile.in --replace "PROGCPPDEFS =" "PROGCPPDEFS = -Dlinux=linux -Dunix=unix"
'';
propagatedBuildInputs =
attrs.propagatedBuildInputs or [ ]
++ [ xorg.xauth ]
++ lib.optionals isDarwin [
xorg.libX11
xorg.xorgproto
];
postFixup = ''
sed -i $out/bin/startx \
-e '/^sysserverrc=/ s:=.*:=/etc/X11/xinit/xserverrc:' \
-e '/^sysclientrc=/ s:=.*:=/etc/X11/xinit/xinitrc:'
'';
meta = attrs.meta // {
mainProgram = "xinit";
};
});
xf86videointel = super.xf86videointel.overrideAttrs (attrs: {
# the update script only works with released tarballs :-/
name = "xf86-video-intel-2024-05-06";
-1
View File
@@ -1,4 +1,3 @@
mirror://xorg/individual/app/xinit-1.4.4.tar.xz
mirror://xorg/individual/app/xinput-1.6.4.tar.xz
mirror://xorg/individual/app/xkbcomp-1.5.0.tar.xz
mirror://xorg/individual/app/xtrap-1.0.3.tar.bz2