mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 13:39:46 +01:00
nix-your-shell: add module
A wrapper for `nix develop` and `nix-shell` to run non-Bash shells.
This commit is contained in:
parent
6a8444467c
commit
bc7ef22d1f
2 changed files with 22 additions and 0 deletions
|
@ -156,6 +156,7 @@ let
|
|||
./programs/newsboat.nix
|
||||
./programs/nheko.nix
|
||||
./programs/nix-index.nix
|
||||
./programs/nix-your-shell.nix
|
||||
./programs/nnn.nix
|
||||
./programs/noti.nix
|
||||
./programs/notmuch.nix
|
||||
|
|
21
modules/programs/nix-your-shell.nix
Normal file
21
modules/programs/nix-your-shell.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{ 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} --");
|
||||
}));
|
||||
}
|
Loading…
Reference in a new issue