From 5f7eecff553d82f21e049d79d8fb3f1f46568da0 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Fri, 9 Dec 2022 15:37:23 +0200 Subject: [PATCH] nix: wrap hyprland-share-picker with hyprland in PATH --- flake.nix | 7 +++-- nix/default.nix | 58 +++++++++++++++++------------------ nix/hyprland-share-picker.nix | 3 +- 3 files changed, 36 insertions(+), 32 deletions(-) diff --git a/flake.nix b/flake.nix index b622712..8cd2e53 100644 --- a/flake.nix +++ b/flake.nix @@ -26,12 +26,15 @@ (builtins.substring 4 2 longDate) (builtins.substring 6 2 longDate) ]); + version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); in { - overlays.default = _: prev: { + overlays.default = _: prev: rec { xdg-desktop-portal-hyprland = prev.callPackage ./nix/default.nix { - version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); inherit (inputs) hyprland-protocols; + inherit hyprland-share-picker version; }; + + hyprland-share-picker = prev.libsForQt5.callPackage ./nix/hyprland-share-picker.nix {inherit version;}; }; packages = genSystems (system: diff --git a/nix/default.nix b/nix/default.nix index 27634b0..6fce882 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -8,6 +8,7 @@ pkg-config, wayland-protocols, wayland-scanner, + hyprland-share-picker, hyprland-protocols, inih, libdrm, @@ -17,39 +18,38 @@ wayland, libsForQt5, version ? "git", -}: let - hyprland-share-picker = libsForQt5.callPackage ./hyprland-share-picker.nix {inherit version;}; -in - stdenv.mkDerivation { - pname = "xdg-desktop-portal-hyprland"; - inherit version; +}: +stdenv.mkDerivation { + pname = "xdg-desktop-portal-hyprland"; + inherit version; - src = ../.; + src = ../.; - strictDeps = true; - depsBuildBuild = [pkg-config]; - nativeBuildInputs = [meson ninja pkg-config wayland-scanner makeWrapper]; - buildInputs = [inih libdrm mesa pipewire systemd wayland wayland-protocols]; + strictDeps = true; + depsBuildBuild = [pkg-config]; + nativeBuildInputs = [meson ninja pkg-config wayland-scanner makeWrapper]; + buildInputs = [inih libdrm mesa pipewire systemd wayland wayland-protocols]; - preConfigure = '' - rmdir protocols/hyprland-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 - ''; + ln -s ${hyprland-protocols.outPath}/ protocols/hyprland-protocols + ''; - mesonFlags = [ - "-Dsd-bus-provider=libsystemd" - ]; + mesonFlags = [ + "-Dsd-bus-provider=libsystemd" + ]; - postInstall = '' - wrapProgram $out/libexec/xdg-desktop-portal-hyprland --prefix PATH ":" ${lib.makeBinPath [hyprland-share-picker]} - ''; + postInstall = '' + wrapProgram $out/libexec/xdg-desktop-portal-hyprland --prefix PATH ":" ${lib.makeBinPath [hyprland-share-picker]} + ''; - meta = with lib; { - homepage = "https://github.com/emersion/xdg-desktop-portal-hyprland"; - description = "xdg-desktop-portal backend for Hyprland"; - maintainers = with maintainers; [fufexan]; - platforms = platforms.linux; - license = licenses.mit; - }; - } + meta = with lib; { + homepage = "https://github.com/emersion/xdg-desktop-portal-hyprland"; + description = "xdg-desktop-portal backend for Hyprland"; + maintainers = with maintainers; [fufexan]; + platforms = platforms.linux; + license = licenses.mit; + }; +} diff --git a/nix/hyprland-share-picker.nix b/nix/hyprland-share-picker.nix index b143461..e26b10d 100644 --- a/nix/hyprland-share-picker.nix +++ b/nix/hyprland-share-picker.nix @@ -5,6 +5,7 @@ qtbase, makeShellWrapper, wrapQtAppsHook, + hyprland, slurp, version ? "git", ... @@ -22,6 +23,6 @@ stdenv.mkDerivation { postInstall = '' wrapProgramShell $out/bin/hyprland-share-picker \ "''${qtWrapperArgs[@]}" \ - --prefix PATH ":" ${lib.makeBinPath [slurp]} + --prefix PATH ":" ${lib.makeBinPath [slurp hyprland]} ''; }