1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-03-31 04:04:32 +00:00
home-manager/modules/programs/opam.nix
2025-03-29 11:48:55 -05:00

42 lines
966 B
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.opam;
in {
meta.maintainers = [ ];
options.programs.opam = {
enable = 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 = mkIf cfg.enable {
home.packages = [ cfg.package ];
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
eval "$(${cfg.package}/bin/opam env --shell=bash)"
'';
programs.zsh.initContent = mkIf cfg.enableZshIntegration ''
eval "$(${cfg.package}/bin/opam env --shell=zsh)"
'';
programs.fish.shellInit = mkIf cfg.enableFishIntegration ''
eval (${cfg.package}/bin/opam env --shell=fish)
'';
};
}