mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-03-07 11:59:59 +03:00
nix: enable creating config file via home-manager (#109)
This commit is contained in:
@@ -34,6 +34,9 @@ enable lan-mouse
|
||||
enable = true;
|
||||
# systemd = false;
|
||||
# package = inputs.lan-mouse.packages.${pkgs.stdenv.hostPlatform.system}.default
|
||||
# Optional configuration in nix syntax, see config.toml for available options
|
||||
# settings = { };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ self: {
|
||||
with lib; let
|
||||
cfg = config.programs.lan-mouse;
|
||||
defaultPackage = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
||||
tomlFormat = pkgs.formats.toml {};
|
||||
in {
|
||||
options.programs.lan-mouse = with types; {
|
||||
enable = mkEnableOption "Whether or not to enable lan-mouse.";
|
||||
@@ -25,6 +26,17 @@ in {
|
||||
default = pkgs.stdenv.isLinux;
|
||||
description = "Whether to enable to systemd service for lan-mouse.";
|
||||
};
|
||||
settings = lib.mkOption {
|
||||
inherit (tomlFormat) type;
|
||||
default = {};
|
||||
example = builtins.fromTOML (builtins.readFile (self + /config.toml));
|
||||
description = ''
|
||||
Optional configuration written to {file}`$XDG_CONFIG_HOME/lan-mouse/config.toml`.
|
||||
|
||||
See <https://github.com/feschber/lan-mouse/> for
|
||||
available options and documentation.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
@@ -46,5 +58,9 @@ in {
|
||||
home.packages = [
|
||||
cfg.package
|
||||
];
|
||||
|
||||
xdg.configFile."lan-mouse/config.toml" = lib.mkIf (cfg.settings != {}) {
|
||||
source = tomlFormat.generate "config.toml" cfg.settings;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user