nix: add debug package

Also use clangStdenv to build Use RelWithDebInfo for release builds
This commit is contained in:
Soramane 2025-08-31 10:43:49 +10:00
parent c72338655f
commit 49cabbd4cc
2 changed files with 12 additions and 4 deletions

View file

@ -31,6 +31,7 @@
packages = forAllSystems (pkgs: rec { packages = forAllSystems (pkgs: rec {
caelestia-shell = pkgs.callPackage ./nix { caelestia-shell = pkgs.callPackage ./nix {
rev = self.rev or self.dirtyRev; rev = self.rev or self.dirtyRev;
stdenv = pkgs.clangStdenv;
quickshell = inputs.quickshell.packages.${pkgs.system}.default.override { quickshell = inputs.quickshell.packages.${pkgs.system}.default.override {
withX11 = false; withX11 = false;
withI3 = false; withI3 = false;
@ -39,6 +40,7 @@
caelestia-cli = inputs.caelestia-cli.packages.${pkgs.system}.default; caelestia-cli = inputs.caelestia-cli.packages.${pkgs.system}.default;
}; };
with-cli = caelestia-shell.override {withCli = true;}; with-cli = caelestia-shell.override {withCli = true;};
debug = caelestia-shell.override {debug = true;};
default = caelestia-shell; default = caelestia-shell;
}); });

View file

@ -33,6 +33,7 @@
ninja, ninja,
pkg-config, pkg-config,
caelestia-cli, caelestia-cli,
debug ? false,
withCli ? false, withCli ? false,
extraRuntimeDeps ? [], extraRuntimeDeps ? [],
}: let }: let
@ -72,7 +73,7 @@
]; ];
assets = stdenv.mkDerivation { assets = stdenv.mkDerivation {
name = "caelestia-assets"; name = "caelestia-assets${lib.optionalString debug "-debug"}";
src = lib.fileset.toSource { src = lib.fileset.toSource {
root = ./..; root = ./..;
fileset = lib.fileset.union ./../CMakeLists.txt ./../assets/cpp; fileset = lib.fileset.union ./../CMakeLists.txt ./../assets/cpp;
@ -90,7 +91,7 @@
}; };
plugin = stdenv.mkDerivation { plugin = stdenv.mkDerivation {
name = "caelestia-qml-plugin"; name = "caelestia-qml-plugin${lib.optionalString debug "-debug"}";
src = lib.fileset.toSource { src = lib.fileset.toSource {
root = ./..; root = ./..;
fileset = lib.fileset.union ./../CMakeLists.txt ./../plugin; fileset = lib.fileset.union ./../CMakeLists.txt ./../plugin;
@ -110,14 +111,17 @@
in in
stdenv.mkDerivation { stdenv.mkDerivation {
inherit version; inherit version;
pname = "caelestia-shell"; pname = "caelestia-shell${lib.optionalString debug "-debug"}";
src = ./..; src = ./..;
nativeBuildInputs = [cmake ninja makeWrapper qt6.wrapQtAppsHook]; nativeBuildInputs = [cmake ninja makeWrapper qt6.wrapQtAppsHook];
buildInputs = [quickshell assets plugin xkeyboard-config qt6.qtbase]; buildInputs = [quickshell assets plugin xkeyboard-config qt6.qtbase];
propagatedBuildInputs = runtimeDeps; propagatedBuildInputs = runtimeDeps;
cmakeBuildType = "Release"; cmakeBuildType =
if debug
then "Debug"
else "RelWithDebInfo";
cmakeFlags = cmakeFlags =
[ [
(lib.cmakeFeature "ENABLE_MODULES" "shell") (lib.cmakeFeature "ENABLE_MODULES" "shell")
@ -125,6 +129,8 @@ in
] ]
++ cmakeVersionFlags; ++ cmakeVersionFlags;
dontStrip = debug;
prePatch = '' prePatch = ''
substituteInPlace assets/pam.d/fprint \ substituteInPlace assets/pam.d/fprint \
--replace-fail pam_fprintd.so /run/current-system/sw/lib/security/pam_fprintd.so --replace-fail pam_fprintd.so /run/current-system/sw/lib/security/pam_fprintd.so