add xwayland disabling support to flake.nix

This commit is contained in:
Tanish2002 2022-05-08 23:48:13 +05:30
parent 2342b6a10f
commit 7c6fc3c6ad
3 changed files with 33 additions and 15 deletions

View file

@ -99,6 +99,7 @@ install:
make all make all
mkdir -p ${PREFIX}/share/wayland-sessions mkdir -p ${PREFIX}/share/wayland-sessions
cp ./example/hyprland.desktop ${PREFIX}/share/wayland-sessions/ cp ./example/hyprland.desktop ${PREFIX}/share/wayland-sessions/
mkdir -p ${PREFIX}/bin
cp ./build/Hyprland ${PREFIX}/bin cp ./build/Hyprland ${PREFIX}/bin
cp ./hyprctl/hyprctl ${PREFIX}/bin cp ./hyprctl/hyprctl ${PREFIX}/bin
mkdir -p ${PREFIX}/share/hyprland mkdir -p ${PREFIX}/share/hyprland

View file

@ -1,13 +1,13 @@
{ lib, stdenv, fetchFromGitHub, src, version, pkg-config, cmake, ninja, libdrm { lib, stdenv, fetchFromGitHub, src, pkg-config, cmake, ninja, libdrm, libinput
, libinput, libxcb, libxkbcommon, mesa, mount, pango, wayland, wayland-protocols , libxcb, libxkbcommon, mesa, mount, pango, wayland, wayland-protocols
, wayland-scanner, wlroots, xcbutilwm, xwayland, xwaylandSupport ? true }: , wayland-scanner, wlroots, xcbutilwm, xwayland, enableXWayland ? true }:
stdenv.mkDerivation { stdenv.mkDerivation rec {
pname = "hyprland"; pname = "hyprland";
inherit src version; version = "git";
inherit src;
nativeBuildInputs = [ cmake ninja pkg-config wayland ] nativeBuildInputs = [ cmake ninja pkg-config wayland xwayland ];
++ lib.optional xwaylandSupport xwayland;
buildInputs = [ buildInputs = [
libdrm libdrm
@ -19,14 +19,34 @@ stdenv.mkDerivation {
wayland-protocols wayland-protocols
wayland-scanner wayland-scanner
wlroots wlroots
(wlroots.override { inherit enableXWayland; })
xcbutilwm xcbutilwm
]; ];
dontBuild = true; cmakeFlags = [ "-DCMAKE_BUILD_TYPE=Release" ]
dontInstall = true; ++ lib.optional (!enableXWayland) "-DNO_XWAYLAND=true";
postPatch = '' prePatch = ''
make install PREFIX=$out make config
'';
postBuild = ''
pushd ../hyprctl
make all
popd
'';
installPhase = ''
cd ../
mkdir -p $out/share/wayland-sessions
cp ./example/hyprland.desktop $out/share/wayland-sessions/
mkdir -p $out/bin
cp ./build/Hyprland $out/bin
cp ./hyprctl/hyprctl $out/bin
mkdir -p $out/share/hyprland
cp ./assets/wall_2K.png $out/share/hyprland
cp ./assets/wall_4K.png $out/share/hyprland
cp ./assets/wall_8K.png $out/share/hyprland
''; '';
meta = with lib; { meta = with lib; {

View file

@ -10,13 +10,10 @@
outputs = { self, nixpkgs, utils, nixpkgs-wayland }: outputs = { self, nixpkgs, utils, nixpkgs-wayland }:
utils.lib.eachDefaultSystem (system: utils.lib.eachDefaultSystem (system:
let let pkgs = nixpkgs.legacyPackages.${system};
pkgs = nixpkgs.legacyPackages.${system};
version = "git";
in rec { in rec {
packages = { packages = {
hyprland = pkgs.callPackage self { hyprland = pkgs.callPackage self {
inherit version;
src = self; src = self;
inherit (nixpkgs-wayland.packages.${system}) wlroots; inherit (nixpkgs-wayland.packages.${system}) wlroots;
}; };