nixos/nvrs: init module
Co-authored-by: azey <me@azey.net> Signed-off-by: adam <me@adamperkowski.dev>
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.programs.nvrs;
|
||||
settingsFormat = pkgs.formats.toml { };
|
||||
in
|
||||
{
|
||||
meta.maintainers = with lib.maintainers; [ adamperkowski ];
|
||||
|
||||
options.programs.nvrs = {
|
||||
enable = lib.mkEnableOption "nvrs";
|
||||
|
||||
package = lib.mkPackageOption pkgs "nvrs" { };
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = lib.types.submodule {
|
||||
freeformType = settingsFormat.type;
|
||||
};
|
||||
|
||||
default = { };
|
||||
description = ''
|
||||
Configuration written to {file}`$XDG_CONFIG_HOME/nvrs/config.toml`
|
||||
|
||||
See <https://nvrs.adamperkowski.dev/configuration.html> for details.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
environment.etc = {
|
||||
"nvrs/nvrs.toml" = lib.mkIf (cfg.settings != { }) {
|
||||
source = settingsFormat.generate "nvrs-config.toml" cfg.settings;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user