1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-03-19 06:43:01 +00:00
home-manager/modules/programs/bacon.nix
Austin Horstman d2c014e1c7
treewide: null package support (#6582)
Can generate the config without installing application through home-manager. Helpful when a package is broken (or not provided) on a specific platform through nixpkgs and needs to be installed through other means but you still can benefit from the declarative configuration.
2025-03-07 18:17:52 -06:00

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" { nullable = true; };
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 = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file."${configDir}/prefs.toml" = mkIf (cfg.settings != { }) {
source = settingsFormat.generate "prefs.toml" cfg.settings;
};
};
}