Merge pull request #221617 from fufexan/hyprland

hyprwm: update and init packages
This commit is contained in:
Jörg Thalheim 2023-03-17 18:52:24 +00:00 committed by GitHub
commit 10a4343d71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 460 additions and 62 deletions

View File

@ -0,0 +1,30 @@
{ lib
, stdenv
, fetchFromGitHub
, meson
, ninja
}:
stdenv.mkDerivation rec {
pname = "hyprland-protocols";
version = "unstable-2023-01-13";
src = fetchFromGitHub {
owner = "hyprwm";
repo = pname;
rev = "eb7dcc0132ad25addc3e8d434c4bfae6bd3a8c90";
hash = "sha256-gkLgUg9/fP04bKCJMj/rN0r6PV/cbLShDvKQyFvVap0=";
};
nativeBuildInputs = [
meson
ninja
];
meta = {
homepage = "https://github.com/hyprwm/hyprland-protocols";
description = "Wayland protocol extensions for Hyprland";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ fufexan ];
platforms = lib.platforms.linux;
};
}

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/nvidia.patch?h=hyprland-nvidia-git&id=757614af7729352fda534abe9eb1a88fe77dfe04";
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

@ -0,0 +1,95 @@
{ lib
, stdenv
, fetchFromGitHub
, pkg-config
, cmake
, ninja
, cairo
, fribidi
, libdatrie
, libjpeg
, libselinux
, libsepol
, libthai
, pango
, pcre
, utillinux
, wayland
, wayland-protocols
, wayland-scanner
, wlroots
, libXdmcp
, debug ? false
}:
stdenv.mkDerivation {
pname = "hyprpicker" + lib.optionalString debug "-debug";
version = "unstable-2023-03-09";
src = fetchFromGitHub {
owner = "hyprwm";
repo = "hyprpicker";
rev = "234c2da51a71941c0cd2ee380f42de365f90dd6f";
hash = "sha256-wb1oXsaM0AkThPJGjn0Ytxt8vbBQG+mg2AGY0uxhUJ0=";
};
cmakeFlags = lib.optional debug "-DCMAKE_BUILD_TYPE=Debug";
nativeBuildInputs = [
cmake
ninja
pkg-config
];
buildInputs = [
cairo
fribidi
libdatrie
libjpeg
libselinux
libsepol
libthai
pango
pcre
wayland
wayland-protocols
wayland-scanner
wlroots
libXdmcp
utillinux
];
configurePhase = ''
runHook preConfigure
make protocols
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
make release
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/{bin,share/licenses}
install -Dm755 build/hyprpicker -t $out/bin
install -Dm644 LICENSE -t $out/share/licenses/hyprpicker
runHook postInstall
'';
meta = with lib; {
description = "A wlroots-compatible Wayland color picker that does not suck";
homepage = "https://github.com/hyprwm/hyprpicker";
license = licenses.bsd3;
maintainers = with maintainers; [ fufexan ];
platforms = wayland.meta.platforms;
};
}

View File

@ -0,0 +1,53 @@
{ lib
, stdenv
, fetchFromGitHub
, makeWrapper
, meson
, ninja
, pkg-config
, hyprland-protocols
, hyprland-share-picker
, inih
, libdrm
, mesa
, pipewire
, systemd
, wayland
, wayland-protocols
, wayland-scanner
}:
let
source = import ./source.nix { inherit lib fetchFromGitHub wayland; };
in
stdenv.mkDerivation {
pname = "xdg-desktop-portal-hyprland";
inherit (source) src version meta;
strictDeps = true;
depsBuildBuild = [ pkg-config ];
nativeBuildInputs = [
makeWrapper
meson
ninja
pkg-config
wayland-scanner
];
buildInputs = [
hyprland-protocols
inih
libdrm
mesa
pipewire
systemd
wayland
wayland-protocols
];
mesonFlags = [
"-Dsd-bus-provider=libsystemd"
];
postInstall = ''
wrapProgram $out/libexec/xdg-desktop-portal-hyprland --prefix PATH ":" ${lib.makeBinPath [hyprland-share-picker]}
'';
}

View File

@ -0,0 +1,36 @@
{ stdenv
, lib
, fetchFromGitHub
, cmake
, qtbase
, makeShellWrapper
, wrapQtAppsHook
, hyprland
, grim
, slurp
, wayland
}:
let
source = import ./source.nix { inherit lib fetchFromGitHub wayland; };
in
stdenv.mkDerivation {
pname = "hyprland-share-picker";
inherit (source) version;
src = "${source.src}/hyprland-share-picker";
nativeBuildInputs = [ cmake wrapQtAppsHook makeShellWrapper ];
buildInputs = [ qtbase ];
dontWrapQtApps = true;
postInstall = ''
wrapProgramShell $out/bin/hyprland-share-picker \
"''${qtWrapperArgs[@]}" \
--prefix PATH ":" ${lib.makeBinPath [grim slurp hyprland]}
'';
meta = source.meta // {
description = "Helper program for xdg-desktp-portal-hyprland";
};
}

View File

@ -0,0 +1,22 @@
{ lib
, fetchFromGitHub
, wayland
}:
{
version = "unstable-2023-03-16";
src = fetchFromGitHub {
owner = "hyprwm";
repo = "xdg-desktop-portal-hyprland";
rev = "85f49f4d6c9c398428117e9bdb588f53f09e52e0";
hash = "sha256-qed+BV0NBt1egGCBEM7d5MiZJevQb8jd1WybfFM53Ak=";
};
meta = with lib; {
description = "xdg-desktop-portal backend for Hyprland";
homepage = "https://github.com/hyprwm/xdg-desktop-portal-hyprland";
license = licenses.mit;
maintainers = with maintainers; [ fufexan ];
platforms = wayland.meta.platforms;
};
}

View File

@ -5000,12 +5000,23 @@ with pkgs;
hunt = callPackage ../tools/misc/hunt { };
hypr = callPackage ../applications/window-managers/hyprwm/hypr {
cairo = cairo.override { xcbSupport = true; };
cairo = cairo.override { xcbSupport = true; }; };
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 = callPackage ../applications/window-managers/hyprwm/hyprland { };
hyprland-protocols = callPackage ../applications/window-managers/hyprwm/hyprland-protocols { };
hyprpaper = callPackage ../applications/window-managers/hyprwm/hyprpaper { };
hyprland-share-picker = libsForQt5.callPackage ../applications/window-managers/hyprwm/xdg-desktop-portal-hyprland/hyprland-share-picker.nix { };
hyprpaper = callPackage ../applications/window-managers/hyprwm/hyprpaper {
stdenv = gcc12Stdenv;
};
hyprpicker = callPackage ../applications/window-managers/hyprwm/hyprpicker { };
hysteria = callPackage ../tools/networking/hysteria { };
@ -34539,6 +34550,8 @@ with pkgs;
xdg-desktop-portal-gtk = callPackage ../development/libraries/xdg-desktop-portal-gtk { };
xdg-desktop-portal-hyprland = callPackage ../applications/window-managers/hyprwm/xdg-desktop-portal-hyprland { };
xdg-desktop-portal-wlr = callPackage ../development/libraries/xdg-desktop-portal-wlr { };
xdg-user-dirs = callPackage ../tools/X11/xdg-user-dirs { };