1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00
home-manager/modules/programs/bacon.nix
Austin Horstman 86402a17b6 treewide: flatten single file modules
Some files don't need nesting and can be root level again to reduce
conflicts with other PRs.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2025-06-23 16:20:26 -05:00

58 lines
1.4 KiB
Nix

{
config,
lib,
pkgs,
...
}:
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 = [ lib.hm.maintainers.shimunn ];
options.programs.bacon = {
enable = lib.mkEnableOption "bacon, a background rust code checker";
package = lib.mkPackageOption pkgs "bacon" { nullable = true; };
settings = lib.mkOption {
type = settingsFormat.type;
default = { };
example = {
jobs.default = {
command = [
"cargo"
"build"
"--all-features"
"--color"
"always"
];
need_stdout = true;
};
};
description = ''
Bacon configuration written to either {file}`Library/Application Support/org.dystroy.bacon/prefs.toml`
(darwin) or {file}`$XDG_CONFIG_HOME/bacon/prefs.toml`.
For available settings see <https://dystroy.org/bacon/#global-preferences>.
'';
};
};
config = lib.mkIf cfg.enable {
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file."${configDir}/prefs.toml" = lib.mkIf (cfg.settings != { }) {
source = settingsFormat.generate "bacon-prefs" cfg.settings;
};
};
}