mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
nix-your-shell: flatten-out genAttrs
use
By request of rycee: https://github.com/nix-community/home-manager/pull/4645#discussion_r1390051459
This commit is contained in:
parent
b7615d9c1b
commit
4e0c6a7e4e
1 changed files with 11 additions and 8 deletions
|
@ -1,11 +1,12 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
inherit (lib) genAttrs getExe;
|
||||
cfg = config.programs.nix-your-shell;
|
||||
|
||||
# In principle `bash` is supported too, but... 😹
|
||||
shells = [ "fish" "ion" "nushell" "zsh" ];
|
||||
programs = [ "nix" "nix-shell" ];
|
||||
exe = lib.getExe pkgs.nix-your-shell;
|
||||
mkShellAliases = shell: {
|
||||
nix = "${exe} ${shell} nix --";
|
||||
nix-shell = "${exe} ${shell} nix-shell --";
|
||||
};
|
||||
in {
|
||||
meta.maintainers = with lib.maintainers; [ nicoo ];
|
||||
|
||||
|
@ -14,8 +15,10 @@ in {
|
|||
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} --");
|
||||
}));
|
||||
config.programs = lib.mkIf cfg.enable {
|
||||
fish.shellAliases = mkShellAliases "fish";
|
||||
ion.shellAliases = mkShellAliases "ion";
|
||||
nushell.shellAliases = mkShellAliases "nushell";
|
||||
zsh.shellAliases = mkShellAliases "zsh";
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue