Skip to content

Commit

Permalink
hyprland: 0.43.0 -> 0.44.0
Browse files Browse the repository at this point in the history
- Use meson instead of CMake (follow upstream)
- Keep using submodules in order to support enabling tracy, should the
need arise
- Use `inherit (lib) x` instead of lib.x
- Remove unneeded dependencies
  • Loading branch information
fufexan committed Oct 6, 2024
1 parent 3a6510d commit 4d2591d
Showing 1 changed file with 63 additions and 34 deletions.
97 changes: 63 additions & 34 deletions pkgs/by-name/hy/hyprland/package.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
lib,
stdenv,
stdenvAdapters,
fetchFromGitHub,
pkg-config,
makeWrapper,
cmake,
meson,
ninja,
aquamarine,
binutils,
Expand All @@ -15,7 +17,6 @@
hyprlang,
hyprutils,
hyprwayland-scanner,
jq,
libGL,
libdrm,
libexecinfo,
Expand Down Expand Up @@ -45,30 +46,50 @@
enableNvidiaPatches ? false,
}:
let
info = builtins.fromJSON (builtins.readFile ./info.json);
inherit (builtins)
foldl'
fromJSON
readFile
;
inherit (lib.asserts) assertMsg;
inherit (lib.attrsets) mapAttrsToList;
inherit (lib.lists)
flatten
concatLists
optionals
;
inherit (lib.strings)
makeBinPath
optionalString
mesonBool
mesonEnable
;

info = fromJSON (readFile ./info.json);

adapters = flatten [
stdenvAdapters.useMoldLinker
];

customStdenv = foldl' (acc: adapter: adapter acc) stdenv adapters;
in
assert lib.assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been removed.";
assert lib.assertMsg (!enableNvidiaPatches) "The option `enableNvidiaPatches` has been removed.";
assert lib.assertMsg (!hidpiXWayland)
assert assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been removed.";
assert assertMsg (!enableNvidiaPatches) "The option `enableNvidiaPatches` has been removed.";
assert assertMsg (!hidpiXWayland)
"The option `hidpiXWayland` has been removed. Please refer https://wiki.hyprland.org/Configuring/XWayland";

stdenv.mkDerivation (finalAttrs: {
pname = "hyprland" + lib.optionalString debug "-debug";
version = "0.43.0";
customStdenv.mkDerivation (finalAttrs: {
pname = "hyprland" + optionalString debug "-debug";
version = "0.44.0";

src = fetchFromGitHub {
owner = "hyprwm";
repo = "hyprland";
fetchSubmodules = true;
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-+wE97utoDfhQP6AMdZHUmBeL8grbce/Jv2i5M+6AbaE=";
hash = "sha256-XgDhPx+tKs+2lyWM/ZqIHnMArd/c0LGmwAwu0EG1uJM=";
};

patches = [
# forces GCC to use -std=c++26 on CMake < 3.30
"${finalAttrs.src}/nix/stdcxx.patch"
];

postPatch = ''
# Fix hardcoded paths to /usr installation
sed -i "s#/usr#$out#" src/render/OpenGL.cpp
Expand All @@ -93,13 +114,12 @@ stdenv.mkDerivation (finalAttrs: {

nativeBuildInputs = [
hyprwayland-scanner
jq
makeWrapper
cmake
meson
ninja
cmake
pkg-config
python3 # for udis86
wayland-scanner
];

outputs = [
Expand All @@ -108,7 +128,7 @@ stdenv.mkDerivation (finalAttrs: {
"dev"
];

buildInputs =
buildInputs = concatLists [
[
aquamarine
cairo
Expand All @@ -127,34 +147,42 @@ stdenv.mkDerivation (finalAttrs: {
tomlplusplus
wayland
wayland-protocols
wayland-scanner
xorg.libXcursor
]
++ lib.optionals stdenv.hostPlatform.isBSD [ epoll-shim ]
++ lib.optionals stdenv.hostPlatform.isMusl [ libexecinfo ]
++ lib.optionals enableXWayland [
(optionals customStdenv.hostPlatform.isBSD [ epoll-shim ])
(optionals customStdenv.hostPlatform.isMusl [ libexecinfo ])
(optionals enableXWayland [
xorg.libxcb
xorg.libXdmcp
xorg.xcbutilerrors
xorg.xcbutilwm
xwayland
]
++ lib.optionals withSystemd [ systemd ];

cmakeBuildType = if debug then "Debug" else "RelWithDebInfo";
])
(optionals withSystemd [ systemd ])
];
mesonBuildType = if debug then "debugoptimized" else "release";

# we want as much debug info as possible
dontStrip = debug;

cmakeFlags = [
(lib.cmakeBool "NO_XWAYLAND" (!enableXWayland))
(lib.cmakeBool "LEGACY_RENDERER" legacyRenderer)
(lib.cmakeBool "NO_SYSTEMD" (!withSystemd))
mesonFlags = flatten [
(mapAttrsToList mesonEnable {
"xwayland" = enableXWayland;
"legacy_renderer" = legacyRenderer;
"systemd" = withSystemd;
})
(mapAttrsToList mesonBool {
"b_pch" = false;
"tracy_enable" = false;
})
];

postInstall = ''
${lib.optionalString wrapRuntimeDeps ''
${optionalString wrapRuntimeDeps ''
wrapProgram $out/bin/Hyprland \
--suffix PATH : ${
lib.makeBinPath [
makeBinPath [
binutils
pciutils
pkgconf
Expand All @@ -163,9 +191,10 @@ stdenv.mkDerivation (finalAttrs: {
''}
'';

passthru.providedSessions = [ "hyprland" ];

passthru.updateScript = ./update.sh;
passthru = {
providedSessions = [ "hyprland" ];
updateScript = ./update.sh;
};

meta = {
homepage = "https://github.com/hyprwm/Hyprland";
Expand Down

0 comments on commit 4d2591d

Please sign in to comment.