From b03b1c2f275cfbf45193c0ef14a95869fb66e484 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Sat, 7 Jan 2023 20:28:38 +0200 Subject: [PATCH] nix & meson: add hyprland-protocols through pkgconfig (#14) --- .gitmodules | 4 ++-- flake.lock | 12 ++++++++---- flake.nix | 4 ++-- meson.build | 1 + nix/default.nix | 9 +-------- protocols/hyprland-protocols | 1 - protocols/meson.build | 3 ++- subprojects/hyprland-protocols | 1 + 8 files changed, 17 insertions(+), 18 deletions(-) delete mode 160000 protocols/hyprland-protocols create mode 160000 subprojects/hyprland-protocols diff --git a/.gitmodules b/.gitmodules index 54778e7..33bc81f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "protocols/hyprland-protocols"] - path = protocols/hyprland-protocols +[submodule "hyprland-protocols"] + path = subprojects/hyprland-protocols url = https://github.com/hyprwm/hyprland-protocols diff --git a/flake.lock b/flake.lock index eb47d80..9afc37e 100644 --- a/flake.lock +++ b/flake.lock @@ -1,13 +1,17 @@ { "nodes": { "hyprland-protocols": { - "flake": false, + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, "locked": { - "lastModified": 1670703428, - "narHash": "sha256-4KUW5SKR0Y9uaYGcYwy53YJ3B/sgiprCL4fRGO+mpOA=", + "lastModified": 1671839510, + "narHash": "sha256-+PY1qqJfmZzzROgcIY4I7AkCwpnC+qBIYk2eFoA9RWc=", "owner": "hyprwm", "repo": "hyprland-protocols", - "rev": "d0d6db8cb5bef6d93ca3ad8fb2124964173396da", + "rev": "b8f55e02a328c47ed373133c52483bbfa20a1b75", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 38e1171..d88267d 100644 --- a/flake.nix +++ b/flake.nix @@ -6,7 +6,7 @@ hyprland-protocols = { url = "github:hyprwm/hyprland-protocols"; - flake = false; + inputs.nixpkgs.follows = "nixpkgs"; }; }; @@ -31,7 +31,7 @@ overlays.default = _: prev: rec { xdg-desktop-portal-hyprland = prev.callPackage ./nix/default.nix { stdenv = prev.gcc12Stdenv; - inherit (inputs) hyprland-protocols; + inherit (inputs.hyprland-protocols.packages.${prev.hostPlatform.system}) hyprland-protocols; inherit hyprland-share-picker version; }; diff --git a/meson.build b/meson.build index 25d80c8..01abab6 100644 --- a/meson.build +++ b/meson.build @@ -24,6 +24,7 @@ inc = include_directories('include') rt = cc.find_library('rt') pipewire = dependency('libpipewire-0.3', version: '>= 0.3.41') +hyprland_protos = dependency('hyprland-protocols', version: '>=0.1', fallback: 'hyprland-protocols') wayland_client = dependency('wayland-client') wayland_protos = dependency('wayland-protocols', version: '>=1.24') iniparser = dependency('inih') diff --git a/nix/default.nix b/nix/default.nix index e5d4fa3..828ab3e 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -28,14 +28,7 @@ stdenv.mkDerivation { strictDeps = true; depsBuildBuild = [pkg-config]; nativeBuildInputs = [meson ninja pkg-config wayland-scanner makeWrapper]; - buildInputs = [inih libdrm mesa pipewire systemd wayland wayland-protocols]; - - preConfigure = '' - # for some reason rmdir doesn't work in a dirty tree - rmdir protocols/hyprland-protocols || true - - ln -s ${hyprland-protocols.outPath}/ protocols/hyprland-protocols - ''; + buildInputs = [hyprland-protocols inih libdrm mesa pipewire systemd wayland wayland-protocols]; mesonFlags = [ "-Dsd-bus-provider=libsystemd" diff --git a/protocols/hyprland-protocols b/protocols/hyprland-protocols deleted file mode 160000 index 301733a..0000000 --- a/protocols/hyprland-protocols +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 301733ae466b229066ba15a53e6d8b91c5dcef5b diff --git a/protocols/meson.build b/protocols/meson.build index 5545a64..9314d5f 100644 --- a/protocols/meson.build +++ b/protocols/meson.build @@ -1,4 +1,5 @@ wl_protocol_dir = wayland_protos.get_variable('pkgdatadir') +hl_protocol_dir = hyprland_protos.get_variable('pkgdatadir') wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true) if wayland_scanner_dep.found() @@ -13,9 +14,9 @@ endif client_protocols = [ wl_protocol_dir / 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml', wl_protocol_dir / 'unstable/xdg-output/xdg-output-unstable-v1.xml', + hl_protocol_dir / 'protocols/hyprland-toplevel-export-v1.xml', 'wlr-screencopy-unstable-v1.xml', 'wlr-foreign-toplevel-management-unstable-v1.xml', - 'hyprland-protocols/protocols/hyprland-toplevel-export-v1.xml' ] wl_proto_files = [] diff --git a/subprojects/hyprland-protocols b/subprojects/hyprland-protocols new file mode 160000 index 0000000..b8f55e0 --- /dev/null +++ b/subprojects/hyprland-protocols @@ -0,0 +1 @@ +Subproject commit b8f55e02a328c47ed373133c52483bbfa20a1b75