mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
`literalExpression` is intended just to signify code that needs to stay a string that gets represented exactly as-is for docs. It has been misused heavily and people get confused repeatedly on when or not to use it because of the rampant misuse.
64 lines
1.3 KiB
Nix
64 lines
1.3 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
|
|
let
|
|
inherit (lib)
|
|
hm
|
|
mkEnableOption
|
|
mkIf
|
|
mkOption
|
|
;
|
|
cfg = config.programs.sheldon;
|
|
tomlFormat = pkgs.formats.toml { };
|
|
in
|
|
{
|
|
meta.maintainers = with hm.maintainers; [
|
|
Kyure-A
|
|
mainrs
|
|
elanora96
|
|
];
|
|
|
|
options.programs.sheldon = {
|
|
enable = mkEnableOption "sheldon";
|
|
|
|
package = lib.mkPackageOption pkgs "sheldon" { };
|
|
|
|
settings = mkOption {
|
|
inherit (tomlFormat) type;
|
|
default = { };
|
|
description = "";
|
|
example = "";
|
|
};
|
|
|
|
enableZshIntegration = hm.shell.mkZshIntegrationOption { inherit config; };
|
|
|
|
enableBashIntegration = hm.shell.mkBashIntegrationOption { inherit config; };
|
|
|
|
enableFishIntegration = hm.shell.mkFishIntegrationOption { inherit config; };
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
home.packages = [ cfg.package ];
|
|
|
|
xdg.configFile."sheldon/plugins.toml" = mkIf (cfg.settings != { }) {
|
|
source = tomlFormat.generate "sheldon-config" cfg.settings;
|
|
};
|
|
|
|
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
|
eval "$(sheldon source)"
|
|
'';
|
|
|
|
programs.zsh.initContent = mkIf cfg.enableZshIntegration ''
|
|
eval "$(sheldon source)"
|
|
'';
|
|
|
|
programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration ''
|
|
eval "$(sheldon source)"
|
|
'';
|
|
};
|
|
}
|