mirror of
https://github.com/nix-community/home-manager.git
synced 2026-11-05 12:20:50 +00:00
The settings description linked to the config page of the old documentation site, which returns 404. The current site documents the config.json keys on its configuration schema page, so link that.
52 lines
1.2 KiB
Nix
52 lines
1.2 KiB
Nix
{
|
|
lib,
|
|
pkgs,
|
|
config,
|
|
...
|
|
}:
|
|
let
|
|
inherit (lib)
|
|
mkIf
|
|
mkEnableOption
|
|
mkPackageOption
|
|
mkOption
|
|
;
|
|
|
|
cfg = config.programs.alistral;
|
|
jsonFormat = pkgs.formats.json { };
|
|
in
|
|
{
|
|
options.programs.alistral = {
|
|
enable = mkEnableOption "alistral";
|
|
package = mkPackageOption pkgs "alistral" { nullable = true; };
|
|
settings = mkOption {
|
|
inherit (jsonFormat) type;
|
|
default = { };
|
|
example = {
|
|
default_user = "spanish_inquisition";
|
|
listenbrainz_url = "https://api.listenbrainz.org/1/";
|
|
musicbrainz_url = "http://musicbrainz.org/ws/2";
|
|
};
|
|
description = ''
|
|
Configuration settings for alistral. You can see the details here:
|
|
<https://rustynova016.github.io/Alistral/schemas/config/>.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config =
|
|
let
|
|
configDir =
|
|
if pkgs.stdenv.hostPlatform.isDarwin then
|
|
"Library/Application Support/alistral"
|
|
else
|
|
".config/alistral";
|
|
in
|
|
mkIf cfg.enable {
|
|
home.packages = mkIf (cfg.package != null) [ cfg.package ];
|
|
home.file."${configDir}/config.json" = mkIf (cfg.settings != { }) {
|
|
source = jsonFormat.generate "alistral-config.json" cfg.settings;
|
|
};
|
|
};
|
|
}
|