mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-30 22:21:02 +01:00
quickshell: add module (#7316)
This commit is contained in:
parent
cab8104e92
commit
f6deff178c
2 changed files with 98 additions and 0 deletions
8
modules/misc/news/2025/06/2025-06-23_23-44-23.nix
Normal file
8
modules/misc/news/2025/06/2025-06-23_23-44-23.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
time = "2025-06-24T03:44:23+00:00";
|
||||||
|
condition = pkgs.stdenv.hostPlatform.isLinux;
|
||||||
|
message = ''
|
||||||
|
A new module is available: 'programs.quickshell'.
|
||||||
|
'';
|
||||||
|
}
|
||||||
90
modules/programs/quickshell.nix
Normal file
90
modules/programs/quickshell.nix
Normal file
|
|
@ -0,0 +1,90 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.programs.quickshell;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
meta.maintainers = [ lib.hm.maintainers.justdeeevin ];
|
||||||
|
|
||||||
|
options.programs.quickshell = {
|
||||||
|
enable = lib.mkEnableOption "quickshell, a flexbile QtQuick-based desktop shell toolkit.";
|
||||||
|
package = lib.mkPackageOption pkgs "quickshell" { nullable = true; };
|
||||||
|
configs = lib.mkOption {
|
||||||
|
type = lib.types.attrsOf lib.types.path;
|
||||||
|
default = { };
|
||||||
|
description = ''
|
||||||
|
A set of configs to include in the quickshell config directory. The key is the name of the config.
|
||||||
|
|
||||||
|
The configuration that quickshell should use can be specified with the `activeConfig` option.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
activeConfig = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
The name of the config to use.
|
||||||
|
|
||||||
|
If `null`, quickshell will attempt to use a config located in `$XDG_CONFIG_HOME/quickshell` instead of one of the named sub-directories.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd = {
|
||||||
|
enable = lib.mkEnableOption "quickshell systemd service";
|
||||||
|
target = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = config.wayland.systemd.target;
|
||||||
|
defaultText = lib.literalExpression "config.wayland.systemd.target";
|
||||||
|
example = "hyprland-session.target";
|
||||||
|
description = ''
|
||||||
|
The systemd target that will automatically start quickshell.
|
||||||
|
|
||||||
|
If you set this to a WM-specific target, make sure that systemd integration for that WM is enabled (e.g. `wayland.windowManager.hyprland.systemd.enable`). **This is typically true by default**.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
(lib.mkIf (cfg.configs != { }) {
|
||||||
|
xdg.configFile = lib.mapAttrs' (name: path: {
|
||||||
|
name = "quickshell/${name}";
|
||||||
|
value.source = path;
|
||||||
|
}) cfg.configs;
|
||||||
|
})
|
||||||
|
{
|
||||||
|
assertions = [
|
||||||
|
(lib.hm.assertions.assertPlatform "programs.quickshell" pkgs lib.platforms.linux)
|
||||||
|
{
|
||||||
|
assertion = !(builtins.any (name: lib.hasInfix "/" name) (builtins.attrNames cfg.configs));
|
||||||
|
message = "The names of configs in `programs.quickshell.configs` must not contain slashes.";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
|
}
|
||||||
|
(lib.mkIf cfg.systemd.enable {
|
||||||
|
systemd.user.services.quickshell = {
|
||||||
|
Unit = {
|
||||||
|
Description = "quickshell";
|
||||||
|
Documentation = "https://quickshell.outfoxxed.me/docs/";
|
||||||
|
After = [ cfg.systemd.target ];
|
||||||
|
};
|
||||||
|
|
||||||
|
Service = {
|
||||||
|
ExecStart =
|
||||||
|
lib.getExe cfg.package + (if cfg.activeConfig == null then "" else " --config ${cfg.activeConfig}");
|
||||||
|
Restart = "on-failure";
|
||||||
|
};
|
||||||
|
|
||||||
|
Install.WantedBy = [ cfg.systemd.target ];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue