quickshell/default.nix

107 lines
2.8 KiB
Nix
Raw Permalink Normal View History

2024-03-04 05:04:29 -08:00
{
lib,
nix-gitignore,
pkgs,
keepDebugInfo,
buildStdenv ? pkgs.clangStdenv,
2024-03-04 05:04:29 -08:00
pkg-config,
2024-03-04 05:04:29 -08:00
cmake,
ninja,
2024-11-17 17:05:44 -08:00
spirv-tools,
qt6,
2024-08-20 00:41:20 -07:00
breakpad,
jemalloc,
cli11,
2024-03-04 05:04:29 -08:00
wayland,
wayland-protocols,
wayland-scanner,
xorg,
2025-01-14 04:43:05 -08:00
libdrm,
libgbm ? null,
2024-05-20 02:16:44 -07:00
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,
2024-08-20 00:41:20 -07:00
withCrashReporter ? true,
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,
withI3 ? 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";
2025-06-15 23:00:56 -07:00
src = nix-gitignore.gitignoreSource [] ./.;
2024-03-04 05:04:29 -08:00
nativeBuildInputs = [
2024-03-04 05:04:29 -08:00
cmake
ninja
2024-11-17 17:05:44 -08:00
qt6.qtshadertools
spirv-tools
2024-03-04 05:04:29 -08:00
qt6.wrapQtAppsHook
pkg-config
2025-06-15 23:00:56 -07:00
]
++ lib.optional withWayland wayland-scanner;
2024-03-04 05:04:29 -08:00
2024-05-20 02:16:44 -07:00
buildInputs = [
2024-03-04 05:04:29 -08:00
qt6.qtbase
qt6.qtdeclarative
2025-06-15 23:00:56 -07:00
cli11
2024-04-19 02:46:38 -07:00
]
2025-06-15 23:00:56 -07:00
++ lib.optional withQtSvg qt6.qtsvg
2024-09-09 03:23:27 -07:00
++ lib.optional withCrashReporter breakpad
++ lib.optional withJemalloc jemalloc
2025-06-15 23:00:56 -07:00
++ lib.optionals withWayland [ qt6.qtwayland wayland wayland-protocols ]
++ lib.optionals (withWayland && libgbm != null) [ libdrm libgbm ]
2024-09-09 03:23:27 -07:00
++ lib.optional withX11 xorg.libxcb
++ lib.optional withPam pam
++ lib.optional withPipewire pipewire;
2024-03-04 05:04:29 -08:00
cmakeBuildType = if debug then "Debug" else "RelWithDebInfo";
2024-03-04 05:04:29 -08:00
2024-09-09 03:23:27 -07:00
cmakeFlags = [
(lib.cmakeFeature "DISTRIBUTOR" "Official-Nix-Flake")
(lib.cmakeFeature "INSTALL_QML_PREFIX" qt6.qtbase.qtQmlPrefix)
(lib.cmakeBool "DISTRIBUTOR_DEBUGINFO_AVAILABLE" true)
2024-09-09 03:23:27 -07:00
(lib.cmakeFeature "GIT_REVISION" gitRev)
(lib.cmakeBool "CRASH_REPORTER" withCrashReporter)
(lib.cmakeBool "USE_JEMALLOC" withJemalloc)
(lib.cmakeBool "WAYLAND" withWayland)
2025-01-14 04:43:05 -08:00
(lib.cmakeBool "SCREENCOPY" (libgbm != null))
2024-09-09 03:23:27 -07:00
(lib.cmakeBool "SERVICE_PIPEWIRE" withPipewire)
(lib.cmakeBool "SERVICE_PAM" withPam)
(lib.cmakeBool "HYPRLAND" withHyprland)
(lib.cmakeBool "I3" withI3)
2024-09-09 03:23:27 -07:00
];
# 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://quickshell.outfoxxed.me";
2024-09-09 03:23:27 -07:00
description = "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;
mainProgram = "quickshell";
2024-03-04 05:04:29 -08:00
};
}