quickshell/default.nix

93 lines
2.4 KiB
Nix
Raw Normal View History

2024-03-04 05:04:29 -08:00
{
lib,
nix-gitignore,
pkgs,
keepDebugInfo,
buildStdenv ? pkgs.clang17Stdenv,
2024-03-04 05:04:29 -08:00
cmake,
ninja,
qt6,
cli11,
jemalloc,
2024-03-04 05:04:29 -08:00
wayland,
wayland-protocols,
2024-05-20 02:16:44 -07:00
xorg,
pipewire,
2024-06-17 18:32:13 -07:00
pam,
2024-03-04 05:04:29 -08:00
2024-03-08 23:08:50 -08:00
gitRev ? (let
headExists = builtins.pathExists ./.git/HEAD;
headContent = builtins.readFile ./.git/HEAD;
in if headExists
then (let
matches = builtins.match "ref: refs/heads/(.*)\n" headContent;
in if matches != null
then builtins.readFile ./.git/refs/heads/${builtins.elemAt matches 0}
else headContent)
else "unknown"),
2024-03-04 05:04:29 -08:00
debug ? false,
withJemalloc ? true, # masks heap fragmentation
withQtSvg ? true,
withWayland ? true,
withX11 ? true,
withPipewire ? true,
2024-06-17 18:32:13 -07:00
withPam ? true,
withHyprland ? true,
}: buildStdenv.mkDerivation {
2024-03-04 05:04:29 -08:00
pname = "quickshell${lib.optionalString debug "-debug"}";
2024-03-04 05:49:37 -08:00
version = "0.1.0";
src = nix-gitignore.gitignoreSource "/docs\n/examples\n" ./.;
2024-03-04 05:04:29 -08:00
nativeBuildInputs = with pkgs; [
cmake
ninja
qt6.wrapQtAppsHook
pkg-config
] ++ (lib.optionals withWayland [
2024-03-04 05:04:29 -08:00
wayland-protocols
wayland-scanner
]);
2024-05-20 02:16:44 -07:00
buildInputs = [
2024-03-04 05:04:29 -08:00
qt6.qtbase
qt6.qtdeclarative
cli11
2024-04-19 02:46:38 -07:00
]
++ (lib.optional withJemalloc jemalloc)
++ (lib.optional withQtSvg qt6.qtsvg)
++ (lib.optionals withWayland [ qt6.qtwayland wayland ])
++ (lib.optional withX11 xorg.libxcb)
2024-06-17 18:32:13 -07:00
++ (lib.optional withPam pam)
++ (lib.optional withPipewire pipewire);
2024-03-04 05:04:29 -08:00
QTWAYLANDSCANNER = lib.optionalString withWayland "${qt6.qtwayland}/libexec/qtwaylandscanner";
2024-03-04 05:04:29 -08:00
cmakeBuildType = if debug then "Debug" else "RelWithDebInfo";
2024-03-04 05:04:29 -08:00
cmakeFlags = [ "-DGIT_REVISION=${gitRev}" ]
++ lib.optional (!withJemalloc) "-DUSE_JEMALLOC=OFF"
++ lib.optional (!withWayland) "-DWAYLAND=OFF"
++ lib.optional (!withPipewire) "-DSERVICE_PIPEWIRE=OFF"
2024-06-17 18:32:13 -07:00
++ lib.optional (!withPam) "-DSERVICE_PAM=OFF"
++ lib.optional (!withHyprland) "-DHYPRLAND=OFF";
2024-03-04 05:04:29 -08:00
buildPhase = "ninjaBuildPhase";
enableParallelBuilding = true;
# How to get debuginfo in gdb from a release build:
# 1. build `quickshell.debug`
# 2. set NIX_DEBUG_INFO_DIRS="<quickshell.debug store path>/lib/debug"
# 3. launch gdb / coredumpctl and debuginfo will work
separateDebugInfo = !debug;
dontStrip = debug;
2024-03-04 05:04:29 -08:00
meta = with lib; {
homepage = "https://git.outfoxxed.me/outfoxxed/quickshell";
description = "Simple and flexbile QtQuick based desktop shell toolkit";
2024-03-04 05:49:37 -08:00
license = licenses.lgpl3Only;
2024-03-04 05:04:29 -08:00
platforms = platforms.linux;
};
}