nix: add hyprland-protocols and streamline build

This commit is contained in:
Mihai Fufezan 2022-12-04 22:55:47 +02:00
parent 6d6c5547b4
commit 3be001b747
No known key found for this signature in database
GPG key ID: 5899325F2F120900
5 changed files with 47 additions and 4 deletions

View file

@ -1,5 +1,21 @@
{ {
"nodes": { "nodes": {
"hyprland-protocols": {
"flake": false,
"locked": {
"lastModified": 1670185345,
"narHash": "sha256-hxWGqlPecqEsE6nOHDV29KFBKePbY2Ipeac6lrChMKY=",
"owner": "hyprwm",
"repo": "hyprland-protocols",
"rev": "4623a404c091e64743ba310199bb380ec52f1936",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-protocols",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1669969257, "lastModified": 1669969257,
@ -18,6 +34,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"hyprland-protocols": "hyprland-protocols",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
} }

View file

@ -1,13 +1,20 @@
{ {
description = "xdg-desktop-portal-hyprland"; description = "xdg-desktop-portal-hyprland";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
hyprland-protocols = {
url = "github:hyprwm/hyprland-protocols";
flake = false;
};
};
outputs = { outputs = {
self, self,
nixpkgs, nixpkgs,
... ...
}: let } @ inputs: let
inherit (nixpkgs) lib; inherit (nixpkgs) lib;
genSystems = lib.genAttrs [ genSystems = lib.genAttrs [
"aarch64-linux" "aarch64-linux"
@ -23,6 +30,7 @@
overlays.default = _: prev: { overlays.default = _: prev: {
xdg-desktop-portal-hyprland = prev.callPackage ./nix/default.nix { xdg-desktop-portal-hyprland = prev.callPackage ./nix/default.nix {
version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
inherit (inputs) hyprland-protocols;
}; };
}; };

View file

@ -100,7 +100,7 @@ executable(
], ],
include_directories: [inc], include_directories: [inc],
install: true, install: true,
install_dir: 'libexecdir', install_dir: get_option('libexecdir'),
) )
conf_data = configuration_data() conf_data = configuration_data()

View file

@ -9,6 +9,7 @@
wayland-protocols, wayland-protocols,
wayland-scanner, wayland-scanner,
grim, grim,
hyprland-protocols,
inih, inih,
libdrm, libdrm,
mesa, mesa,
@ -32,6 +33,12 @@ in
nativeBuildInputs = [meson ninja pkg-config wayland-scanner makeWrapper]; nativeBuildInputs = [meson ninja pkg-config wayland-scanner makeWrapper];
buildInputs = [inih libdrm mesa pipewire systemd wayland wayland-protocols]; buildInputs = [inih libdrm mesa pipewire systemd wayland wayland-protocols];
preConfigure = ''
rmdir protocols/hyprland-protocols
ln -s ${hyprland-protocols.outPath}/ protocols/hyprland-protocols
'';
mesonFlags = [ mesonFlags = [
"-Dsd-bus-provider=libsystemd" "-Dsd-bus-provider=libsystemd"
]; ];

View file

@ -3,7 +3,10 @@
lib, lib,
cmake, cmake,
qtbase, qtbase,
makeShellWrapper,
wrapQtAppsHook, wrapQtAppsHook,
grim,
slurp,
version ? "git", version ? "git",
... ...
}: }:
@ -12,6 +15,14 @@ stdenv.mkDerivation {
inherit version; inherit version;
src = ../hyprland-share-picker; src = ../hyprland-share-picker;
nativeBuildInputs = [cmake wrapQtAppsHook]; nativeBuildInputs = [cmake wrapQtAppsHook makeShellWrapper];
buildInputs = [qtbase]; buildInputs = [qtbase];
dontWrapQtApps = true;
postInstall = ''
wrapProgramShell $out/bin/hyprland-share-picker \
"''${qtWrapperArgs[@]}" \
--prefix PATH ":" ${lib.makeBinPath [grim slurp]}
'';
} }