From fb9c6d4950ade1007a9a03bf09b31b7dc222a224 Mon Sep 17 00:00:00 2001
From: Davi Ribeiro <104164579+Markus328@users.noreply.github.com>
Date: Wed, 3 Sep 2025 09:03:01 -0300
Subject: nix/hm: move environment to systemd.environment + refactor (#551)
* nix/hm: environment moved to systemd.environment
* nix/hm: change systemd default target
Follow the home-manager convention for wayland systemd services
* nix/hm: refactor
* readme: refactor configuring section
* readme: fix format
* format
---------
Co-authored-by: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
---
README.md | 74 ++++++++++++++++++++++++++++---------------------------
nix/hm-module.nix | 34 ++++++++++++++-----------
2 files changed, 57 insertions(+), 51 deletions(-)
diff --git a/README.md b/README.md
index 30617ee..0868434 100644
--- a/README.md
+++ b/README.md
@@ -67,7 +67,7 @@ or a devshell. The shell can then be run via `caelestia-shell`.
> The default package does not have the CLI enabled by default, which is required for full funcionality.
> To enable the CLI, use the `with-cli` package.
-For home-manager, you can also use the Caelestia's home manager module (explained in [configuring](https://github.com/caelestia-dots/shell?tab=readme-ov-file#configuring)) that installs and configures the shell and the CLI.
+For home-manager, you can also use the Caelestia's home manager module (explained in [configuring](https://github.com/caelestia-dots/shell?tab=readme-ov-file#home-manager-module)) that installs and configures the shell and the CLI.
### Manual installation
@@ -206,43 +206,14 @@ git pull
All configuration options should be put in `~/.config/caelestia/shell.json`. This file is _not_ created by
default, you must create it manually.
-For NixOS users, a home manager module is also available.
-
-home.nix
-
-```nix
-programs.caelestia = {
- enable = true;
- systemd = {
- enable = false; # if you prefer starting from your compositor
- target = "graphical-session.target";
- };
- settings = {
- bar.status = {
- showBattery = false;
- };
- paths.wallpaperDir = "~/Images";
- };
- environment = [];
- cli = {
- enable = true; # Also add caelestia-cli to path
- settings = {
- theme.enableGtk = false;
- };
- };
-};
-```
-
-The module automatically adds Caelestia shell to the path with **full functionality**. The CLI is not required, however you have the option to enable and configure it.
-
-
+### Example configuration
> [!NOTE]
> The example configuration only includes recommended configuration options. For more advanced customisation
> such as modifying the size of individual items or changing constants in the code, there are some other
> options which can be found in the source files in the `config` directory.
-Example configuration
+Example
```json
{
@@ -420,9 +391,7 @@ The module automatically adds Caelestia shell to the path with **full functional
"audioIncrement": 0.1,
"defaultPlayer": "Spotify",
"gpuType": "",
- "playerAliases": [
- { "from": "com.github.th_ch.youtube_music", "to": "YT Music" }
- ],
+ "playerAliases": [{ "from": "com.github.th_ch.youtube_music", "to": "YT Music" }],
"weatherLocation": "",
"useFahrenheit": false,
"useTwelveHourClock": false,
@@ -444,6 +413,39 @@ The module automatically adds Caelestia shell to the path with **full functional
+### Home Manager Module
+
+For NixOS users, a home manager module is also available.
+
+home.nix
+
+```nix
+programs.caelestia = {
+ enable = true;
+ systemd = {
+ enable = false; # if you prefer starting from your compositor
+ target = "graphical-session.target";
+ environment = [];
+ };
+ settings = {
+ bar.status = {
+ showBattery = false;
+ };
+ paths.wallpaperDir = "~/Images";
+ };
+ cli = {
+ enable = true; # Also add caelestia-cli to path
+ settings = {
+ theme.enableGtk = false;
+ };
+ };
+};
+```
+
+The module automatically adds Caelestia shell to the path with **full functionality**. The CLI is not required, however you have the option to enable and configure it.
+
+
+
## FAQ
### My screen is flickering, help pls!
@@ -499,7 +501,7 @@ which helped me a lot with learning how to use Quickshell.
Finally another thank you to all the configs I took inspiration from (only one for now):
-- [Axenide/Ax-Shell](https://github.com/Axenide/Ax-Shell)
+- [Axenide/Ax-Shell](https://github.com/Axenide/Ax-Shell)
## Stonks 📈
diff --git a/nix/hm-module.nix b/nix/hm-module.nix
index 7eb6efa..92f2f51 100644
--- a/nix/hm-module.nix
+++ b/nix/hm-module.nix
@@ -11,6 +11,9 @@ self: {
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";
@@ -30,7 +33,15 @@ in {
description = ''
The systemd target that will automatically start the Caelestia shell.
'';
- default = "graphical-session.target";
+ 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 {
@@ -43,14 +54,6 @@ in {
default = "";
description = "Caelestia shell extra configs written to shell.json";
};
- 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"
- ];
- };
cli = {
enable = mkEnableOption "Enable Caelestia CLI";
package = mkOption {
@@ -73,8 +76,8 @@ in {
};
config = let
- cli = cfg.cli.package or cli-default;
- shell = cfg.package or shell-default;
+ cli = cfg.cli.package;
+ shell = cfg.package;
in
lib.mkIf cfg.enable {
systemd.user.services.caelestia = lib.mkIf cfg.systemd.enable {
@@ -93,10 +96,11 @@ in {
Restart = "on-failure";
RestartSec = "5s";
TimeoutStopSec = "5s";
- Environment = [
- "QT_QPA_PLATFORM=wayland"
- ]
- ++ cfg.environment;
+ Environment =
+ [
+ "QT_QPA_PLATFORM=wayland"
+ ]
+ ++ cfg.systemd.environment;
Slice = "session.slice";
};
--
cgit v1.2.3-freya