mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 05:03:09 +00:00
opam: add module
This commit is contained in:
parent
40b3443c8f
commit
7afefcf75d
3 changed files with 60 additions and 0 deletions
|
@ -922,6 +922,13 @@ in
|
|||
when activating your Home Manager configuration.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2018-12-28T12:32:30+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.opam'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ let
|
|||
(loadModule ./programs/notmuch.nix { })
|
||||
(loadModule ./programs/obs-studio.nix { })
|
||||
(loadModule ./programs/offlineimap.nix { })
|
||||
(loadModule ./programs/opam.nix { })
|
||||
(loadModule ./programs/pidgin.nix { })
|
||||
(loadModule ./programs/rofi.nix { })
|
||||
(loadModule ./programs/ssh.nix { })
|
||||
|
|
52
modules/programs/opam.nix
Normal file
52
modules/programs/opam.nix
Normal file
|
@ -0,0 +1,52 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.opam;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
meta.maintainers = [ maintainers.marsam ];
|
||||
|
||||
options.programs.opam = {
|
||||
enable = mkEnableOption "Opam";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.opam;
|
||||
defaultText = "pkgs.opam";
|
||||
description = "Opam package to install.";
|
||||
};
|
||||
|
||||
enableBashIntegration = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether to enable Bash integration.
|
||||
'';
|
||||
};
|
||||
|
||||
enableZshIntegration = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether to enable Zsh integration.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
||||
eval "$(${cfg.package}/bin/opam env --shell=bash)"
|
||||
'';
|
||||
|
||||
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
|
||||
eval "$(${cfg.package}/bin/opam env --shell=zsh)"
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue