1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-24 03:59:46 +01:00
home-manager/modules/programs/nix-your-shell.nix
nicoo bc7ef22d1f nix-your-shell: add module
A wrapper for `nix develop` and `nix-shell` to run non-Bash shells.
2023-11-10 02:54:15 +00:00

21 lines
673 B
Nix

{ config, lib, pkgs, ... }:
let
inherit (lib) genAttrs getExe;
cfg = config.programs.nix-your-shell;
# In principle `bash` is supported too, but... 😹
shells = [ "fish" "nushell" "zsh" ];
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} --");
}));
}