2023-11-10 03:05:16 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
|
|
inherit (lib) genAttrs getExe;
|
|
|
|
cfg = config.programs.nix-your-shell;
|
|
|
|
|
|
|
|
# In principle `bash` is supported too, but... 😹
|
2023-11-10 12:32:28 +01:00
|
|
|
shells = [ "fish" "ion" "nushell" "zsh" ];
|
2023-11-10 03:05:16 +01:00
|
|
|
programs = [ "nix" "nix-shell" ];
|
|
|
|
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.
|
|
|
|
'';
|
|
|
|
|
|
|
|
config.programs = lib.mkIf cfg.enable (genAttrs shells (shell: {
|
|
|
|
shellAliases = genAttrs programs
|
|
|
|
(program: "${getExe pkgs.nix-your-shell} ${shell} ${program} --");
|
|
|
|
}));
|
|
|
|
}
|