hyprland: 0.6.1 -> 0.23.0beta

This commit is contained in:
Mihai Fufezan 2023-03-17 09:28:53 +02:00
parent 775e143cd4
commit e7defd2516
No known key found for this signature in database
GPG Key ID: 5899325F2F120900
4 changed files with 213 additions and 60 deletions

View File

@ -1,94 +1,115 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchFromGitLab
, cmake
, pkg-config
, meson
, ninja
, cairo
, git
, hyprland-protocols
, jq
, libdrm
, libinput
, libxcb
, libxkbcommon
, mesa
, pango
, pkg-config
, pciutils
, systemd
, udis86
, wayland
, wayland-protocols
, wayland-scanner
, wlroots
, xcbutilwm
, xwayland
, debug ? false
, enableXWayland ? true
, hidpiXWayland ? false
, legacyRenderer ? false
, nvidiaPatches ? false
, withSystemd ? true
}:
stdenv.mkDerivation (finalAttrs: {
pname = "hyprland";
version = "0.6.1beta";
let
assertXWayland = lib.assertMsg (hidpiXWayland -> enableXWayland) ''
Hyprland: cannot have hidpiXWayland when enableXWayland is false.
'';
in
assert assertXWayland;
stdenv.mkDerivation rec {
pname = "hyprland" + lib.optionalString debug "-debug";
version = "0.23.0beta";
src = fetchFromGitHub {
owner = "hyprwm";
repo = "Hyprland";
rev = "v${finalAttrs.version}";
hash = "sha256-0Msqe2ErAJvnO1zHoB2k6TkDhTYnHRGkvJrfSG12dTU=";
repo = "hyprland";
rev = "v${version}";
hash = "sha256-aPSmhgof4nIJquHmtxxirIMVv439wTYYCwf1ekS96gA=";
};
patches = [
# make meson use the provided dependencies instead of the git submodules
"${src}/nix/meson-build.patch"
];
postPatch = ''
# Fix hardcoded paths to /usr installation
sed -i "s#/usr#$out#" src/render/OpenGL.cpp
substituteInPlace meson.build \
--replace "@GIT_COMMIT_HASH@" '${version}' \
--replace "@GIT_DIRTY@" ""
'';
nativeBuildInputs = [
cmake
jq
meson
ninja
pkg-config
wayland-scanner
];
buildInputs = [
libdrm
libinput
libxcb
libxkbcommon
mesa
pango
wayland
wayland-protocols
xcbutilwm
]
++ [
# INFO: When updating src, remember to synchronize this wlroots with the
# exact commit used by upstream
(wlroots.overrideAttrs (_: {
version = "unstable-2022-06-07";
src = fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "wlroots";
repo = "wlroots";
rev = "b89ed9015c3fbe8d339e9d65cf70fdca6e5645bc";
hash = "sha256-8y3u8CoigjoZOVbA2wCWBHlDNEakv0AVxU46/cOC00s=";
};
}))
outputs = [
"out"
"man"
];
# build with system wlroots
postPatch = ''
sed -Ei 's|"\.\./wlroots/include/([a-zA-Z0-9./_-]+)"|<\1>|g' src/includes.hpp
'';
buildInputs =
[
cairo
git
hyprland-protocols
libdrm
libinput
libxkbcommon
mesa
udis86
wayland
wayland-protocols
wayland-scanner
pciutils
(wlroots.override { inherit enableXWayland hidpiXWayland nvidiaPatches; })
]
++ lib.optionals enableXWayland [ libxcb xcbutilwm xwayland ]
++ lib.optionals withSystemd [ systemd ];
preConfigure = ''
make protocols
'';
mesonBuildType =
if debug
then "debug"
else "release";
postBuild = ''
pushd ../hyprctl
${stdenv.cc.targetPrefix}c++ -std=c++20 -w ./main.cpp -o ./hyprctl
popd
'';
mesonFlags = builtins.concatLists [
(lib.optional (!enableXWayland) "-Dxwayland=disabled")
(lib.optional legacyRenderer "-DLEGACY_RENDERER:STRING=true")
(lib.optional withSystemd "-Dsystemd=enabled")
];
installPhase = ''
runHook preInstall
install -Dm755 ../hyprctl/hyprctl ./Hyprland -t $out/bin
runHook postInstall
'';
passthru.providedSessions = [ "hyprland" ];
meta = with lib; {
inherit (finalAttrs.src.meta) homepage;
homepage = "https://github.com/vaxerski/Hyprland";
description = "A dynamic tiling Wayland compositor that doesn't sacrifice on its looks";
license = licenses.bsd3;
maintainers = with maintainers; [ wozeparrot ];
inherit (wayland.meta) platforms;
maintainers = with maintainers; [ wozeparrot fufexan ];
mainProgram = "Hyprland";
platforms = wlroots.meta.platforms;
};
})
}

View File

@ -0,0 +1,15 @@
{ udis86
, fetchFromGitHub
}:
udis86.overrideAttrs (old: {
version = "unstable-2022-10-13";
src = fetchFromGitHub {
owner = "canihavesomecoffee";
repo = "udis86";
rev = "5336633af70f3917760a6d441ff02d93477b0c86";
hash = "sha256-HifdUQPGsKQKQprByeIznvRLONdOXeolOsU5nkwIv3g=";
};
patches = [ ];
})

View File

@ -0,0 +1,113 @@
{ fetchFromGitLab
, hyprland
, wlroots
, xwayland
, fetchpatch
, lib
, libdisplay-info
, libliftoff
, hwdata
, hidpiXWayland ? true
, enableXWayland ? true
, nvidiaPatches ? false
}:
let
libdisplay-info-new = libdisplay-info.overrideAttrs (old: {
version = "0.1.1+date=2023-03-02";
src = fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "emersion";
repo = old.pname;
rev = "147d6611a64a6ab04611b923e30efacaca6fc678";
sha256 = "sha256-/q79o13Zvu7x02SBGu0W5yQznQ+p7ltZ9L6cMW5t/o4=";
};
});
libliftoff-new = libliftoff.overrideAttrs (old: {
version = "0.5.0-dev";
src = fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "emersion";
repo = old.pname;
rev = "d98ae243280074b0ba44bff92215ae8d785658c0";
sha256 = "sha256-DjwlS8rXE7srs7A8+tHqXyUsFGtucYSeq6X0T/pVOc8=";
};
NIX_CFLAGS_COMPILE = toString [
"-Wno-error=sign-conversion"
];
});
in
assert (lib.assertMsg (hidpiXWayland -> enableXWayland) ''
wlroots-hyprland: cannot have hidpiXWayland when enableXWayland is false.
'');
(wlroots.overrideAttrs
(old: {
version = "0.17.0-dev";
src = fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "wlroots";
repo = "wlroots";
rev = "5ae17de23f5fd9bb252a698f3771c840280e2c05";
hash = "sha256-dWrk+Q3bLdtFe5rkyaAKWCQJCeE/KFNllcu1DvBC38c=";
};
pname =
old.pname
+ "-hyprland"
+ (
if hidpiXWayland
then "-hidpi"
else ""
)
+ (
if nvidiaPatches
then "-nvidia"
else ""
);
patches =
(old.patches or [ ])
++ (lib.optionals (enableXWayland && hidpiXWayland) [
"${hyprland.src}/nix/wlroots-hidpi.patch"
(fetchpatch {
url = "https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/18595000f3a21502fd60bf213122859cc348f9af.diff";
sha256 = "sha256-jvfkAMh3gzkfuoRhB4E9T5X1Hu62wgUjj4tZkJm0mrI=";
revert = true;
})
])
++ (lib.optionals nvidiaPatches [
(fetchpatch {
url = "https://aur.archlinux.org/cgit/aur.git/plain/0001-nvidia-format-workaround.patch?h=hyprland-nvidia-screenshare-git";
sha256 = "A9f1p5EW++mGCaNq8w7ZJfeWmvTfUm4iO+1KDcnqYX8=";
})
]);
postPatch =
(old.postPatch or "")
+ (
if nvidiaPatches
then ''
substituteInPlace render/gles2/renderer.c --replace "glFlush();" "glFinish();"
''
else ""
);
buildInputs =
old.buildInputs
++ [
hwdata
libdisplay-info-new
libliftoff-new
];
})).override {
xwayland = xwayland.overrideAttrs (old: {
patches =
(old.patches or [ ])
++ (lib.optionals hidpiXWayland [
"${hyprland.src}/nix/xwayland-vsync.patch"
"${hyprland.src}/nix/xwayland-hidpi.patch"
]);
});
}

View File

@ -5002,7 +5002,11 @@ with pkgs;
hypr = callPackage ../applications/window-managers/hyprwm/hypr {
cairo = cairo.override { xcbSupport = true; }; };
hyprland = callPackage ../applications/window-managers/hyprwm/hyprland { };
hyprland = callPackage ../applications/window-managers/hyprwm/hyprland {
stdenv = gcc12Stdenv;
wlroots = pkgs.callPackage ../applications/window-managers/hyprwm/hyprland/wlroots.nix { };
udis86 = pkgs.callPackage ../applications/window-managers/hyprwm/hyprland/udis86.nix { };
};
hyprland-protocols = callPackage ../applications/window-managers/hyprwm/hyprland-protocols { };