Nix: add deprecation messages for removed/renamed flags

This commit is contained in:
Mihai Fufezan 2023-08-02 00:49:30 +03:00 committed by Mihai Fufezan
parent c1bcbdb3dd
commit e510c6a7fc

View file

@ -33,99 +33,104 @@
wrapRuntimeDeps ? true, wrapRuntimeDeps ? true,
version ? "git", version ? "git",
commit, commit,
# deprecated flags
nvidiaPatches ? false,
hidpiXWayland ? false,
}: }:
stdenv.mkDerivation { assert lib.assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been renamed `enableNvidiaPatches`";
pname = "hyprland${lib.optionalString enableNvidiaPatches "-nvidia"}${lib.optionalString debug "-debug"}"; assert lib.assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been removed. Please refer https://wiki.hyprland.org/Configuring/XWayland";
inherit version; stdenv.mkDerivation {
pname = "hyprland${lib.optionalString enableNvidiaPatches "-nvidia"}${lib.optionalString debug "-debug"}";
inherit version;
src = lib.cleanSourceWith { src = lib.cleanSourceWith {
filter = name: type: let filter = name: type: let
baseName = baseNameOf (toString name); baseName = baseNameOf (toString name);
in in
! (lib.hasSuffix ".nix" baseName); ! (lib.hasSuffix ".nix" baseName);
src = lib.cleanSource ../.; src = lib.cleanSource ../.;
}; };
nativeBuildInputs = [ nativeBuildInputs = [
jq jq
meson meson
ninja ninja
pkg-config pkg-config
makeWrapper makeWrapper
wayland-scanner wayland-scanner
]; ];
outputs = [ outputs = [
"out" "out"
"man" "man"
"dev" "dev"
]; ];
buildInputs = buildInputs =
[ [
git git
cairo cairo
hyprland-protocols hyprland-protocols
libdrm libdrm
libinput libinput
libxkbcommon libxkbcommon
mesa mesa
pango pango
udis86 udis86
wayland wayland
wayland-protocols wayland-protocols
pciutils pciutils
(wlroots.override {inherit enableNvidiaPatches;}) (wlroots.override {inherit enableNvidiaPatches;})
] ]
++ lib.optionals enableXWayland [libxcb xcbutilwm xwayland] ++ lib.optionals enableXWayland [libxcb xcbutilwm xwayland]
++ lib.optionals withSystemd [systemd]; ++ lib.optionals withSystemd [systemd];
mesonBuildType = mesonBuildType =
if debug if debug
then "debug" then "debug"
else "release"; else "release";
mesonFlags = builtins.concatLists [ mesonFlags = builtins.concatLists [
["-Dauto_features=disabled"] ["-Dauto_features=disabled"]
(lib.optional enableXWayland "-Dxwayland=enabled") (lib.optional enableXWayland "-Dxwayland=enabled")
(lib.optional legacyRenderer "-Dlegacy_renderer=enabled") (lib.optional legacyRenderer "-Dlegacy_renderer=enabled")
(lib.optional withSystemd "-Dsystemd=enabled") (lib.optional withSystemd "-Dsystemd=enabled")
]; ];
patches = [ patches = [
# make meson use the provided wlroots instead of the git submodule # make meson use the provided wlroots instead of the git submodule
./patches/meson-build.patch ./patches/meson-build.patch
# fixes portals search path to be picked up from $XDG_DESKTOP_PORTAL_DIR # fixes portals search path to be picked up from $XDG_DESKTOP_PORTAL_DIR
./patches/portals.patch ./patches/portals.patch
]; ];
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
substituteInPlace meson.build \ substituteInPlace meson.build \
--replace "@GIT_COMMIT_HASH@" '${commit}' \ --replace "@GIT_COMMIT_HASH@" '${commit}' \
--replace "@GIT_DIRTY@" '${ --replace "@GIT_DIRTY@" '${
if commit == "" if commit == ""
then "dirty" then "dirty"
else "" else ""
}' }'
''; '';
postInstall = '' postInstall = ''
ln -s ${wlroots}/include/wlr $dev/include/hyprland/wlroots ln -s ${wlroots}/include/wlr $dev/include/hyprland/wlroots
${lib.optionalString wrapRuntimeDeps '' ${lib.optionalString wrapRuntimeDeps ''
wrapProgram $out/bin/Hyprland \ wrapProgram $out/bin/Hyprland \
--suffix PATH : ${lib.makeBinPath [binutils pciutils]} --suffix PATH : ${lib.makeBinPath [binutils pciutils]}
''} ''}
''; '';
passthru.providedSessions = ["hyprland"]; passthru.providedSessions = ["hyprland"];
meta = with lib; { meta = with lib; {
homepage = "https://github.com/vaxerski/Hyprland"; homepage = "https://github.com/vaxerski/Hyprland";
description = "A dynamic tiling Wayland compositor that doesn't sacrifice on its looks"; description = "A dynamic tiling Wayland compositor that doesn't sacrifice on its looks";
license = licenses.bsd3; license = licenses.bsd3;
platforms = platforms.linux; platforms = platforms.linux;
mainProgram = "Hyprland"; mainProgram = "Hyprland";
}; };
} }