2023-11-10 03:05:16 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.programs.nix-your-shell;
|
|
|
|
|
2024-08-19 11:36:41 +02:00
|
|
|
exe = lib.getExe pkgs.nix-your-shell;
|
|
|
|
mkShellAliases = shell: {
|
|
|
|
nix = "${exe} ${shell} nix --";
|
|
|
|
nix-shell = "${exe} ${shell} nix-shell --";
|
|
|
|
};
|
2023-11-10 03:05:16 +01:00
|
|
|
in {
|
|
|
|
meta.maintainers = with lib.maintainers; [ nicoo ];
|
|
|
|
|
|
|
|
options.programs.nix-your-shell.enable = lib.mkEnableOption ''
|
|
|
|
`nix-your-shell`, a wrapper for `nix develop` or `nix-shell`
|
|
|
|
to run the same shell inside the new environment.
|
|
|
|
'';
|
|
|
|
|
2024-08-19 11:36:41 +02:00
|
|
|
config.programs = lib.mkIf cfg.enable {
|
|
|
|
fish.shellAliases = mkShellAliases "fish";
|
|
|
|
ion.shellAliases = mkShellAliases "ion";
|
|
|
|
nushell.shellAliases = mkShellAliases "nushell";
|
|
|
|
zsh.shellAliases = mkShellAliases "zsh";
|
|
|
|
};
|
2023-11-10 03:05:16 +01:00
|
|
|
}
|