nixpkgs/pkgs/applications/window-managers/hikari/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

75 lines
1.8 KiB
Nix

{ lib, stdenv, fetchzip,
pkgconfig, bmake,
cairo, glib, libevdev, libinput, libxkbcommon, linux-pam, pango, pixman,
libucl, wayland, wayland-protocols, wlroots,
features ? {
gammacontrol = true;
layershell = true;
screencopy = true;
xwayland = true;
}
}:
let
pname = "hikari";
version = "2.2.2";
in
stdenv.mkDerivation {
inherit pname version;
src = fetchzip {
url = "https://hikari.acmelabs.space/releases/${pname}-${version}.tar.gz";
sha256 = "0sln1n5f67i3vxkybfi6xhzplb45djqyg272vqkv64m72rmm8875";
};
nativeBuildInputs = [ pkgconfig bmake ];
buildInputs = [
cairo
glib
libevdev
libinput
libxkbcommon
linux-pam
pango
pixman
libucl
wayland
wayland-protocols
wlroots
];
enableParallelBuilding = true;
# Must replace GNU Make by bmake
buildPhase = with stdenv.lib; concatStringsSep " " (
[ "bmake" "-j$NIX_BUILD_CORES" "PREFIX=$out" ]
++ optional stdenv.isLinux "WITH_POSIX_C_SOURCE=YES"
++ mapAttrsToList (feat: enabled:
optionalString enabled "WITH_${toUpper feat}=YES"
) features
);
# Can't suid in nix store
# Run hikari as root (it will drop privileges as early as possible), or create
# a systemd unit to give it the necessary permissions/capabilities.
patchPhase = ''
substituteInPlace Makefile --replace '4555' '555'
'';
installPhase = ''
bmake \
PREFIX=$out \
install
runHook postInstall
'';
meta = with lib; {
description = "Stacking Wayland compositor which is actively developed on FreeBSD but also supports Linux";
homepage = "https://hikari.acmelabs.space";
license = licenses.bsd2;
platforms = platforms.linux ++ platforms.freebsd;
maintainers = with maintainers; [ jpotier ];
};
}