mirror of
https://github.com/nix-community/home-manager
synced 2025-01-11 19:49:49 +01:00
59a4c43e9b
bacon reads its preferences from a different directory on Darwin. Fix the path to read out of: ~/Library/Application\ Support/org.dystroy.bacon/prefs.toml Linux behavior should be unchanged.
47 lines
1.1 KiB
Nix
47 lines
1.1 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.programs.bacon;
|
|
|
|
settingsFormat = pkgs.formats.toml { };
|
|
|
|
configDir = if pkgs.stdenv.isDarwin then
|
|
"Library/Application Support/org.dystroy.bacon"
|
|
else
|
|
"${config.xdg.configHome}/bacon";
|
|
|
|
in {
|
|
meta.maintainers = [ hm.maintainers.shimunn ];
|
|
|
|
options.programs.bacon = {
|
|
enable = mkEnableOption "bacon, a background rust code checker";
|
|
|
|
package = mkPackageOption pkgs "bacon" { };
|
|
|
|
settings = mkOption {
|
|
type = settingsFormat.type;
|
|
default = { };
|
|
example = {
|
|
jobs.default = {
|
|
command = [ "cargo" "build" "--all-features" "--color" "always" ];
|
|
need_stdout = true;
|
|
};
|
|
};
|
|
description = ''
|
|
Bacon configuration.
|
|
For available settings see <https://dystroy.org/bacon/#global-preferences>.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
home.packages = [ cfg.package ];
|
|
|
|
home.file."${configDir}/prefs.toml" = mkIf (cfg.settings != { }) {
|
|
source = settingsFormat.generate "prefs.toml" cfg.settings;
|
|
};
|
|
};
|
|
}
|