mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-18 14:28:15 +00:00
Can generate the config without installing application through home-manager. Helpful when a package is broken (or not provided) on a specific platform through nixpkgs and needs to be installed through other means but you still can benefit from the declarative configuration.
79 lines
2.2 KiB
Nix
79 lines
2.2 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
inherit (lib)
|
|
getExe literalExpression mkEnableOption mkIf mkOption mkPackageOption
|
|
optional;
|
|
|
|
cfg = config.services.wob;
|
|
settingsFormat = pkgs.formats.ini { };
|
|
|
|
configFile = settingsFormat.generate "wob.ini" cfg.settings;
|
|
in {
|
|
meta.maintainers = with lib.maintainers; [ Scrumplex ];
|
|
|
|
options.services.wob = {
|
|
enable = mkEnableOption "wob";
|
|
package = mkPackageOption pkgs "wob" { nullable = true; };
|
|
|
|
settings = mkOption {
|
|
type = settingsFormat.type;
|
|
default = { };
|
|
example = literalExpression ''
|
|
{
|
|
"" = {
|
|
border_size = 10;
|
|
height = 50;
|
|
};
|
|
"output.foo".name = "DP-1";
|
|
"style.muted".background_color = "032cfc";
|
|
}
|
|
'';
|
|
description = ''
|
|
Configuration written to {file}`$XDG_CONFIG_HOME/wob/wob.ini`.
|
|
See {manpage}`wob.ini(5)` for documentation.
|
|
'';
|
|
};
|
|
|
|
systemd = mkEnableOption "systemd service and socket for wob"
|
|
// mkOption { default = true; };
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
assertions = [
|
|
(lib.hm.assertions.assertPlatform "services.wob" pkgs lib.platforms.linux)
|
|
];
|
|
|
|
systemd.user = mkIf (cfg.systemd && (cfg.package != null)) {
|
|
services.wob = {
|
|
Unit = {
|
|
Description =
|
|
"A lightweight overlay volume/backlight/progress/anything bar for Wayland";
|
|
Documentation = "man:wob(1)";
|
|
PartOf = [ config.wayland.systemd.target ];
|
|
After = [ config.wayland.systemd.target ];
|
|
ConditionEnvironment = "WAYLAND_DISPLAY";
|
|
};
|
|
Service = {
|
|
StandardInput = "socket";
|
|
ExecStart = builtins.concatStringsSep " " ([ (getExe cfg.package) ]
|
|
++ optional (cfg.settings != { }) "--config ${configFile}");
|
|
};
|
|
Install.WantedBy = [ config.wayland.systemd.target ];
|
|
};
|
|
|
|
sockets.wob = {
|
|
Socket = {
|
|
ListenFIFO = "%t/wob.sock";
|
|
SocketMode = "0600";
|
|
RemoveOnStop = "yes";
|
|
FlushPending = "yes";
|
|
};
|
|
Install.WantedBy = [ "sockets.target" ];
|
|
};
|
|
};
|
|
|
|
xdg.configFile."wob/wob.ini" =
|
|
mkIf (cfg.settings != { }) { source = configFile; };
|
|
};
|
|
}
|