mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-21 09:49:39 +01:00
way-displays: support stateful configuration file (#7138)
This is good for when displays are not considered part of the home configuration and are instead considered ephemeral. Great for laptops but I use it for my desktop as well.
This commit is contained in:
parent
dceefa87dc
commit
04672588c6
1 changed files with 23 additions and 10 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
options,
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
|
@ -21,7 +22,10 @@ let
|
||||||
yaml = pkgs.formats.yaml { };
|
yaml = pkgs.formats.yaml { };
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
meta.maintainers = [ maintainers.jolars ];
|
meta.maintainers = [
|
||||||
|
maintainers.jolars
|
||||||
|
maintainers.mightyiam
|
||||||
|
];
|
||||||
|
|
||||||
options.services.way-displays = {
|
options.services.way-displays = {
|
||||||
enable = mkEnableOption "way-displays";
|
enable = mkEnableOption "way-displays";
|
||||||
|
|
@ -29,7 +33,7 @@ in
|
||||||
package = lib.mkPackageOption pkgs "way-displays" { };
|
package = lib.mkPackageOption pkgs "way-displays" { };
|
||||||
|
|
||||||
settings = mkOption {
|
settings = mkOption {
|
||||||
type = yaml.type;
|
type = types.nullOr yaml.type;
|
||||||
default = { };
|
default = { };
|
||||||
example = literalExpression ''
|
example = literalExpression ''
|
||||||
{
|
{
|
||||||
|
|
@ -61,6 +65,9 @@ in
|
||||||
{file}`$XDG_CONFIG_HOME/way-displays/cfg.yml`. See
|
{file}`$XDG_CONFIG_HOME/way-displays/cfg.yml`. See
|
||||||
<https://github.com/alex-courtis/way-displays/wiki/Configuration> for a
|
<https://github.com/alex-courtis/way-displays/wiki/Configuration> for a
|
||||||
description of available options.
|
description of available options.
|
||||||
|
|
||||||
|
When `null` a configuration file is not generated,
|
||||||
|
which allows way-displays to write its own configuration.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -79,14 +86,20 @@ in
|
||||||
(lib.hm.assertions.assertPlatform "services.way-displays" pkgs lib.platforms.linux)
|
(lib.hm.assertions.assertPlatform "services.way-displays" pkgs lib.platforms.linux)
|
||||||
];
|
];
|
||||||
|
|
||||||
xdg.configFile."way-displays/cfg.yaml".source =
|
home.packages = [ cfg.package ];
|
||||||
yaml.generate "way-displays-config.yaml"
|
|
||||||
(mergeSets [
|
wayland.windowManager = lib.mapAttrs (name: _: {
|
||||||
|
systemd.variables = [ "XDG_VTNR" ];
|
||||||
|
}) options.wayland.windowManager;
|
||||||
|
|
||||||
|
xdg.configFile."way-displays/cfg.yaml" = mkIf (cfg.settings != null) {
|
||||||
|
source = yaml.generate "way-displays-config.yaml" (mergeSets [
|
||||||
{
|
{
|
||||||
CALLBACK_CMD = "${pkgs.libnotify}/bin/notify-send \"way-displays \${CALLBACK_LEVEL}\" \"\${CALLBACK_MSG}\"";
|
CALLBACK_CMD = "${pkgs.libnotify}/bin/notify-send \"way-displays \${CALLBACK_LEVEL}\" \"\${CALLBACK_MSG}\"";
|
||||||
}
|
}
|
||||||
cfg.settings
|
cfg.settings
|
||||||
]);
|
]);
|
||||||
|
};
|
||||||
|
|
||||||
systemd.user.services.way-displays = {
|
systemd.user.services.way-displays = {
|
||||||
Unit = {
|
Unit = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue