nix: add files

This commit is contained in:
Mihai Fufezan 2022-12-04 01:44:12 +02:00
parent e2cfaf3eee
commit 3d3c5a4200
No known key found for this signature in database
GPG key ID: 5899325F2F120900
4 changed files with 131 additions and 0 deletions

21
.github/workflows/nix-build.yaml vendored Normal file
View file

@ -0,0 +1,21 @@
name: Build xdph (Nix)
on: [push, pull_request, workflow_dispatch]
jobs:
nix:
name: "Build"
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install nix
uses: cachix/install-nix-action@v17
with:
install_url: https://releases.nixos.org/nix/nix-2.10.3/install
extra_nix_config: |
auto-optimise-store = true
experimental-features = nix-command flakes
- name: Build xdg-desktop-portal-hyprland
run: nix build --print-build-logs

27
flake.lock Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1669969257,
"narHash": "sha256-mOS13sK3v+kfgP+1Mh56ohiG8uVhLHAo7m/q9kqAehc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b72b8b94cf0c012b0252a9100a636cad69696666",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

35
flake.nix Normal file
View file

@ -0,0 +1,35 @@
{
description = "xdg-desktop-portal-hyprland";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = {
self,
nixpkgs,
...
}: let
inherit (nixpkgs) lib;
genSystems = lib.genAttrs [
"aarch64-linux"
"x86_64-linux"
];
pkgsFor = nixpkgs.legacyPackages;
mkDate = longDate: (lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
in {
overlays.default = _: prev: {
xdg-desktop-portal-hyprland = prev.callPackage ./nix/default.nix {
version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
};
};
packages = genSystems (system:
(self.overlays.default null pkgsFor.${system})
// {default = self.packages.${system}.xdg-desktop-portal-hyprland;});
formatter = genSystems (system: pkgsFor.${system}.alejandra);
};
}

48
nix/default.nix Normal file
View file

@ -0,0 +1,48 @@
{
lib,
stdenv,
fetchpatch,
makeWrapper,
meson,
ninja,
pkg-config,
wayland-protocols,
wayland-scanner,
grim,
inih,
libdrm,
mesa,
pipewire,
slurp,
systemd,
wayland,
src,
version ? "git",
}:
stdenv.mkDerivation {
pname = "xdg-desktop-portal-hyprland";
inherit version;
src = ../.;
strictDeps = true;
depsBuildBuild = [pkg-config];
nativeBuildInputs = [meson ninja pkg-config wayland-scanner makeWrapper];
buildInputs = [inih libdrm mesa pipewire systemd wayland wayland-protocols];
mesonFlags = [
"-Dsd-bus-provider=libsystemd"
];
postInstall = ''
wrapProgram $out/libexec/xdg-desktop-portal-hyprland --prefix PATH ":" ${lib.makeBinPath [grim slurp]}
'';
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;
};
}