mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 15:05:59 +01:00
Nix: use CMake for builds instead of Meson
Build using submodules instead of patching the build process and using Nix derivations of the subprojects. From this commit on, you'll have to change the Hyprland flake url to `git+https://github.com/hyprwm/Hyprland?submodules=1`
This commit is contained in:
parent
99aa34db6e
commit
f15513309b
7 changed files with 49 additions and 202 deletions
25
flake.lock
25
flake.lock
|
@ -29,9 +29,11 @@
|
|||
"hyprland-protocols": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"xdph",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"xdph",
|
||||
"systems"
|
||||
]
|
||||
},
|
||||
|
@ -114,12 +116,10 @@
|
|||
"root": {
|
||||
"inputs": {
|
||||
"hyprcursor": "hyprcursor",
|
||||
"hyprland-protocols": "hyprland-protocols",
|
||||
"hyprlang": "hyprlang",
|
||||
"hyprwayland-scanner": "hyprwayland-scanner",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"systems": "systems",
|
||||
"wlroots": "wlroots",
|
||||
"xdph": "xdph"
|
||||
}
|
||||
},
|
||||
|
@ -138,28 +138,9 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"wlroots": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1713731601,
|
||||
"narHash": "sha256-bdcKdtLkusvv85DNuJsajZLFeq7bXp+x5AGP1Sd4wD8=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "wlroots-hyprland",
|
||||
"rev": "5c1d51c5a2793480f5b6c4341ad0797052aec2ea",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hyprwm",
|
||||
"repo": "wlroots-hyprland",
|
||||
"rev": "5c1d51c5a2793480f5b6c4341ad0797052aec2ea",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"xdph": {
|
||||
"inputs": {
|
||||
"hyprland-protocols": [
|
||||
"hyprland-protocols"
|
||||
],
|
||||
"hyprland-protocols": "hyprland-protocols",
|
||||
"hyprlang": [
|
||||
"hyprlang"
|
||||
],
|
||||
|
|
25
flake.nix
25
flake.nix
|
@ -7,14 +7,6 @@
|
|||
# <https://github.com/nix-systems/nix-systems>
|
||||
systems.url = "github:nix-systems/default-linux";
|
||||
|
||||
wlroots = {
|
||||
type = "github";
|
||||
owner = "hyprwm";
|
||||
repo = "wlroots-hyprland";
|
||||
rev = "5c1d51c5a2793480f5b6c4341ad0797052aec2ea";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
hyprcursor = {
|
||||
url = "github:hyprwm/hyprcursor";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
@ -22,12 +14,6 @@
|
|||
inputs.hyprlang.follows = "hyprlang";
|
||||
};
|
||||
|
||||
hyprland-protocols = {
|
||||
url = "github:hyprwm/hyprland-protocols";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.systems.follows = "systems";
|
||||
};
|
||||
|
||||
hyprlang = {
|
||||
url = "github:hyprwm/hyprlang";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
@ -44,7 +30,6 @@
|
|||
url = "github:hyprwm/xdg-desktop-portal-hyprland";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.systems.follows = "systems";
|
||||
inputs.hyprland-protocols.follows = "hyprland-protocols";
|
||||
inputs.hyprlang.follows = "hyprlang";
|
||||
};
|
||||
};
|
||||
|
@ -92,8 +77,6 @@
|
|||
# dependencies
|
||||
|
||||
hyprland-protocols
|
||||
wlroots-hyprland
|
||||
udis86
|
||||
;
|
||||
});
|
||||
|
||||
|
@ -103,13 +86,9 @@
|
|||
stdenv = pkgsFor.${system}.gcc13Stdenv;
|
||||
} {
|
||||
name = "hyprland-shell";
|
||||
nativeBuildInputs = with pkgsFor.${system}; [cmake python3 expat libxml2];
|
||||
buildInputs = [self.packages.${system}.wlroots-hyprland];
|
||||
nativeBuildInputs = with pkgsFor.${system}; [expat libxml2];
|
||||
hardeningDisable = ["fortify"];
|
||||
inputsFrom = [
|
||||
self.packages.${system}.wlroots-hyprland
|
||||
self.packages.${system}.hyprland
|
||||
];
|
||||
inputsFrom = [pkgsFor.${system}.hyprland];
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
@ -4,10 +4,12 @@
|
|||
pkg-config,
|
||||
pkgconf,
|
||||
makeWrapper,
|
||||
cmake,
|
||||
meson,
|
||||
ninja,
|
||||
binutils,
|
||||
cairo,
|
||||
expat,
|
||||
git,
|
||||
hyprcursor,
|
||||
hyprland-protocols,
|
||||
|
@ -19,19 +21,19 @@
|
|||
libexecinfo,
|
||||
libinput,
|
||||
libuuid,
|
||||
libxcb,
|
||||
libxkbcommon,
|
||||
mesa,
|
||||
pango,
|
||||
pciutils,
|
||||
python3,
|
||||
systemd,
|
||||
tomlplusplus,
|
||||
udis86,
|
||||
wayland,
|
||||
wayland-protocols,
|
||||
wayland-scanner,
|
||||
wlroots-hyprland,
|
||||
xcbutilwm,
|
||||
wlroots,
|
||||
xorg,
|
||||
xwayland,
|
||||
debug ? false,
|
||||
enableXWayland ? true,
|
||||
|
@ -48,9 +50,7 @@
|
|||
}:
|
||||
assert lib.assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been removed.";
|
||||
assert lib.assertMsg (!enableNvidiaPatches) "The option `enableNvidiaPatches` has been removed.";
|
||||
assert lib.assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been removed. Please refer https://wiki.hyprland.org/Configuring/XWayland"; let
|
||||
wlr = wlroots-hyprland.override {inherit enableXWayland;};
|
||||
in
|
||||
assert lib.assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been removed. Please refer https://wiki.hyprland.org/Configuring/XWayland";
|
||||
stdenv.mkDerivation {
|
||||
pname = "hyprland${lib.optionalString debug "-debug"}";
|
||||
inherit version;
|
||||
|
@ -63,11 +63,6 @@ in
|
|||
src = lib.cleanSource ../.;
|
||||
};
|
||||
|
||||
patches = [
|
||||
# make meson use the provided wlroots instead of the git submodule
|
||||
./patches/meson-build.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# Fix hardcoded paths to /usr installation
|
||||
sed -i "s#/usr#$out#" src/render/OpenGL.cpp
|
||||
|
@ -91,9 +86,11 @@ in
|
|||
hyprwayland-scanner
|
||||
jq
|
||||
makeWrapper
|
||||
cmake
|
||||
meson
|
||||
ninja
|
||||
pkg-config
|
||||
python3
|
||||
wayland-scanner
|
||||
];
|
||||
|
||||
|
@ -103,10 +100,12 @@ in
|
|||
"dev"
|
||||
];
|
||||
|
||||
buildInputs =
|
||||
wlr.buildInputs
|
||||
++ [
|
||||
buildInputs = lib.concatLists [
|
||||
wlroots.buildInputs
|
||||
udis86.buildInputs
|
||||
[
|
||||
cairo
|
||||
expat
|
||||
git
|
||||
hyprcursor.dev
|
||||
hyprland-protocols
|
||||
|
@ -120,31 +119,32 @@ in
|
|||
pango
|
||||
pciutils
|
||||
tomlplusplus
|
||||
udis86
|
||||
wayland
|
||||
wayland-protocols
|
||||
wlr
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isMusl [libexecinfo]
|
||||
++ lib.optionals enableXWayland [libxcb xcbutilwm xwayland]
|
||||
++ lib.optionals withSystemd [systemd];
|
||||
(lib.optionals stdenv.hostPlatform.isMusl [libexecinfo])
|
||||
(lib.optionals enableXWayland [
|
||||
xorg.libxcb
|
||||
xorg.libXdmcp
|
||||
xorg.xcbutil
|
||||
xorg.xcbutilwm
|
||||
xwayland
|
||||
])
|
||||
(lib.optionals withSystemd [systemd])
|
||||
];
|
||||
|
||||
mesonBuildType =
|
||||
cmakeBuildType =
|
||||
if debug
|
||||
then "debug"
|
||||
else "release";
|
||||
then "Debug"
|
||||
else "RelWithDebInfo";
|
||||
|
||||
mesonAutoFeatures = "disabled";
|
||||
|
||||
mesonFlags = [
|
||||
(lib.mesonEnable "xwayland" enableXWayland)
|
||||
(lib.mesonEnable "legacy_renderer" legacyRenderer)
|
||||
(lib.mesonEnable "systemd" withSystemd)
|
||||
cmakeFlags = [
|
||||
(lib.cmakeBool "NO_XWAYLAND" (!enableXWayland))
|
||||
(lib.cmakeBool "LEGACY_RENDERER" legacyRenderer)
|
||||
(lib.cmakeBool "NO_SYSTEMD" (!withSystemd))
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
ln -s ${wlr}/include/wlr $dev/include/hyprland/wlroots
|
||||
|
||||
${lib.optionalString wrapRuntimeDeps ''
|
||||
wrapProgram $out/bin/Hyprland \
|
||||
--suffix PATH : ${lib.makeBinPath [
|
||||
|
@ -161,7 +161,7 @@ in
|
|||
homepage = "https://github.com/hyprwm/Hyprland";
|
||||
description = "A dynamic tiling Wayland compositor that doesn't sacrifice on its looks";
|
||||
license = licenses.bsd3;
|
||||
platforms = wlr.meta.platforms;
|
||||
platforms = wlroots.meta.platforms;
|
||||
mainProgram = "Hyprland";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -22,12 +22,11 @@ in {
|
|||
hyprland-packages = lib.composeManyExtensions [
|
||||
# Dependencies
|
||||
inputs.hyprcursor.overlays.default
|
||||
inputs.hyprland-protocols.overlays.default
|
||||
inputs.hyprlang.overlays.default
|
||||
inputs.hyprwayland-scanner.overlays.default
|
||||
self.overlays.wlroots-hyprland
|
||||
self.overlays.udis86
|
||||
self.overlays.wayland-protocols
|
||||
self.overlays.xwayland
|
||||
|
||||
# Hyprland packages themselves
|
||||
(final: prev: let
|
||||
date = mkDate (self.lastModifiedDate or "19700101");
|
||||
|
@ -36,19 +35,20 @@ in {
|
|||
stdenv = final.gcc13Stdenv;
|
||||
version = "${props.version}+date=${date}_${self.shortRev or "dirty"}";
|
||||
commit = self.rev or "";
|
||||
udis86 = final.udis86-hyprland; # explicit override until decided on breaking change of the name
|
||||
inherit (final) wlroots-hyprland; # explicit override until decided on breaking change of the name
|
||||
inherit date;
|
||||
};
|
||||
hyprland-unwrapped = final.hyprland.override {wrapRuntimeDeps = false;};
|
||||
hyprland-debug = final.hyprland.override {debug = true;};
|
||||
hyprland-legacy-renderer = final.hyprland.override {legacyRenderer = true;};
|
||||
|
||||
# deprecated packages
|
||||
hyprland-nvidia =
|
||||
builtins.trace ''
|
||||
hyprland-nvidia was removed. Please use the hyprland package.
|
||||
Nvidia patches are no longer needed.
|
||||
''
|
||||
final.hyprland;
|
||||
|
||||
hyprland-hidpi =
|
||||
builtins.trace ''
|
||||
hyprland-hidpi was removed. Please use the hyprland package.
|
||||
|
@ -64,18 +64,14 @@ in {
|
|||
inputs.xdph.overlays.xdg-desktop-portal-hyprland
|
||||
];
|
||||
|
||||
udis86 = final: prev: {
|
||||
udis86-hyprland = final.callPackage ./udis86.nix {};
|
||||
};
|
||||
|
||||
# Patched version of wlroots for Hyprland.
|
||||
# It is under a new package name so as to not conflict with
|
||||
# the standard version in nixpkgs.
|
||||
wlroots-hyprland = final: prev: {
|
||||
wlroots-hyprland = final.callPackage ./wlroots.nix {
|
||||
version = "${mkDate (inputs.wlroots.lastModifiedDate or "19700101")}_${inputs.wlroots.shortRev or "dirty"}";
|
||||
src = inputs.wlroots;
|
||||
};
|
||||
# Patches XWayland's pkgconfig file to not include Cflags or includedir
|
||||
# The above two variables trip up CMake and the build fails
|
||||
xwayland = final: prev: {
|
||||
xwayland = prev.xwayland.overrideAttrs (old: {
|
||||
postInstall = ''
|
||||
sed -i '/includedir/d' $out/lib/pkgconfig/xwayland.pc
|
||||
'';
|
||||
});
|
||||
};
|
||||
|
||||
wayland-protocols = final: prev: {
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
diff --git a/meson.build b/meson.build
|
||||
index 40883073..d8f2e536 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -33,20 +33,7 @@ if cpp_compiler.check_header('execinfo.h')
|
||||
add_project_arguments('-DHAS_EXECINFO', language: 'cpp')
|
||||
endif
|
||||
|
||||
-wlroots = subproject('wlroots-hyprland', default_options: ['examples=false', 'renderers=gles2'])
|
||||
-have_xwlr = wlroots.get_variable('features').get('xwayland')
|
||||
-xcb_dep = dependency('xcb', required: get_option('xwayland'))
|
||||
-
|
||||
-cmake = import('cmake')
|
||||
-udis = cmake.subproject('udis86')
|
||||
-udis86 = udis.dependency('libudis86')
|
||||
-
|
||||
-if get_option('xwayland').enabled() and not have_xwlr
|
||||
- error('Cannot enable Xwayland in Hyprland: wlroots has been built without Xwayland support')
|
||||
-endif
|
||||
-have_xwayland = xcb_dep.found() and have_xwlr
|
||||
-
|
||||
-if not have_xwayland
|
||||
+if get_option('xwayland').disabled()
|
||||
add_project_arguments('-DNO_XWAYLAND', language: 'cpp')
|
||||
endif
|
||||
|
||||
@@ -65,8 +52,6 @@ if get_option('buildtype') == 'debug'
|
||||
add_project_arguments('-DHYPRLAND_DEBUG', language: 'cpp')
|
||||
endif
|
||||
|
||||
-version_h = run_command('sh', '-c', 'scripts/generateVersion.sh')
|
||||
-
|
||||
globber = run_command('find', 'src', '-name', '*.h*', check: true)
|
||||
headers = globber.stdout().strip().split('\n')
|
||||
foreach file : headers
|
||||
diff --git a/src/meson.build b/src/meson.build
|
||||
index 15c69552..327aa4fb 100644
|
||||
--- a/src/meson.build
|
||||
+++ b/src/meson.build
|
||||
@@ -9,7 +9,7 @@ executable('Hyprland', src,
|
||||
server_protos,
|
||||
dependency('wayland-server'),
|
||||
dependency('wayland-client'),
|
||||
- wlroots.get_variable('wlroots'),
|
||||
+ dependency('wlroots'),
|
||||
dependency('cairo'),
|
||||
dependency('hyprcursor'),
|
||||
dependency('hyprlang', version: '>= 0.3.2'),
|
||||
@@ -17,10 +17,10 @@ executable('Hyprland', src,
|
||||
dependency('egl'),
|
||||
dependency('xkbcommon'),
|
||||
dependency('libinput'),
|
||||
- xcb_dep,
|
||||
+ dependency('xcb', required: get_option('xwayland')),
|
||||
backtrace_dep,
|
||||
epoll_dep,
|
||||
- udis86,
|
||||
+ dependency('udis86'),
|
||||
|
||||
dependency('pixman-1'),
|
||||
dependency('gl', 'opengl'),
|
|
@ -1,32 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
autoreconfHook,
|
||||
python3,
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
pname = "udis86";
|
||||
version = "unstable-2022-10-13";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "canihavesomecoffee";
|
||||
repo = "udis86";
|
||||
rev = "5336633af70f3917760a6d441ff02d93477b0c86";
|
||||
hash = "sha256-HifdUQPGsKQKQprByeIznvRLONdOXeolOsU5nkwIv3g=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [autoreconfHook python3];
|
||||
|
||||
configureFlags = ["--enable-shared"];
|
||||
|
||||
outputs = ["bin" "out" "dev" "lib"];
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://udis86.sourceforge.net";
|
||||
license = licenses.bsd2;
|
||||
mainProgram = "udcli";
|
||||
description = "Easy-to-use, minimalistic x86 disassembler library (libudis86)";
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
version,
|
||||
src,
|
||||
git,
|
||||
wlroots,
|
||||
enableXWayland ? true,
|
||||
}:
|
||||
wlroots.overrideAttrs (old: {
|
||||
inherit version src enableXWayland;
|
||||
|
||||
pname = "${old.pname}-hyprland";
|
||||
|
||||
patches = [ ]; # don't inherit old.patches
|
||||
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [ git ];
|
||||
})
|
Loading…
Reference in a new issue