mirror of
https://github.com/belsabbagh/dotfiles.git
synced 2026-04-11 09:36:46 +00:00
quickshell and hyprland additions
This commit is contained in:
14
.config/quickshell/caelestia/nix/app2unit.nix
Normal file
14
.config/quickshell/caelestia/nix/app2unit.nix
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
pkgs, # To ensure the nixpkgs version of app2unit
|
||||
fetchFromGitHub,
|
||||
...
|
||||
}:
|
||||
pkgs.app2unit.overrideAttrs (final: prev: rec {
|
||||
version = "1.0.3"; # Fix old issue related to missing env var
|
||||
src = fetchFromGitHub {
|
||||
owner = "Vladimir-csp";
|
||||
repo = "app2unit";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-7eEVjgs+8k+/NLteSBKgn4gPaPLHC+3Uzlmz6XB0930=";
|
||||
};
|
||||
})
|
||||
158
.config/quickshell/caelestia/nix/default.nix
Normal file
158
.config/quickshell/caelestia/nix/default.nix
Normal file
@@ -0,0 +1,158 @@
|
||||
{
|
||||
rev,
|
||||
lib,
|
||||
stdenv,
|
||||
makeWrapper,
|
||||
makeFontsConf,
|
||||
fish,
|
||||
ddcutil,
|
||||
brightnessctl,
|
||||
app2unit,
|
||||
networkmanager,
|
||||
lm_sensors,
|
||||
swappy,
|
||||
wl-clipboard,
|
||||
libqalculate,
|
||||
bash,
|
||||
hyprland,
|
||||
material-symbols,
|
||||
rubik,
|
||||
nerd-fonts,
|
||||
qt6,
|
||||
quickshell,
|
||||
aubio,
|
||||
libcava,
|
||||
fftw,
|
||||
pipewire,
|
||||
xkeyboard-config,
|
||||
cmake,
|
||||
ninja,
|
||||
pkg-config,
|
||||
caelestia-cli,
|
||||
debug ? false,
|
||||
withCli ? false,
|
||||
extraRuntimeDeps ? [],
|
||||
}: let
|
||||
version = "1.0.0";
|
||||
|
||||
runtimeDeps =
|
||||
[
|
||||
fish
|
||||
ddcutil
|
||||
brightnessctl
|
||||
app2unit
|
||||
networkmanager
|
||||
lm_sensors
|
||||
swappy
|
||||
wl-clipboard
|
||||
libqalculate
|
||||
bash
|
||||
hyprland
|
||||
]
|
||||
++ extraRuntimeDeps
|
||||
++ lib.optional withCli caelestia-cli;
|
||||
|
||||
fontconfig = makeFontsConf {
|
||||
fontDirectories = [material-symbols rubik nerd-fonts.caskaydia-cove];
|
||||
};
|
||||
|
||||
cmakeBuildType =
|
||||
if debug
|
||||
then "Debug"
|
||||
else "RelWithDebInfo";
|
||||
|
||||
cmakeVersionFlags = [
|
||||
(lib.cmakeFeature "VERSION" version)
|
||||
(lib.cmakeFeature "GIT_REVISION" rev)
|
||||
(lib.cmakeFeature "DISTRIBUTOR" "nix-flake")
|
||||
];
|
||||
|
||||
extras = stdenv.mkDerivation {
|
||||
inherit cmakeBuildType;
|
||||
name = "caelestia-extras${lib.optionalString debug "-debug"}";
|
||||
src = lib.fileset.toSource {
|
||||
root = ./..;
|
||||
fileset = lib.fileset.union ./../CMakeLists.txt ./../extras;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [cmake ninja];
|
||||
|
||||
cmakeFlags =
|
||||
[
|
||||
(lib.cmakeFeature "ENABLE_MODULES" "extras")
|
||||
(lib.cmakeFeature "INSTALL_LIBDIR" "${placeholder "out"}/lib")
|
||||
]
|
||||
++ cmakeVersionFlags;
|
||||
};
|
||||
|
||||
plugin = stdenv.mkDerivation {
|
||||
inherit cmakeBuildType;
|
||||
name = "caelestia-qml-plugin${lib.optionalString debug "-debug"}";
|
||||
src = lib.fileset.toSource {
|
||||
root = ./..;
|
||||
fileset = lib.fileset.union ./../CMakeLists.txt ./../plugin;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [cmake ninja pkg-config];
|
||||
buildInputs = [qt6.qtbase qt6.qtdeclarative libqalculate pipewire aubio libcava fftw];
|
||||
|
||||
dontWrapQtApps = true;
|
||||
cmakeFlags =
|
||||
[
|
||||
(lib.cmakeFeature "ENABLE_MODULES" "plugin")
|
||||
(lib.cmakeFeature "INSTALL_QMLDIR" qt6.qtbase.qtQmlPrefix)
|
||||
]
|
||||
++ cmakeVersionFlags;
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
inherit version cmakeBuildType;
|
||||
pname = "caelestia-shell${lib.optionalString debug "-debug"}";
|
||||
src = ./..;
|
||||
|
||||
nativeBuildInputs = [cmake ninja makeWrapper qt6.wrapQtAppsHook];
|
||||
buildInputs = [quickshell extras plugin xkeyboard-config qt6.qtbase];
|
||||
propagatedBuildInputs = runtimeDeps;
|
||||
|
||||
cmakeFlags =
|
||||
[
|
||||
(lib.cmakeFeature "ENABLE_MODULES" "shell")
|
||||
(lib.cmakeFeature "INSTALL_QSCONFDIR" "${placeholder "out"}/share/caelestia-shell")
|
||||
]
|
||||
++ cmakeVersionFlags;
|
||||
|
||||
dontStrip = debug;
|
||||
|
||||
prePatch = ''
|
||||
substituteInPlace assets/pam.d/fprint \
|
||||
--replace-fail pam_fprintd.so /run/current-system/sw/lib/security/pam_fprintd.so
|
||||
substituteInPlace shell.qml \
|
||||
--replace-fail 'ShellRoot {' 'ShellRoot { settings.watchFiles: false'
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
makeWrapper ${quickshell}/bin/qs $out/bin/caelestia-shell \
|
||||
--prefix PATH : "${lib.makeBinPath runtimeDeps}" \
|
||||
--set FONTCONFIG_FILE "${fontconfig}" \
|
||||
--set CAELESTIA_LIB_DIR ${extras}/lib \
|
||||
--set CAELESTIA_XKB_RULES_PATH ${xkeyboard-config}/share/xkeyboard-config-2/rules/base.lst \
|
||||
--add-flags "-p $out/share/caelestia-shell"
|
||||
|
||||
mkdir -p $out/lib
|
||||
ln -s ${extras}/lib/* $out/lib/
|
||||
|
||||
# Ensure wrap_term_launch.sh is executable
|
||||
chmod 755 $out/share/caelestia-shell/assets/wrap_term_launch.sh
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit plugin extras;
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "A very segsy desktop shell";
|
||||
homepage = "https://github.com/caelestia-dots/shell";
|
||||
license = lib.licenses.gpl3Only;
|
||||
mainProgram = "caelestia-shell";
|
||||
};
|
||||
}
|
||||
136
.config/quickshell/caelestia/nix/hm-module.nix
Normal file
136
.config/quickshell/caelestia/nix/hm-module.nix
Normal file
@@ -0,0 +1,136 @@
|
||||
self: {
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (pkgs.stdenv.hostPlatform) system;
|
||||
|
||||
cli-default = self.inputs.caelestia-cli.packages.${system}.default;
|
||||
shell-default = self.packages.${system}.with-cli;
|
||||
|
||||
cfg = config.programs.caelestia;
|
||||
in {
|
||||
imports = [
|
||||
(lib.mkRenamedOptionModule ["programs" "caelestia" "environment"] ["programs" "caelestia" "systemd" "environment"])
|
||||
];
|
||||
options = with lib; {
|
||||
programs.caelestia = {
|
||||
enable = mkEnableOption "Enable Caelestia shell";
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = shell-default;
|
||||
description = "The package of Caelestia shell";
|
||||
};
|
||||
systemd = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable the systemd service for Caelestia shell";
|
||||
};
|
||||
target = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
The systemd target that will automatically start the Caelestia shell.
|
||||
'';
|
||||
default = config.wayland.systemd.target;
|
||||
};
|
||||
environment = mkOption {
|
||||
type = types.listOf types.str;
|
||||
description = "Extra Environment variables to pass to the Caelestia shell systemd service.";
|
||||
default = [];
|
||||
example = [
|
||||
"QT_QPA_PLATFORMTHEME=gtk3"
|
||||
];
|
||||
};
|
||||
};
|
||||
settings = mkOption {
|
||||
type = types.attrsOf types.anything;
|
||||
default = {};
|
||||
description = "Caelestia shell settings";
|
||||
};
|
||||
extraConfig = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
description = "Caelestia shell extra configs written to shell.json";
|
||||
};
|
||||
cli = {
|
||||
enable = mkEnableOption "Enable Caelestia CLI";
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = cli-default;
|
||||
description = "The package of Caelestia CLI"; # Doesn't override the shell's CLI, only change from home.packages
|
||||
};
|
||||
settings = mkOption {
|
||||
type = types.attrsOf types.anything;
|
||||
default = {};
|
||||
description = "Caelestia CLI settings";
|
||||
};
|
||||
extraConfig = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
description = "Caelestia CLI extra configs written to cli.json";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
cli = cfg.cli.package;
|
||||
shell = cfg.package;
|
||||
in
|
||||
lib.mkIf cfg.enable {
|
||||
systemd.user.services.caelestia = lib.mkIf cfg.systemd.enable {
|
||||
Unit = {
|
||||
Description = "Caelestia Shell Service";
|
||||
After = [cfg.systemd.target];
|
||||
PartOf = [cfg.systemd.target];
|
||||
X-Restart-Triggers = lib.mkIf (cfg.settings != {}) [
|
||||
"${config.xdg.configFile."caelestia/shell.json".source}"
|
||||
];
|
||||
};
|
||||
|
||||
Service = {
|
||||
Type = "exec";
|
||||
ExecStart = "${shell}/bin/caelestia-shell";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "5s";
|
||||
TimeoutStopSec = "5s";
|
||||
Environment =
|
||||
[
|
||||
"QT_QPA_PLATFORM=wayland"
|
||||
]
|
||||
++ cfg.systemd.environment;
|
||||
|
||||
Slice = "session.slice";
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [cfg.systemd.target];
|
||||
};
|
||||
};
|
||||
|
||||
xdg.configFile = let
|
||||
mkConfig = c:
|
||||
lib.pipe (
|
||||
if c.extraConfig != ""
|
||||
then c.extraConfig
|
||||
else "{}"
|
||||
) [
|
||||
builtins.fromJSON
|
||||
(lib.recursiveUpdate c.settings)
|
||||
builtins.toJSON
|
||||
];
|
||||
shouldGenerate = c: c.extraConfig != "" || c.settings != {};
|
||||
in {
|
||||
"caelestia/shell.json" = lib.mkIf (shouldGenerate cfg) {
|
||||
text = mkConfig cfg;
|
||||
};
|
||||
"caelestia/cli.json" = lib.mkIf (shouldGenerate cfg.cli) {
|
||||
text = mkConfig cfg.cli;
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = [shell] ++ lib.optional cfg.cli.enable cli;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user