|
1 | 1 | { |
2 | | - lib, |
3 | | - nix-gitignore, |
4 | | - pkgs, |
5 | | - stdenv, |
6 | | - keepDebugInfo, |
7 | | - |
8 | | - pkg-config, |
9 | | - cmake, |
10 | | - ninja, |
11 | | - spirv-tools, |
| 2 | + callPackage, |
| 3 | + quickshell-unwrapped ? callPackage ./unwrapped.nix {}, |
12 | 4 | 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 | | -}: let |
47 | | - unwrapped = stdenv.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 | | - spirv-tools |
58 | | - pkg-config |
59 | | - ] |
60 | | - ++ lib.optionals withWayland [ |
61 | | - qt6.qtwayland # qtwaylandscanner required at build time |
62 | | - wayland-scanner |
63 | | - ]; |
64 | | - |
65 | | - buildInputs = [ |
66 | | - qt6.qtbase |
67 | | - qt6.qtdeclarative |
68 | | - cli11 |
69 | | - ] |
70 | | - ++ lib.optional withQtSvg qt6.qtsvg |
71 | | - ++ lib.optional withCrashReporter breakpad |
72 | | - ++ lib.optional withJemalloc jemalloc |
73 | | - ++ lib.optionals withWayland [ qt6.qtwayland wayland wayland-protocols ] |
74 | | - ++ lib.optionals (withWayland && libgbm != null) [ libdrm libgbm ] |
75 | | - ++ lib.optional withX11 xorg.libxcb |
76 | | - ++ lib.optional withPam pam |
77 | | - ++ lib.optional withPipewire pipewire; |
78 | | - |
79 | | - cmakeBuildType = if debug then "Debug" else "RelWithDebInfo"; |
80 | | - |
81 | | - cmakeFlags = [ |
82 | | - (lib.cmakeFeature "DISTRIBUTOR" "Official-Nix-Flake") |
83 | | - (lib.cmakeFeature "INSTALL_QML_PREFIX" qt6.qtbase.qtQmlPrefix) |
84 | | - (lib.cmakeBool "DISTRIBUTOR_DEBUGINFO_AVAILABLE" true) |
85 | | - (lib.cmakeFeature "GIT_REVISION" gitRev) |
86 | | - (lib.cmakeBool "CRASH_REPORTER" withCrashReporter) |
87 | | - (lib.cmakeBool "USE_JEMALLOC" withJemalloc) |
88 | | - (lib.cmakeBool "WAYLAND" withWayland) |
89 | | - (lib.cmakeBool "SCREENCOPY" (libgbm != null)) |
90 | | - (lib.cmakeBool "SERVICE_PIPEWIRE" withPipewire) |
91 | | - (lib.cmakeBool "SERVICE_PAM" withPam) |
92 | | - (lib.cmakeBool "HYPRLAND" withHyprland) |
93 | | - (lib.cmakeBool "I3" withI3) |
94 | | - ]; |
95 | | - |
96 | | - # How to get debuginfo in gdb from a release build: |
97 | | - # 1. build `quickshell.debug` |
98 | | - # 2. set NIX_DEBUG_INFO_DIRS="<quickshell.debug store path>/lib/debug" |
99 | | - # 3. launch gdb / coredumpctl and debuginfo will work |
100 | | - separateDebugInfo = !debug; |
101 | | - dontStrip = debug; |
102 | | - |
103 | | - meta = with lib; { |
104 | | - homepage = "https://quickshell.org"; |
105 | | - description = "Flexbile QtQuick based desktop shell toolkit"; |
106 | | - license = licenses.lgpl3Only; |
107 | | - platforms = platforms.linux; |
108 | | - mainProgram = "quickshell"; |
109 | | - }; |
110 | | - }; |
111 | | - |
112 | | - wrapper = unwrapped.stdenv.mkDerivation { |
113 | | - inherit (unwrapped) version meta buildInputs; |
114 | | - pname = "${unwrapped.pname}-wrapped"; |
115 | | - |
116 | | - nativeBuildInputs = unwrapped.nativeBuildInputs ++ [ qt6.wrapQtAppsHook ]; |
117 | | - |
118 | | - dontUnpack = true; |
119 | | - dontConfigure = true; |
120 | | - dontBuild = true; |
121 | | - |
122 | | - installPhase = '' |
123 | | - mkdir -p $out |
124 | | - cp -r ${unwrapped}/* $out |
125 | | - ''; |
126 | | - |
127 | | - passthru = { |
128 | | - unwrapped = unwrapped; |
129 | | - withModules = modules: wrapper.overrideAttrs (prev: { |
130 | | - buildInputs = prev.buildInputs ++ modules; |
131 | | - }); |
132 | | - }; |
| 5 | +}: quickshell-unwrapped.stdenv.mkDerivation (final: { |
| 6 | + inherit (quickshell-unwrapped) version meta buildInputs; |
| 7 | + pname = "${quickshell-unwrapped.pname}-wrapped"; |
| 8 | + |
| 9 | + nativeBuildInputs = quickshell-unwrapped.nativeBuildInputs ++ [ qt6.wrapQtAppsHook ]; |
| 10 | + |
| 11 | + dontUnpack = true; |
| 12 | + dontConfigure = true; |
| 13 | + dontBuild = true; |
| 14 | + |
| 15 | + installPhase = '' |
| 16 | + mkdir -p $out |
| 17 | + cp -r ${quickshell-unwrapped}/* $out |
| 18 | + ''; |
| 19 | + |
| 20 | + passthru = { |
| 21 | + unwrapped = quickshell-unwrapped; |
| 22 | + withModules = modules: final.finalPackage.overrideAttrs (prev: { |
| 23 | + buildInputs = prev.buildInputs ++ modules; |
| 24 | + }); |
133 | 25 | }; |
134 | | -in wrapper |
| 26 | +}) |
0 commit comments