mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-03-31 17:10:54 +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;
|
enable = true;
|
||||||
# systemd = false;
|
# systemd = false;
|
||||||
# package = inputs.lan-mouse.packages.${pkgs.stdenv.hostPlatform.system}.default
|
# 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
|
with lib; let
|
||||||
cfg = config.programs.lan-mouse;
|
cfg = config.programs.lan-mouse;
|
||||||
defaultPackage = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
defaultPackage = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
||||||
|
tomlFormat = pkgs.formats.toml {};
|
||||||
in {
|
in {
|
||||||
options.programs.lan-mouse = with types; {
|
options.programs.lan-mouse = with types; {
|
||||||
enable = mkEnableOption "Whether or not to enable lan-mouse.";
|
enable = mkEnableOption "Whether or not to enable lan-mouse.";
|
||||||
@@ -25,6 +26,17 @@ in {
|
|||||||
default = pkgs.stdenv.isLinux;
|
default = pkgs.stdenv.isLinux;
|
||||||
description = "Whether to enable to systemd service for lan-mouse.";
|
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 {
|
config = mkIf cfg.enable {
|
||||||
@@ -46,5 +58,9 @@ in {
|
|||||||
home.packages = [
|
home.packages = [
|
||||||
cfg.package
|
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