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/opam.nix
Austin Horstman cba2f9ce95 treewide: reformat nixfmt-rfc-style
Reformat repository using new nixfmt-rfc-style.
2025-04-08 08:50:05 -07:00

40 lines
962 B
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.programs.opam;
in
{
meta.maintainers = [ ];
options.programs.opam = {
enable = lib.mkEnableOption "Opam";
package = lib.mkPackageOption pkgs "opam" { };
enableBashIntegration = lib.hm.shell.mkBashIntegrationOption { inherit config; };
enableFishIntegration = lib.hm.shell.mkFishIntegrationOption { inherit config; };
enableZshIntegration = lib.hm.shell.mkZshIntegrationOption { inherit config; };
};
config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ];
programs.bash.initExtra = lib.mkIf cfg.enableBashIntegration ''
eval "$(${cfg.package}/bin/opam env --shell=bash)"
'';
programs.zsh.initContent = lib.mkIf cfg.enableZshIntegration ''
eval "$(${cfg.package}/bin/opam env --shell=zsh)"
'';
programs.fish.shellInit = lib.mkIf cfg.enableFishIntegration ''
eval (${cfg.package}/bin/opam env --shell=fish)
'';
};
}