Files
home-manager/modules/programs/bacon.nix
Austin Horstman 01ea51d706 treewide: use inherit for attribute assignments
This change converts redundant attribute assignments of the form `a =
a;` or `a = someSet.a;` into cleaner `inherit` statements. This reduces
verbosity and follows common Nix style for bringing attributes into
scope.

Statix Codes: W03 (manual_inherit), W04 (manual_inherit_from)

Also include statix and the rule in our configuration.
2026-04-08 14:47:48 -05:00

59 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.maintainers.shimun ];
options.programs.bacon = {
enable = lib.mkEnableOption "bacon, a background rust code checker";
package = lib.mkPackageOption pkgs "bacon" { nullable = true; };
settings = lib.mkOption {
inherit (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;
};
};
}