mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-19 14:53:00 +00:00
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.
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" { 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;
|
|
};
|
|
};
|
|
}
|