Unverified Commit 10a4343d authored by Jörg Thalheim's avatar Jörg Thalheim Committed by GitHub
Browse files

Merge pull request #221617 from fufexan/hyprland

hyprwm: update and init packages
parents 43720856 66b62bf8
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
{ 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;
  };
}
+80 −59
Original line number Diff line number Diff line
{ 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 = [
  outputs = [
    "out"
    "man"
  ];

  buildInputs =
    [
      cairo
      git
      hyprland-protocols
      libdrm
      libinput
    libxcb
      libxkbcommon
      mesa
    pango
      udis86
      wayland
      wayland-protocols
    xcbutilwm
      wayland-scanner
      pciutils
      (wlroots.override { inherit enableXWayland hidpiXWayland nvidiaPatches; })
    ]
  ++ [
    # 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=";
      };
    }))
  ];
    ++ lib.optionals enableXWayland [ libxcb xcbutilwm xwayland ]
    ++ lib.optionals withSystemd [ systemd ];

  # build with system wlroots
  postPatch = ''
    sed -Ei 's|"\.\./wlroots/include/([a-zA-Z0-9./_-]+)"|<\1>|g' src/includes.hpp
  '';
  mesonBuildType =
    if debug
    then "debug"
    else "release";

  preConfigure = ''
    make protocols
  '';

  postBuild = ''
    pushd ../hyprctl
    ${stdenv.cc.targetPrefix}c++ -std=c++20 -w ./main.cpp -o ./hyprctl
    popd
  '';

  installPhase = ''
    runHook preInstall
  mesonFlags = builtins.concatLists [
    (lib.optional (!enableXWayland) "-Dxwayland=disabled")
    (lib.optional legacyRenderer "-DLEGACY_RENDERER:STRING=true")
    (lib.optional withSystemd "-Dsystemd=enabled")
  ];

    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;
  };
})
}
+15 −0
Original line number Diff line number Diff line
{ udis86
, fetchFromGitHub
}:
udis86.overrideAttrs (old: {
  version = "unstable-2022-10-13";

  src = fetchFromGitHub {
    owner = "canihavesomecoffee";
    repo = "udis86";
    rev = "5336633af70f3917760a6d441ff02d93477b0c86";
    hash = "sha256-HifdUQPGsKQKQprByeIznvRLONdOXeolOsU5nkwIv3g=";
  };

  patches = [ ];
})
+113 −0
Original line number Diff line number Diff line
{ 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"
      ]);
  });
}
+95 −0
Original line number Diff line number Diff line
{ 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;
  };
}
Loading