|
1 | 1 | {
|
| 2 | + callPackage, |
2 | 3 | lib,
|
3 |
| - nix-gitignore, |
4 |
| - pkgs, |
5 |
| - keepDebugInfo, |
6 |
| - buildStdenv ? pkgs.clangStdenv, |
7 |
| - |
8 |
| - pkg-config, |
9 |
| - cmake, |
10 |
| - ninja, |
11 |
| - spirv-tools, |
| 4 | + quickshell-unwrapped ? callPackage ./unwrapped.nix {}, |
12 | 5 | qt6,
|
13 |
| - breakpad, |
14 |
| - jemalloc, |
15 |
| - cli11, |
16 |
| - wayland, |
17 |
| - wayland-protocols, |
18 |
| - wayland-scanner, |
19 |
| - xorg, |
20 |
| - libdrm, |
21 |
| - libgbm ? null, |
22 |
| - pipewire, |
23 |
| - pam, |
24 |
| - |
25 |
| - gitRev ? (let |
26 |
| - headExists = builtins.pathExists ./.git/HEAD; |
27 |
| - headContent = builtins.readFile ./.git/HEAD; |
28 |
| - in if headExists |
29 |
| - then (let |
30 |
| - matches = builtins.match "ref: refs/heads/(.*)\n" headContent; |
31 |
| - in if matches != null |
32 |
| - then builtins.readFile ./.git/refs/heads/${builtins.elemAt matches 0} |
33 |
| - else headContent) |
34 |
| - else "unknown"), |
35 |
| - |
36 |
| - debug ? false, |
37 |
| - withCrashReporter ? true, |
38 |
| - withJemalloc ? true, # masks heap fragmentation |
39 |
| - withQtSvg ? true, |
40 |
| - withWayland ? true, |
41 |
| - withX11 ? true, |
42 |
| - withPipewire ? true, |
43 |
| - withPam ? true, |
44 |
| - withHyprland ? true, |
45 |
| - withI3 ? true, |
46 | 6 | }: let
|
47 |
| - unwrapped = buildStdenv.mkDerivation { |
48 |
| - pname = "quickshell${lib.optionalString debug "-debug"}"; |
49 |
| - version = "0.2.0"; |
50 |
| - src = nix-gitignore.gitignoreSource "/default.nix\n" ./.; |
51 |
| - |
52 |
| - dontWrapQtApps = true; # see wrappers |
53 |
| - |
54 |
| - nativeBuildInputs = [ |
55 |
| - cmake |
56 |
| - ninja |
57 |
| - qt6.qtshadertools |
58 |
| - spirv-tools |
59 |
| - pkg-config |
60 |
| - ] |
61 |
| - ++ lib.optional withWayland wayland-scanner; |
62 |
| - |
63 |
| - buildInputs = [ |
64 |
| - qt6.qtbase |
65 |
| - qt6.qtdeclarative |
66 |
| - cli11 |
67 |
| - ] |
68 |
| - ++ lib.optional withQtSvg qt6.qtsvg |
69 |
| - ++ lib.optional withCrashReporter breakpad |
70 |
| - ++ lib.optional withJemalloc jemalloc |
71 |
| - ++ lib.optionals withWayland [ qt6.qtwayland wayland wayland-protocols ] |
72 |
| - ++ lib.optionals (withWayland && libgbm != null) [ libdrm libgbm ] |
73 |
| - ++ lib.optional withX11 xorg.libxcb |
74 |
| - ++ lib.optional withPam pam |
75 |
| - ++ lib.optional withPipewire pipewire; |
76 |
| - |
77 |
| - cmakeBuildType = if debug then "Debug" else "RelWithDebInfo"; |
78 |
| - |
79 |
| - cmakeFlags = [ |
80 |
| - (lib.cmakeFeature "DISTRIBUTOR" "Official-Nix-Flake") |
81 |
| - (lib.cmakeFeature "INSTALL_QML_PREFIX" qt6.qtbase.qtQmlPrefix) |
82 |
| - (lib.cmakeBool "DISTRIBUTOR_DEBUGINFO_AVAILABLE" true) |
83 |
| - (lib.cmakeFeature "GIT_REVISION" gitRev) |
84 |
| - (lib.cmakeBool "CRASH_REPORTER" withCrashReporter) |
85 |
| - (lib.cmakeBool "USE_JEMALLOC" withJemalloc) |
86 |
| - (lib.cmakeBool "WAYLAND" withWayland) |
87 |
| - (lib.cmakeBool "SCREENCOPY" (libgbm != null)) |
88 |
| - (lib.cmakeBool "SERVICE_PIPEWIRE" withPipewire) |
89 |
| - (lib.cmakeBool "SERVICE_PAM" withPam) |
90 |
| - (lib.cmakeBool "HYPRLAND" withHyprland) |
91 |
| - (lib.cmakeBool "I3" withI3) |
92 |
| - ]; |
93 |
| - |
94 |
| - # How to get debuginfo in gdb from a release build: |
95 |
| - # 1. build `quickshell.debug` |
96 |
| - # 2. set NIX_DEBUG_INFO_DIRS="<quickshell.debug store path>/lib/debug" |
97 |
| - # 3. launch gdb / coredumpctl and debuginfo will work |
98 |
| - separateDebugInfo = !debug; |
99 |
| - dontStrip = debug; |
100 |
| - |
101 |
| - meta = with lib; { |
102 |
| - homepage = "https://quickshell.org"; |
103 |
| - description = "Flexbile QtQuick based desktop shell toolkit"; |
104 |
| - license = licenses.lgpl3Only; |
105 |
| - platforms = platforms.linux; |
106 |
| - mainProgram = "quickshell"; |
107 |
| - }; |
108 |
| - }; |
109 |
| - |
110 |
| - wrapper = unwrapped.stdenv.mkDerivation { |
| 7 | + unwrapped = quickshell-unwrapped; |
| 8 | + inherit (unwrapped.stdenv) mkDerivation; |
| 9 | + inherit (lib) typeOf asserts; |
| 10 | +in |
| 11 | + mkDerivation (final: { |
111 | 12 | inherit (unwrapped) version meta buildInputs;
|
112 | 13 | pname = "${unwrapped.pname}-wrapped";
|
113 | 14 |
|
114 |
| - nativeBuildInputs = unwrapped.nativeBuildInputs ++ [ qt6.wrapQtAppsHook ]; |
| 15 | + nativeBuildInputs = unwrapped.nativeBuildInputs ++ [qt6.wrapQtAppsHook]; |
115 | 16 |
|
116 | 17 | dontUnpack = true;
|
117 | 18 | dontConfigure = true;
|
|
123 | 24 | '';
|
124 | 25 |
|
125 | 26 | passthru = {
|
126 |
| - unwrapped = unwrapped; |
127 |
| - withModules = modules: wrapper.overrideAttrs (prev: { |
128 |
| - buildInputs = prev.buildInputs ++ modules; |
129 |
| - }); |
| 27 | + inherit unwrapped; |
| 28 | + withModules = modules: |
| 29 | + assert (asserts.assertMsg (typeOf modules == "list") "`modules` must be a list of packages"); |
| 30 | + final.finalPackage.overrideAttrs (prev: { |
| 31 | + buildInputs = prev.buildInputs ++ modules; |
| 32 | + }); |
130 | 33 | };
|
131 |
| - }; |
132 |
| -in wrapper |
| 34 | + }) |
0 commit comments