maybe do import?
Some checks failed
Build Hyprland / Build Hyprland (Arch) (push) Has been cancelled
Build Hyprland / Code Style (push) Has been cancelled
Nix / update-inputs (push) Has been cancelled
Nix / hyprland (push) Has been cancelled
Nix / test (push) Has been cancelled
Security Checks / Flawfinder Checks (push) Has been cancelled
Nix / xdph (push) Has been cancelled

This commit is contained in:
do butterflies cry? 2026-03-07 15:45:46 +10:00
parent bcab43b181
commit b41882c169
Signed by: cry
GPG key ID: F68745A836CA0412

View file

@ -62,18 +62,19 @@
hidpiXWayland ? false, hidpiXWayland ? false,
legacyRenderer ? false, legacyRenderer ? false,
withHyprtester ? false, withHyprtester ? false,
}: }: let
let
inherit (builtins) foldl' readFile; inherit (builtins) foldl' readFile;
inherit (lib.asserts) assertMsg; inherit (lib.asserts) assertMsg;
inherit (lib.attrsets) mapAttrsToList; inherit (lib.attrsets) mapAttrsToList;
inherit (lib.lists) inherit
(lib.lists)
flatten flatten
concatLists concatLists
optional optional
optionals optionals
; ;
inherit (lib.strings) inherit
(lib.strings)
makeBinPath makeBinPath
optionalString optionalString
cmakeBool cmakeBool
@ -88,184 +89,186 @@ let
customStdenv = foldl' (acc: adapter: adapter acc) stdenv adapters; customStdenv = foldl' (acc: adapter: adapter acc) stdenv adapters;
in in
assert assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been removed."; assert assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been removed.";
assert assertMsg (!enableNvidiaPatches) "The option `enableNvidiaPatches` has been removed."; assert assertMsg (!enableNvidiaPatches) "The option `enableNvidiaPatches` has been removed.";
assert assertMsg (!hidpiXWayland) assert assertMsg (!hidpiXWayland)
"The option `hidpiXWayland` has been removed. Please refer https://wiki.hypr.land/Configuring/XWayland"; "The option `hidpiXWayland` has been removed. Please refer https://wiki.hypr.land/Configuring/XWayland";
assert assertMsg ( assert assertMsg (!legacyRenderer) "The option `legacyRenderer` has been removed. Legacy renderer is no longer supported.";
!legacyRenderer assert assertMsg (!withHyprtester) "The option `withHyprtester` has been removed. Hyprtester is always built now.";
) "The option `legacyRenderer` has been removed. Legacy renderer is no longer supported."; customStdenv.mkDerivation (finalAttrs: {
assert assertMsg ( pname = "hyprland${optionalString debug "-debug"}";
!withHyprtester inherit version withTests;
) "The option `withHyprtester` has been removed. Hyprtester is always built now.";
customStdenv.mkDerivation (finalAttrs: {
pname = "hyprland${optionalString debug "-debug"}";
inherit version withTests;
src = fs.toSource { src = fs.toSource {
root = ../.; root = ../.;
fileset = fileset =
fs.intersection fs.intersection
# allows non-flake builds to only include files tracked by git # allows non-flake builds to only include files tracked by git
(fs.gitTracked ../.) (fs.gitTracked ../.)
( (
fs.unions (flatten [ fs.unions (flatten [
../assets/hyprland-portals.conf ../assets/hyprland-portals.conf
../assets/install ../assets/install
../hyprctl ../hyprctl
../hyprland.pc.in ../hyprland.pc.in
# ../hyprpm ../hyprpm
../LICENSE ../LICENSE
../protocols ../protocols
../src ../src
../start ../start
../systemd ../systemd
../VERSION ../VERSION
(fs.fileFilter (file: file.hasExt "1") ../docs) (fs.fileFilter (file: file.hasExt "1") ../docs)
(fs.fileFilter (file: file.hasExt "conf" || file.hasExt "in") ../example) (fs.fileFilter (file: file.hasExt "conf" || file.hasExt "in") ../example)
(fs.fileFilter (file: file.hasExt "sh") ../scripts) (fs.fileFilter (file: file.hasExt "sh") ../scripts)
(fs.fileFilter (file: file.name == "CMakeLists.txt") ../.) (fs.fileFilter (file: file.name == "CMakeLists.txt") ../.)
(optional withTests [ (optional withTests [
../tests ../tests
../hyprtester ../hyprtester
])
]) ])
]) );
); };
};
postPatch = '' postPatch = ''
# Fix hardcoded paths to /usr installation # Fix hardcoded paths to /usr installation
sed -i "s#/usr#$out#" src/render/OpenGL.cpp sed -i "s#/usr#$out#" src/render/OpenGL.cpp
# Remove extra @PREFIX@ to fix some paths # Remove extra @PREFIX@ to fix some paths
sed -i "s#@PREFIX@/##g" hyprland.pc.in sed -i "s#@PREFIX@/##g" hyprland.pc.in
sed -i "s#@PREFIX@/##g" example/hyprland.desktop.in sed -i "s#@PREFIX@/##g" example/hyprland.desktop.in
''; '';
env = { env = {
GIT_COMMITS = revCount; GIT_COMMITS = revCount;
GIT_COMMIT_DATE = date; GIT_COMMIT_DATE = date;
GIT_COMMIT_HASH = commit; GIT_COMMIT_HASH = commit;
GIT_DIRTY = if (commit == "") then "clean" else "dirty"; GIT_DIRTY =
GIT_TAG = "v${trim (readFile "${finalAttrs.src}/VERSION")}"; if (commit == "")
}; then "clean"
else "dirty";
GIT_TAG = "v${trim (readFile "${finalAttrs.src}/VERSION")}";
};
depsBuildBuild = [ depsBuildBuild = [
pkg-config pkg-config
]; ];
nativeBuildInputs = [ nativeBuildInputs = [
hyprwayland-scanner hyprwayland-scanner
hyprwire hyprwire
makeWrapper makeWrapper
cmake cmake
pkg-config pkg-config
]; ];
outputs = [ outputs = [
"out" "out"
"man" "man"
"dev" "dev"
]; ];
buildInputs = concatLists [ buildInputs = concatLists [
[ [
aquamarine aquamarine
cairo cairo
git git
glaze-hyprland glaze-hyprland
glslang glslang
gtest gtest
hyprcursor hyprcursor
hyprgraphics hyprgraphics
hyprland-protocols hyprland-protocols
hyprlang hyprlang
hyprutils hyprutils
hyprwire hyprwire
lcms2 lcms2
libdrm libdrm
libgbm libgbm
libGL libGL
libinput libinput
libuuid libuuid
libxcursor libxcursor
libxkbcommon libxkbcommon
muparser muparser
pango pango
pciutils pciutils
re2 re2
tomlplusplus tomlplusplus
udis86-hyprland udis86-hyprland
wayland wayland
wayland-protocols wayland-protocols
wayland-scanner wayland-scanner
] ]
(optionals customStdenv.hostPlatform.isBSD [ epoll-shim ]) (optionals customStdenv.hostPlatform.isBSD [epoll-shim])
(optionals customStdenv.hostPlatform.isMusl [ libexecinfo ]) (optionals customStdenv.hostPlatform.isMusl [libexecinfo])
(optionals enableXWayland [ (optionals enableXWayland [
libxcb libxcb
libxcb-errors libxcb-errors
libxcb-render-util libxcb-render-util
libxcb-wm libxcb-wm
libxdmcp libxdmcp
xwayland xwayland
]) ])
(optional withSystemd systemd) (optional withSystemd systemd)
]; ];
strictDeps = true; strictDeps = true;
cmakeBuildType = if debug then "Debug" else "RelWithDebInfo"; cmakeBuildType =
if debug
then "Debug"
else "RelWithDebInfo";
# we want as much debug info as possible # we want as much debug info as possible
dontStrip = debug; dontStrip = debug;
cmakeFlags = mapAttrsToList cmakeBool { cmakeFlags = mapAttrsToList cmakeBool {
"BUILT_WITH_NIX" = true; "BUILT_WITH_NIX" = true;
"NO_XWAYLAND" = !enableXWayland; "NO_XWAYLAND" = !enableXWayland;
"LEGACY_RENDERER" = legacyRenderer; "LEGACY_RENDERER" = legacyRenderer;
"NO_SYSTEMD" = !withSystemd; "NO_SYSTEMD" = !withSystemd;
"CMAKE_DISABLE_PRECOMPILE_HEADERS" = true; "CMAKE_DISABLE_PRECOMPILE_HEADERS" = true;
"NO_UWSM" = !withSystemd; "NO_UWSM" = !withSystemd;
"TRACY_ENABLE" = false; "TRACY_ENABLE" = false;
"WITH_TESTS" = withTests; "WITH_TESTS" = withTests;
}; };
preConfigure = '' preConfigure = ''
substituteInPlace hyprtester/CMakeLists.txt --replace-fail \ substituteInPlace hyprtester/CMakeLists.txt --replace-fail \
"\''${CMAKE_CURRENT_BINARY_DIR}" \ "\''${CMAKE_CURRENT_BINARY_DIR}" \
"${placeholder "out"}/bin" "${placeholder "out"}/bin"
''; '';
postInstall = '' postInstall = ''
${optionalString wrapRuntimeDeps '' ${optionalString wrapRuntimeDeps ''
wrapProgram $out/bin/Hyprland \ wrapProgram $out/bin/Hyprland \
--suffix PATH : ${ --suffix PATH : ${
makeBinPath [ makeBinPath [
binutils binutils
hyprland-guiutils hyprland-guiutils
pciutils pciutils
pkgconf pkgconf
] ]
} }
''} ''}
${optionalString withTests '' ${optionalString withTests ''
install hyprtester/pointer-warp -t $out/bin install hyprtester/pointer-warp -t $out/bin
install hyprtester/pointer-scroll -t $out/bin install hyprtester/pointer-scroll -t $out/bin
install hyprtester/shortcut-inhibitor -t $out/bin install hyprtester/shortcut-inhibitor -t $out/bin
install hyprland_gtests -t $out/bin install hyprland_gtests -t $out/bin
install hyprtester/child-window -t $out/bin install hyprtester/child-window -t $out/bin
''} ''}
''; '';
passthru.providedSessions = [ "hyprland" ] ++ optionals withSystemd [ "hyprland-uwsm" ]; passthru.providedSessions = ["hyprland"] ++ optionals withSystemd ["hyprland-uwsm"];
meta = { meta = {
homepage = "https://github.com/hyprwm/Hyprland"; homepage = "https://github.com/hyprwm/Hyprland";
description = "Dynamic tiling Wayland compositor that doesn't sacrifice on its looks"; description = "Dynamic tiling Wayland compositor that doesn't sacrifice on its looks";
license = lib.licenses.bsd3; license = lib.licenses.bsd3;
platforms = lib.platforms.linux; platforms = lib.platforms.linux;
mainProgram = "Hyprland"; mainProgram = "Hyprland";
}; };
}) })