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>
This commit is contained in:
Davi Ribeiro 2025-09-03 09:03:01 -03:00 committed by GitHub
parent 6e775a1a0e
commit fb9c6d4950
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 57 additions and 51 deletions

View file

@ -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.
<details><summary><code>home.nix</code></summary>
```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.
</details>
### 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.
<details><summary>Example configuration</summary>
<details><summary>Example</summary>
```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
</details>
### Home Manager Module
For NixOS users, a home manager module is also available.
<details><summary><code>home.nix</code></summary>
```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.
</details>
## 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 📈

View file

@ -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";
};