2024-03-04 05:04:29 -08:00
|
|
|
{
|
|
|
|
|
lib,
|
|
|
|
|
nix-gitignore,
|
|
|
|
|
pkgs,
|
2025-09-28 20:24:43 -07:00
|
|
|
stdenv,
|
2024-03-04 05:04:29 -08:00
|
|
|
keepDebugInfo,
|
|
|
|
|
|
2025-06-12 04:48:09 -07:00
|
|
|
pkg-config,
|
2024-03-04 05:04:29 -08:00
|
|
|
cmake,
|
|
|
|
|
ninja,
|
2024-11-17 17:05:44 -08:00
|
|
|
spirv-tools,
|
2025-06-12 04:48:09 -07:00
|
|
|
qt6,
|
2026-03-02 08:09:57 -08:00
|
|
|
cpptrace ? null,
|
|
|
|
|
libunwind,
|
|
|
|
|
libdwarf,
|
2024-05-31 01:28:35 -07:00
|
|
|
jemalloc,
|
2025-06-12 04:48:09 -07:00
|
|
|
cli11,
|
2024-03-04 05:04:29 -08:00
|
|
|
wayland,
|
|
|
|
|
wayland-protocols,
|
2025-06-12 04:48:09 -07:00
|
|
|
wayland-scanner,
|
|
|
|
|
xorg,
|
2026-02-09 22:03:45 +08:00
|
|
|
libxcb ? xorg.libxcb,
|
2025-01-14 04:43:05 -08:00
|
|
|
libdrm,
|
|
|
|
|
libgbm ? null,
|
2026-02-09 18:20:14 +01:00
|
|
|
vulkan-headers,
|
2024-05-20 02:16:44 -07:00
|
|
|
pipewire,
|
2024-06-17 18:32:13 -07:00
|
|
|
pam,
|
2025-10-09 23:50:08 +02:00
|
|
|
polkit,
|
|
|
|
|
glib,
|
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-27 00:44:13 -07:00
|
|
|
|
2024-03-04 05:04:29 -08:00
|
|
|
debug ? false,
|
2024-08-20 00:41:20 -07:00
|
|
|
withCrashReporter ? true,
|
2024-05-31 01:28:35 -07:00
|
|
|
withJemalloc ? true, # masks heap fragmentation
|
2024-06-02 15:37:47 -07:00
|
|
|
withQtSvg ? true,
|
|
|
|
|
withWayland ? true,
|
|
|
|
|
withX11 ? true,
|
|
|
|
|
withPipewire ? true,
|
2024-06-17 18:32:13 -07:00
|
|
|
withPam ? true,
|
2024-06-02 15:37:47 -07:00
|
|
|
withHyprland ? true,
|
2024-11-02 03:52:27 +01:00
|
|
|
withI3 ? true,
|
2025-10-09 23:50:08 +02:00
|
|
|
withPolkit ? true,
|
2025-07-03 13:06:21 -05:00
|
|
|
withNetworkManager ? true,
|
2025-07-18 14:43:09 +04:00
|
|
|
}: let
|
2026-03-02 08:09:57 -08:00
|
|
|
withCrashHandler = withCrashReporter && cpptrace != null && lib.strings.compareVersions cpptrace.version "0.7.2" >= 0;
|
|
|
|
|
|
2025-09-28 20:24:43 -07:00
|
|
|
unwrapped = stdenv.mkDerivation {
|
2025-07-18 14:43:09 +04:00
|
|
|
pname = "quickshell${lib.optionalString debug "-debug"}";
|
2026-05-03 22:09:49 -07:00
|
|
|
version = "0.3.0";
|
2025-07-18 14:43:09 +04:00
|
|
|
src = nix-gitignore.gitignoreSource "/default.nix\n" ./.;
|
2024-03-04 05:04:29 -08:00
|
|
|
|
2025-07-18 14:43:09 +04:00
|
|
|
dontWrapQtApps = true; # see wrappers
|
2024-03-04 05:04:29 -08:00
|
|
|
|
2025-07-18 14:43:09 +04:00
|
|
|
nativeBuildInputs = [
|
|
|
|
|
cmake
|
|
|
|
|
ninja
|
|
|
|
|
spirv-tools
|
|
|
|
|
pkg-config
|
|
|
|
|
]
|
2025-10-04 12:49:36 -07:00
|
|
|
++ lib.optional (withWayland && lib.strings.compareVersions qt6.qtbase.version "6.10.0" == -1) qt6.qtwayland
|
2025-09-28 18:55:45 -07:00
|
|
|
++ lib.optionals withWayland [
|
|
|
|
|
qt6.qtwayland # qtwaylandscanner required at build time
|
|
|
|
|
wayland-scanner
|
|
|
|
|
];
|
2024-03-04 05:04:29 -08:00
|
|
|
|
2025-07-18 14:43:09 +04:00
|
|
|
buildInputs = [
|
|
|
|
|
qt6.qtbase
|
|
|
|
|
qt6.qtdeclarative
|
2026-03-14 02:31:47 -07:00
|
|
|
libdrm
|
2025-07-18 14:43:09 +04:00
|
|
|
cli11
|
|
|
|
|
]
|
|
|
|
|
++ lib.optional withQtSvg qt6.qtsvg
|
2026-03-02 08:09:57 -08:00
|
|
|
++ lib.optional withCrashHandler (cpptrace.overrideAttrs (prev: {
|
|
|
|
|
cmakeFlags = prev.cmakeFlags ++ [
|
|
|
|
|
"-DCPPTRACE_UNWIND_WITH_LIBUNWIND=TRUE"
|
|
|
|
|
];
|
|
|
|
|
buildInputs = prev.buildInputs ++ [ libunwind ];
|
|
|
|
|
}))
|
2025-07-18 14:43:09 +04:00
|
|
|
++ lib.optional withJemalloc jemalloc
|
2025-10-04 12:49:36 -07:00
|
|
|
++ lib.optional (withWayland && lib.strings.compareVersions qt6.qtbase.version "6.10.0" == -1) qt6.qtwayland
|
|
|
|
|
++ lib.optionals withWayland [ wayland wayland-protocols ]
|
2026-03-14 02:31:47 -07:00
|
|
|
++ lib.optionals (withWayland && libgbm != null) [ libgbm vulkan-headers ]
|
2026-02-09 22:03:45 +08:00
|
|
|
++ lib.optional withX11 libxcb
|
2025-07-18 14:43:09 +04:00
|
|
|
++ lib.optional withPam pam
|
2025-10-09 23:50:08 +02:00
|
|
|
++ lib.optional withPipewire pipewire
|
|
|
|
|
++ lib.optionals withPolkit [ polkit glib ];
|
2024-03-04 05:04:29 -08:00
|
|
|
|
2025-07-18 14:43:09 +04:00
|
|
|
cmakeBuildType = if debug then "Debug" else "RelWithDebInfo";
|
2024-08-02 13:56:30 -07:00
|
|
|
|
2025-07-18 14:43:09 +04:00
|
|
|
cmakeFlags = [
|
|
|
|
|
(lib.cmakeFeature "DISTRIBUTOR" "Official-Nix-Flake")
|
|
|
|
|
(lib.cmakeFeature "INSTALL_QML_PREFIX" qt6.qtbase.qtQmlPrefix)
|
|
|
|
|
(lib.cmakeBool "DISTRIBUTOR_DEBUGINFO_AVAILABLE" true)
|
|
|
|
|
(lib.cmakeFeature "GIT_REVISION" gitRev)
|
2026-03-02 08:09:57 -08:00
|
|
|
(lib.cmakeBool "CRASH_HANDLER" withCrashHandler)
|
2025-07-18 14:43:09 +04:00
|
|
|
(lib.cmakeBool "USE_JEMALLOC" withJemalloc)
|
|
|
|
|
(lib.cmakeBool "WAYLAND" withWayland)
|
|
|
|
|
(lib.cmakeBool "SCREENCOPY" (libgbm != null))
|
|
|
|
|
(lib.cmakeBool "SERVICE_PIPEWIRE" withPipewire)
|
|
|
|
|
(lib.cmakeBool "SERVICE_PAM" withPam)
|
2025-07-03 13:06:21 -05:00
|
|
|
(lib.cmakeBool "SERVICE_NETWORKMANAGER" withNetworkManager)
|
2025-10-09 23:50:08 +02:00
|
|
|
(lib.cmakeBool "SERVICE_POLKIT" withPolkit)
|
2025-07-18 14:43:09 +04:00
|
|
|
(lib.cmakeBool "HYPRLAND" withHyprland)
|
|
|
|
|
(lib.cmakeBool "I3" withI3)
|
|
|
|
|
];
|
2024-03-04 05:04:29 -08:00
|
|
|
|
2025-07-18 14:43:09 +04: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;
|
|
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
|
homepage = "https://quickshell.org";
|
|
|
|
|
description = "Flexbile QtQuick based desktop shell toolkit";
|
|
|
|
|
license = licenses.lgpl3Only;
|
|
|
|
|
platforms = platforms.linux;
|
|
|
|
|
mainProgram = "quickshell";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
wrapper = unwrapped.stdenv.mkDerivation {
|
|
|
|
|
inherit (unwrapped) version meta buildInputs;
|
|
|
|
|
pname = "${unwrapped.pname}-wrapped";
|
|
|
|
|
|
|
|
|
|
nativeBuildInputs = unwrapped.nativeBuildInputs ++ [ qt6.wrapQtAppsHook ];
|
|
|
|
|
|
|
|
|
|
dontUnpack = true;
|
|
|
|
|
dontConfigure = true;
|
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
|
|
installPhase = ''
|
2025-07-18 17:58:20 -07:00
|
|
|
mkdir -p $out
|
|
|
|
|
cp -r ${unwrapped}/* $out
|
2025-07-18 14:43:09 +04:00
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
|
unwrapped = unwrapped;
|
|
|
|
|
withModules = modules: wrapper.overrideAttrs (prev: {
|
|
|
|
|
buildInputs = prev.buildInputs ++ modules;
|
|
|
|
|
});
|
|
|
|
|
};
|
2024-03-04 05:04:29 -08:00
|
|
|
};
|
2025-07-18 14:43:09 +04:00
|
|
|
in wrapper
|